* GAMS Solution to PS06_2 * 28 October, 2006 $offlisting $offsymxref $offsymlist option limrow=0 limcol=0 ; variables x1 x2 x3 x4 x5 F ; positive variables x1 x2 ; integer variables x4 x5 ; * initialize variables for non-linear solver x1.l = 4 ; x2.l = 4 ; x3.l = 4 ; equations obj1 'objective function 1' obj2 'objective function 2' obj3 'objective function 3' obj4 'objective function 4' cnst1 'constraint 1' cnst2 'constraint 2' cnst3 'constraint 3' cnst4 'constraint 4' cnst5 'constraint 5' cnst6 'constraint 6' cnst7 'constraint 7' cnst8 'constraint 8' cnst9 'constraint 9' ; obj1.. F =e= (-sqr(x1) - sqr(x2)) ; obj2.. F =e= -sqr(x1 - 1) - 2*sqr(x2) - sqr(x3) ; obj3.. F =e= x1 + (2*x2) ; obj4.. F =e= 3*x4 - 7*x5 ; cnst1.. -(x1*x2) =l= -1 ; cnst2.. (-3*x1) - x2 =l= -2 ; cnst3.. -x2 =l= -0.2 ; cnst4.. 2*sqrt(x1) - x3 =e= 0 ; cnst5.. -2*x1 - x2 =l= -2 ; cnst6.. -x1 + (2*x2) =l= 2 ; cnst7.. x1 + x2 =l= 1 ; cnst8.. -x4 + x5 =l= 0 ; cnst9.. x4 + x5 =l= 3.5 ; model prob1 /obj1, cnst1 / ; model prob2 /obj1, cnst2, cnst3 / ; model prob3 /obj2, cnst4, cnst5 / ; model prob4 /obj3, cnst6, cnst7 / ; model prob5 /obj4, cnst8, cnst9 / ; solve prob1 using nlp maximizing F ; file results /PS06_2.res/ ; put results ; put 'GAMS RESULTS'/// ; put 'Problem 1'/ ; put @5, 'F', @15, F.l / ; put @5, 'x1', @15, x1.l / ; put @5, 'x2', @15, x2.l /// ; solve prob2 using nlp maximizing F ; put 'Problem 2' / ; put @5, 'F', @15, F.l / ; put @5, 'x1', @15, x1.l / ; put @5, 'x2', @15, x2.l /// ; solve prob3 using nlp maximizing F ; put 'Problem 3' / ; put @5, 'F', @15, F.l / ; put @5, 'x1', @15, x1.l / ; put @5, 'x2', @15, x2.l / ; put @5, 'x3', @15, x3.l /// ; solve prob4 using lp maximizing F ; put 'Problem 4' / ; put @5, 'F', @15, F.l / ; put @5, 'x1', @15, x1.l / ; put @5, 'x2', @15, x2.l /// ; solve prob5 using mip maximizing F ; put 'Problem 5' / ; put @5, 'F', @15, F.l / ; put @5, 'x', @15, x4.l / ; put @5, 'y', @15, x5.l /// ; putclose results ;