*--------------------------------------------------------- * Date created: December 23, 1997 * * Hock-Schittkowski, * Test Examples for Nonlinear Programming. * Springer-Verlag, 1981. * * Problem 108, pp,117 * * 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) * write(1,10) 10 format(5x,'Example of a Nonlinear Programming Problem.') write(1,11) 11 format(5x,'Hock-Schittkowski, Prob 108, pp.117') * n=9 m=13 me=0 mb=2*n nszc=39 nsze=0 * * Initial Point * do i=1,n x(i)=1.d0 end do * * Index vector for simple bounds: * 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 the columns of the Jacobian of the Equalities. * * * Rows indices of the nonzeros of the Jacobian of the INEqualities. * icgc(1)=3 icgc(2)=4 icgc(3)=11 icgc(4)=12 c2 icgc(5)=3 icgc(6)=4 icgc(7)=11 icgc(8)=12 c3 icgc(9)=1 icgc(10)=5 icgc(11)=6 icgc(12)=8 icgc(13)=12 c4 icgc(14)=1 icgc(15)=5 icgc(16)=6 icgc(17)=12 c5 icgc(18)=2 icgc(19)=3 icgc(20)=5 icgc(21)=9 icgc(22)=13 c6 icgc(23)=2 icgc(24)=3 icgc(25)=5 icgc(26)=9 c7 icgc(27)=4 icgc(28)=6 icgc(29)=7 icgc(30)=9 c8 icgc(31)=4 icgc(32)=6 icgc(33)=7 icgc(34)=9 c9 icgc(35)=7 icgc(36)=8 icgc(37)=10 icgc(38)=11 icgc(39)=13 * * Starting address of the columns of the Jacobian of the INEqualities. * ipgc(1)=1 ipgc(2)=5 ipgc(3)=9 ipgc(4)=14 ipgc(5)=18 ipgc(6)=23 ipgc(7)=27 ipgc(8)=31 ipgc(9)=35 ipgc(10)=40 * return end * *-------------------------------------------------------------- * Date created: December 23, 1997 * Hock-Schittkowski, Problem 108, pp.117. *-------------------------------------------------------------- * subroutine prob(n,m,mb,me,sb,x,objf,gobj,c,gc,cb,e,ge, 1 nszc,nsze,nb) * * Calculate problem functions at iterate x. * double precision x(n),objf,gobj(n),c(m),gc(nszc), * cb(mb),e(me),ge(nsze) * * Objective function, and its gradient. * objf= -(x(1)*x(4) - x(2)*x(3) + x(3)*x(9) - 1 x(5)*x(9) + x(5)*x(8) - x(6)*x(7))/2.d0 * gobj(1)=-x(4)/2.d0 gobj(2)= x(3)/2.d0 gobj(3)= x(2)/2.d0 - x(9)/2.d0 gobj(4)=-x(1)/2.d0 gobj(5)= x(9)/2.d0 - x(8)/2.d0 gobj(6)= x(7)/2.d0 gobj(7)= x(6)/2.d0 gobj(8)=-x(5)/2.d0 gobj(9)=-x(3)/2.d0 + x(5)/2.d0 * * Bounds on variables. * j=1 do i=1,n cb(j)=x(i) cb(j+1)=1.d38-x(i) j=j+2 end do * * * Equality Constraints. * * * Jacobian of the equality constraints. * * * INEquality Constraints. * * c(1)=1.d0 - x(3)**2 - x(4)**2 c(2)=1.d0 - x(5)**2 - x(6)**2 c(3)=1.d0 - (x(1)-x(5))**2 - (x(2)-x(6))**2 c(4)=1.d0 - (x(1)-x(7))**2 - (x(2)-x(8))**2 c(5)=1.d0 - (x(3)-x(5))**2 - (x(4)-x(6))**2 c(6)=1.d0 - (x(3)-x(7))**2 - (x(4)-x(8))**2 c(7)=1.d0 - x(7)**2 - (x(8)-x(9))**2 c(8)=x(3)*x(9) c(9)=x(5)*x(8) - x(6)*x(7) c(10)=1.d0 - x(9)**2 c(11)=1.d0 - x(1)**2 - (x(2)-x(9))**2 c(12)=x(1)*x(4) - x(2)*x(3) c(13)=-x(5)*x(9) * * Jacobian of the INEquality constraints. c1 gc(1)=-2.d0*(x(1)-x(5)) gc(2)=-2.d0*(x(1)-x(7)) gc(3)=-2.d0*x(1) gc(4)=x(4) c2 gc(5)=-2.d0*(x(2)-x(6)) gc(6)=-2.d0*(x(2)-x(8)) gc(7)=-2.d0*(x(2)-x(9)) gc(8)=-x(3) c3 gc(9)=-2.d0*x(3) gc(10)=-2.d0*(x(3)-x(5)) gc(11)=-2.d0*(x(3)-x(7)) gc(12)=x(9) gc(13)=-x(2) c4 gc(14)=-2.d0*x(4) gc(15)=-2.d0*(x(4)-x(6)) gc(16)=-2.d0*(x(4)-x(8)) gc(17)=x(1) c5 gc(18)=-2.d0*x(5) gc(19)=2.d0*(x(1)-x(5)) gc(20)=2.d0*(x(3)-x(5)) gc(21)=x(8) gc(22)=-x(9) c6 gc(23)=-2.d0*x(6) gc(24)=2.d0*(x(2)-x(6)) gc(25)=2.d0*(x(4)-x(6)) gc(26)=-x(7) c7 gc(27)=2.d0*(x(1)-x(7)) gc(28)=2.d0*(x(3)-x(7)) gc(29)=-2.d0*x(7) gc(30)=-x(6) c8 gc(31)=2.d0*(x(2)-x(8)) gc(32)=2.d0*(x(4)-x(8)) gc(33)=-2.d0*(x(8)-x(9)) gc(34)=x(5) c9 gc(35)=2.d0*(x(8)-x(9)) gc(36)=x(3) gc(37)=-2.d0*x(9) gc(38)=2.d0*(x(2)-x(9)) gc(39)=-x(5) * return end *---------------------------------------------- HS108.for