*------------------------------------------------------------ * December 30, 1997 * Wong 2 problem * * Hock & Schittkowski, * Test Examples for Nonlinear Programming Codes. * Springer-Verlag, 1981. * Problem 113, page 122. * * Dr. Neculai Andrei, * Research Institute for Informatics - Bucharest * 8-10, Averescu Avenue, * 71316 Bucharest - Romania * E-mail: nandrei@u3.ici.ro * web: http://www.ici.ro/camo/neculai/nandrei.htm *------------------------------------------------------------ * subroutine ini(n,m,mb,me,sb,x,icgc,ipgc,icge,ipge, 1 nszc,nsze,nb) * double precision x(n) integer sb(mb) integer icgc(nszc),ipgc(n+1) integer icge(nsze),ipge(n+1) * * Information about the problem. * write(1,10) 10 format(5x,'Example of nonlinear programming.') write(1,11) 11 format(5x,'Wong 2 Problem') write(1,14) 14 format(5x,'Hock & Schittkowski, Problem 113, Page 122.') * * Dimension of the problem: * n=10 ! No. of variables. m=8 ! No. of inequality constraints. me=0 ! No. of equality constraints. mb=2*n ! No. of simple bounds on variables. nszc=32 ! No. of non-zeros in Jacobian of c(x)>=0. nsze=0 ! No. of non-zeros in Jacobian of e(x) =0. * * Initial point: * x(1)=2.d0 x(2)=3.d0 x(3)=5.d0 x(4)=5.d0 x(5)=1.d0 x(6)=2.d0 x(7)=7.d0 x(8)=3.d0 x(9)=6.d0 x(10)=10.d0 * * Index vector for simple bounds: cb >= 0. * j=1 do i=1,n sb(j)=i sb(j+1)=-i j=j+2 end do * * Rows indices of the nonzeros of the Jacobian of the Equalities * * * Starting address of columns of the Jacobian of the Equalities * * * Rows indices of the nonzeros of the Jacobian of the INEqualities * icgc(1)=1 icgc(2)=2 icgc(3)=3 icgc(4)=4 icgc(5)=5 icgc(6)=6 icgc(7)=7 icgc(8)=8 c2 icgc(9)=1 icgc(10)=2 icgc(11)=3 icgc(12)=4 icgc(13)=5 icgc(14)=6 icgc(15)=7 icgc(16)=8 c3 icgc(17)=1 icgc(18)=2 c4 icgc(19)=1 icgc(20)=2 c5 icgc(21)=3 icgc(22)=4 c6 icgc(23)=3 icgc(24)=4 c7 icgc(25)=5 icgc(26)=6 c8 icgc(27)=5 icgc(28)=6 c9 icgc(29)=7 icgc(30)=8 c10 icgc(31)=7 icgc(32)=8 * * Starting address of columns of the Jacobian of the INEqualities * ipgc(1)=1 ipgc(2)=9 ipgc(3)=17 ipgc(4)=19 ipgc(5)=21 ipgc(6)=23 ipgc(7)=25 ipgc(8)=27 ipgc(9)=29 ipgc(10)=31 ipgc(11)=33 * return end *-------------------------------------------------------------- * December 30, 1997 * Wong 2 Problem. * Hock & Schittkowski, Problem 113, Page 122. *-------------------------------------------------------------- * subroutine prob(n,m,mb,me,sb,x,objf,gobj,c,gc,cb,e,ge, 1 nszc,nsze,nb) * * Calculate problem function at iterate x. * double precision x(n),objf,gobj(n),c(m),gc(nszc) double precision cb(mb),e(me),ge(nsze) * * * Objective function and its gradient: * objf= x(1)**2 + x(2)**2 + x(1)*x(2) - 1 14.d0*x(1) - 16.d0*x(2) + 1 (x(3)-10.d0)**2 + 4.d0*(x(4)-5.d0)**2 + 1 (x(5)-3.d0)**2 + 2.d0*(x(6)-1.d0)**2 + 1 5.d0*x(7)**2 + 1 7.d0*(x(8)-11.d0)**2 + 2.d0*(x(9)-10.d0)**2 + 1 (x(10)-7.d0)**2 + 45.d0 * gobj(1)= 2.d0*x(1) + x(2) - 14.d0 gobj(2)= 2.d0*x(2) + x(1) - 16.d0 gobj(3)= 2.d0*(x(3)-10.d0) gobj(4)= 8.d0*(x(4)-5.d0) gobj(5)= 2.d0*(x(5)-3.d0) gobj(6)= 4.d0*(x(6)-1.d0) gobj(7)= 10.d0*x(7) gobj(8)= 14.d0*(x(8)-11.d0) gobj(9)= 4.d0*(x(9)-10.d0) gobj(10)= 2.d0*(x(10)-7.d0) * * Bounds on variables: * j=1 do i=1,n cb(j)=x(i)+1.d38 cb(j+1)=1.d38-x(i) j=j+2 end do * * Constraints. (Inequalities): * c(1)= -3.d0*(x(1)-2.d0)**2 - 4.d0*(x(2)-3.d0)**2 - 1 2.d0*x(3)**2 + 7.d0*x(4) + 120.d0 c(2)= -5.d0*x(1)**2 - 8.d0*x(2) - 1 (x(3)-6.d0)**2 + 2.d0*x(4) + 40.d0 c(3)= -0.5d0*(x(1)-8.d0)**2 - 2.d0*(x(2)-4.d0)**2 - 1 3.d0*x(5)**2 + x(6) + 30.d0 c(4)= -x(1)**2 - 2.d0*(x(2)-2.d0)**2 + 1 2.d0*x(1)*x(2) - 14.d0*x(5) + 6.d0*x(6) c(5)= -4.d0*x(1) - 5.d0*x(2) + 3.d0*x(7) - 1 9.d0*x(8) + 105.d0 c(6)= -10.d0*x(1) + 8.d0*x(2) + 17.d0*x(7) - 2.d0*x(8) c(7)= 3.d0*x(1) - 6.d0*x(2) - 1 12.d0*(x(9)-8.d0)**2 + 7.d0*x(10) c(8)= 8.d0*x(1) - 2.d0*x(2) - 5.d0*x(9) + 1 2.d0*x(10) + 12.d0 * * Jacobian of the inequalities constraints: * gc(1)= -6.d0*(x(1)-2.d0) gc(2)= -10.d0*x(1) gc(3)= -(x(1)-8.d0) gc(4)= -2.d0*x(1) gc(5)= -4.d0 gc(6)= -10.d0 gc(7)= 3.d0 gc(8)= 8.d0 c2 gc(9)=-8.d0*(x(2)-3.d0) gc(10)=-8.d0 gc(11)=-4.d0*(x(2)-4.d0) gc(12)=-4.d0*(x(2)-2.d0) gc(13)=-5.d0 gc(14)=8.d0 gc(15)=-6.d0 gc(16)=-2.d0 c3 gc(17)=-4.d0*x(3) gc(18)=-2.d0*(x(3)-6.d0) c4 gc(19)=7.d0 gc(20)=2.d0 c5 gc(21)=-6.d0*x(5) gc(22)=-14.d0 c6 gc(23)=1.d0 gc(24)=6.d0 c7 gc(25)=3.d0 gc(26)=17.d0 c8 gc(27)=-9.d0 gc(28)=-2.d0 c9 gc(29)=-24.d0*(x(9)-8.d0) gc(30)=-5.d0 c10 gc(31)=7.d0 gc(32)=2.d0 * * Constraints. (Equalities): * * Jacobian of the equalities constraints: * return end *------------------------------------------------------ HS113.for