*--------------------------------------------------------------* * Quadratic Programming - Test Problem 10 * *--------------------------------------------------------------* File res / results / ; Put res ; Sets i /1*10/ j /1*10/ k /1*10/; Parameters lambda(j) /1 63 2 15 3 44 4 91 5 45 6 50 7 89 8 58 9 86 10 82/ mu(k) /1 42 2 98 3 48 4 91 5 11 6 63 7 61 8 61 9 38 10 26/ alpha(j) /1 -19 2 -27 3 -23 4 -53 5 -42 6 26 7 -33 8 -23 9 41 10 19/ beta(k) /1 -52 2 -3 3 81 4 30 5 -85 6 68 7 27 8 -81 9 97 10 -73/ b(i) /1 380 2 415 3 385 4 405 5 470 6 415 7 400 8 460 9 400 10 200/ A1(i,j) A2(i,k); Table A1(i,j) 1 2 3 4 5 6 7 8 9 10 1 3 5 5 6 4 4 5 6 4 4 2 5 4 5 4 1 4 4 2 5 2 3 1 5 2 4 7 3 1 5 7 6 4 3 2 6 3 2 1 6 1 7 3 5 6 6 6 4 5 2 2 4 3 2 6 5 5 2 1 3 5 5 7 4 3 7 3 6 6 3 1 6 1 6 7 1 8 1 2 1 7 8 7 6 5 8 7 9 8 5 2 5 3 8 1 3 3 5 10 1 1 1 1 1 1 1 1 1 1; Table A2(i,k) 1 2 3 4 5 6 7 8 9 10 1 8 4 2 1 1 1 2 1 7 3 2 3 6 1 7 7 5 8 7 2 1 3 1 7 2 4 7 5 3 4 1 2 4 7 7 8 2 3 4 5 8 1 2 5 7 5 3 6 7 5 8 4 6 3 6 4 1 7 3 8 3 1 6 2 8 7 4 3 1 4 3 6 4 6 5 4 8 2 3 5 5 4 5 4 2 2 8 9 4 5 5 6 1 7 1 2 2 4 10 1 1 1 1 1 1 1 1 1 1; Variables x(j) y(k) f; Loop(j, x.lo(j) = 0); Loop(k, y.lo(k) = 0); Equations Obj objective function Con(i) constraint functions; Obj .. f =e= -0.5*sum(j, lambda(j)*power(x(j)-alpha(j),2)) + 0.5*sum(k, mu(k)*power(y(k)-beta(k),2)); Con(i) .. sum(j, A1(i,j)*x(j)) + sum(k, A2(i,k)*y(k)) =l= b(i); Model problem /Obj, Con/; x.l('1') = 0; x.l('2') = 0; x.l('3') = 0; x.l('4') = 0; x.l('5') = 0; x.l('6') = 4.348; x.l('7') = 0; x.l('8') = 0; x.l('9') = 0; x.l('10') = 0; y.l('1') = 0; y.l('2') = 0; y.l('3') = 0; y.l('4') = 62.609; y.l('5') = 0; y.l('6') = 0; y.l('7') = 0; y.l('8') = 0; y.l('9') = 0; y.l('10') = 0; solve problem using nlp minimizing f; PUT "Min f",f.l:16:10//; Loop(j, PUT "x ",x.l(j):16:10//); Loop(k, PUT "y ",y.l(k):16:10//);