*--------------------------------------------------------- * Date created: December 23, 1997 * * Hock, W., Schittkowski, K., * Test examples for nonlinear programming codes. * Springer-Verlag, 1981. * Problem 112, pp,121 * * Chemical equilibrium * * 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,'Schittkowski, prob 112, pp.121') write(1,12) 12 format(5x,'Chemical Equilibrium') * n=10 m=0 me=3 mb=2*n nszc=0 nsze=14 * * Initial Point * do i=1,n x(i)=0.1d0 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. * icge(1)=1 icge(2)=1 icge(3)=1 icge(4)=3 icge(5)=2 icge(6)=2 icge(7)=1 icge(8)=2 icge(9)=2 icge(10)=3 icge(11)=3 icge(12)=3 icge(13)=1 icge(14)=3 * * Starting address of the columns of the Jacobian of the Equalities. * ipge(1)=1 ipge(2)=2 ipge(3)=3 ipge(4)=5 ipge(5)=6 ipge(6)=7 ipge(7)=9 ipge(8)=11 ipge(9)=12 ipge(10)=13 ipge(11)=15 * * Rows indices of the nonzeros of the Jacobian of the INEqualities. * * * Starting address of the columns of the Jacobian of the INEqualities. * * return end * *-------------------------------------------------------------- * Date created: December 23, 1997 * Hock & Schittkowski, prob. 112, pp.121. (Chemical Equilibrium) *-------------------------------------------------------------- * 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) real*8 c1(10), t * * Objective function, and its gradient. * c1(1)=-6.089d0 c1(2)=-17.164d0 c1(3)=-34.054d0 c1(4)=-5.914d0 c1(5)=-24.721d0 c1(6)=-14.986d0 c1(7)=-24.100d0 c1(8)=-10.708d0 c1(9)=-26.662d0 c1(10)=-22.179d0 * objf=0.d0 t=0.d0 do i=1,n t=t+x(i) end do do j=1,n objf = objf + x(j)*( c1(j) + dlog(x(j)/t) ) end do * do i=1,n gobj(i) = c1(i) + dlog(x(i)/t) end do * * Bounds on variables. * j=1 do i=1,n cb(j)=x(i)-0.000001d0 cb(j+1)=1.d38-x(i) j=j+2 end do * * * Equality Constraints. * e(1)=x(1)+2.d0*x(2)+2.d0*x(3)+x(6)+x(10)-2.d0 e(2)=x(4)+2.d0*x(5)+x(6)+x(7)-1.d0 e(3)=x(3)+x(7)+x(8)+2.d0*x(9)+x(10)-1.d0 * * Jacobian of the equality constraints. * ge(1)=1.d0 ge(2)=2.d0 ge(3)=2.d0 ge(4)=1.d0 ge(5)=1.d0 ge(6)=2.d0 ge(7)=1.d0 ge(8)=1.d0 ge(9)=1.d0 ge(10)=1.d0 ge(11)=1.d0 ge(12)=2.d0 ge(13)=1.d0 ge(14)=1.d0 * * INEquality Constraints. * * Jacobian of the INEquality constraints. * return end *---------------------------------------------------HS112.for