Skip to content

Instantly share code, notes, and snippets.

@quangIO
Last active April 18, 2019 14:12
Show Gist options
  • Save quangIO/15e83cce6ae2a463456c80b2c61c4b19 to your computer and use it in GitHub Desktop.
Save quangIO/15e83cce6ae2a463456c80b2c61c4b19 to your computer and use it in GitHub Desktop.
Set
i "Project" / 1*8 /
j "Atributes" / person_weeks, labors, crane, profit, perm /;
Table p1(i, j) "Parameters for the problem"
person_weeks labors crane profit perm
1 8 6 1 80 70
2 12 5 0 110 80
3 13 4 1 100 50
4 11 7 0 90 30
5 9 8 0 70 70
6 7 3 1 80 80
7 8 4 1 90 60
8 8 5 1 60 40;
Variables
x(i) "Choose a project or not"
z "Total profit (in thousands)"
zp "Total profil considering maximin";
Binary Variable x;
Equations
earning "Total earning"
earningp "For maximin case"
weeks "Total preparation time, person-weeks"
labors "Total skilled labors"
cranes "Number of cranes";
earning .. z =e= sum(i, p1(i, "profit") * x(i));
earningp.. zp =e= sum(i, p1(i, "perm") * x(i));
weeks .. 50 =g= sum(i, p1(i, "person_weeks") * x(i));
labors .. 30 =g= sum(i, p1(i, "labors") * x(i));
cranes .. 3 =g= sum(i, p1(i, "crane") * x(i));
Model construction /earning,weeks,labors,cranes/ ;
Solve construction using MIP maximizing z ;
Display x.l, z.l;
Model maximin /earningp,weeks,labors,cranes/ ;
Solve maximin using MIP maximizing zp;
Display x.l, zp.l;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment