King Saud University GAMS Code Binary Variable & Free Variable Worksheet

check the GAMS code if it is correct and show me the result also fix it if there are any mistakes

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

sets i/1*40/, g/1*4/;
alias (i,j)
parameters a(i)/1 210,2 385,3 270,4 175,5 200,6 190,7 160,8 410,9 295,10 160,11 360,12
150,13 235,14 315,15 340,16 260,17 275,18 185,19 290,20 220,21 680,22 1240,23 1680,24
1090,25 2100,26 1950,27 2821,28 1730,29 1450,30 860,31 525,32 265,33 300,34 870,35
600,36 450,37 220,38 485,32 230/,
s(g)/1 7000,2 7000,3 7000,4 7000/;
scalar delta;
delta = 14;
free variable y(i);
positive variable d(i,j);
binary variable x(i,g);
free variable z;
equations con1(i),con2(g),con3(i),con4(i,j),con5(i,j),con6(g),con7,con8(g),con9,obj;
con1(i).. sum(g,x(i,g)) =e= 1;
con2(g).. sum(i,(a(i)*x(i,g))) =l= s(g);
con3(i).. y(i) =e= sum(g,ord(g)*x(i,g));
con4(i,j)$(ord(i) ne ord(j))..d(i,j) =g= delta*(y(i)-y(j));
con5(i,j)$(ord(i) ne ord(j))..d(i,j) =g= delta*(y(j)-y(i));
con6(g).. x(’21’,g)+x(’22’,g)+x(’23’,g)+x(’24’,g)+x(’25’,g)+x(’26’,g)+x(’27’,g)+x(’28’,g)+x(’29’,g)
=e= 9;
con7.. x(‘4′,1)+x(’10’,1) =l= 1;
con8(g).. x(’13’,g)+x(’24’,g) =l= 1;
con9.. x(‘9′,2)-x(’13’,2) =e= 0;
obj.. z =e= sum((i,j)$(ord(i) ne ord(j)), d(i,j));
model floor_assign_mdl/
con1,
con2,
con3,
con4,
con5,
con7,
con8,
con9,
obj/;
option mip = cplex;
solve floor_assign_mdl using mip minimizing z;
display x.l ;

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER