IE 322 Lab 3 Compact Form Using Data
IE 322 Lab 3 Compact Form Using Data
Operations Analysis II -
Lab
Compact Form
u Parameters
//Parameters
int N=...;
int M=...;
range student=1..N;
range course=1..M;
int cap[course]=...;
int P[student][course]=...;
u Decision Variables
//Decision Variables
dvar boolean x[student][course];
Solution (filename.dat)
N=10;
M=6;
TotCoursesPerStudent=2;
cap=[6 8 5 5 6 5];
P=[
[20 40 50 30 90 100]
[90 100 80 70 10 40]
[25 40 30 80 95 90]
[80 50 60 80 30 40]
[75 60 90 100 50 40]
[60 40 90 10 80 80]
[45 40 70 60 55 60]
[30 100 40 70 90 55]
[80 60 100 70 65 80]
[40 60 80 100 90 10]
];
Objective Function
//Objective function
dexpr float z= sum(i in student, j in course) P[i][j]*x[i][j];
maximize z;
Constraints
//Constraints
subject to{
forall(i in student)
sum(j in course)x[i][j]==TotCoursesPerStudent;
forall(j in course)
sum(i in student)x[i][j]<=cap[j];
{
Run Configuration
1
2
Solution
To be cont.