*--------------------------------------------------------------* * Quadratically Constrained - Test Problem 4 * *--------------------------------------------------------------* File res / results / ; Put res ; Sets i /1*3/ alias(i,j) alias(i,jp); Parameters b(i) /1 3 2 0 3 -4/ y(i) /1 1.5 2 -0.5 3 -5/ z(i) /1 0 2 -1 3 -6/ A(i,j); Table A(i,j) 1 2 3 1 0 0 1 2 0 -1 0 3 -2 1 -1; Variables x(i) f; Loop(i, x.lo(i) = 0); x.up('1') = 2; x.up('3') = 3; Equations Obj objective function Con1 constraint function 1 Con2 constraint function 2 Con3 constraint function 3; Obj .. f =e= -2*x('1') + x('2') - x('3'); Con1 .. sum(i, x(i)*sum(jp, A(jp,i)*sum(j, A(jp,j)*x(j)))) - 2*sum(i, y(i)*sum(j, A(i,j)*x(j))) + power(sqrt(sum(i, power(y(i),2))),2) - 0.25*power(sqrt(sum(i, power(b(i)-z(i),2))),2) =g= 0; Con2 .. x('1') + x('2') + x('3') - 4 =l= 0; Con3 .. 3*x('2') + x('3') - 6 =l= 0; Model problem /Obj, Con1, Con2, Con3/; x.l('1') = 0.5; x.l('2') = 0; x.l('3') = 3; solve problem using nlp minimizing f; PUT "Min f",f.l:16:10//; Loop(i, PUT "x ",x.l(i):16:10//);