*----------------------------------------------------------- * Date created: June 18, 1996 * Hock & Schittkowski, * Test Examples for Nonlinear Programming. * Springer-Verlag, 1981. * Problem No. 114. Page 123. * * Alkylation Problem. * * 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,'Alkylation Problem, Hock & Schittkowski,') write(1,12) 12 format(5x,'Problem 114, Page 123.') * * Dimension of the problem: * n=10 ! No. of variables. m=8 ! No. of inequality constraints. me=3 ! No. of equality constraints. mb=20 ! No. of simple bounds on variables. nszc=20 ! No. of non-zeros in Jacobian of c(x)>=0. nsze=11 ! No. of non-zeros in Jacobian of e(x) =0. * * Initial point: * x(1)=1745.d0 x(2)=12000.d0 x(3)=110.d0 x(4)=3048.d0 x(5)=1974.d0 x(6)=89.2d0 x(7)=92.8d0 x(8)=8.d0 x(9)=3.6d0 x(10)=145.1d0 * * 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 Inequalities * icgc(1)=5 icgc(2)=7 icgc(3)=5 icgc(4)=7 icgc(5)=6 icgc(6)=8 icgc(7)=2 icgc(8)=4 icgc(9)=6 icgc(10)=8 icgc(11)=5 icgc(12)=6 icgc(13)=7 icgc(14)=8 icgc(15)=1 icgc(16)=3 icgc(17)=1 icgc(18)=2 icgc(19)=3 icgc(20)=4 * * Starting address of columns of the Jacobian of the Inequalities * ipgc(1)=1 ipgc(2)=0 ! zero column ipgc(3)=0 ! zero column ipgc(4)=3 ipgc(5)=0 ! zero column ipgc(6)=5 ipgc(7)=7 ipgc(8)=11 ipgc(9)=15 ipgc(10)=17 ipgc(11)=21 * * Rows indices of the nonzeros of the Jacobian of the Equalities * icge(1)=1 icge(2)=3 icge(3)=3 icge(4)=2 icge(5)=1 icge(6)=2 icge(7)=1 icge(8)=3 icge(9)=2 icge(10)=3 icge(11)=2 * * Starting address of columns of the Jacobian of the Equalities * ipge(1)=1 ipge(2)=3 ipge(3)=4 ipge(4)=5 ipge(5)=7 ipge(6)=9 ipge(7)=0 ! zero column ipge(8)=10 ipge(9)=11 ipge(10)=0 ! zero column ipge(11)=12 * return end * *-------------------------------------------------------------- * Date created: June 18, 1996 * Hock Schittkowski, No. 114 * Alkylation Problem. *-------------------------------------------------------------- * 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) *---- real*8 a,b *---- * Objective function and its gradient: * objf=5.04d0*x(1)+0.035d0*x(2)+10.d0*x(3)+3.36*x(5)- 1 0.063d0*x(4)*x(7) * gobj(1)=5.04d0 gobj(2)=0.035d0 gobj(3)=10.d0 gobj(4)=-0.063d0*x(7) gobj(5)=3.36d0 gobj(6)=0.d0 gobj(7)=-0.063d0*x(4) gobj(8)=0.d0 gobj(9)=0.d0 gobj(10)=0.d0 * * Bounds on variables: * cb(1)=x(1)-0.00001d0 cb(2)=2000.d0-x(1) cb(3)=x(2)-0.00001d0 cb(4)=16000.d0-x(2) cb(5)=x(3)-0.00001d0 cb(6)=120.d0-x(3) cb(7)=x(4)-0.00001d0 cb(8)=5000.d0-x(4) cb(9)=x(5)-0.00001d0 cb(10)=2000.d0-x(5) cb(11)=x(6)-85.d0 cb(12)=93.d0-x(6) cb(13)=x(7)-90.d0 cb(14)=95.d0-x(7) cb(15)=x(8)-3.d0 cb(16)=12.d0-x(8) cb(17)=x(9)-1.2d0 cb(18)=4.d0-x(9) cb(19)=x(10)-145.d0 cb(20)=162.d0-x(10) * * Constraints. (Inequalities): * a=0.99d0 b=0.9d0 * c(1)=35.82d0 - 0.222d0*x(10) - 0.9d0*x(9) c(2)=-133.d0 + 3.d0*x(7) - 0.99d0*x(10) c(3)=-c(1) + (1.d0/b-b)*x(9) c(4)=-c(2) + (1.d0/a-a)*x(10) c(5)=1.12*x(1) + 0.13167d0*x(1)*x(8) - 1 0.00667d0*x(1)*x(8)*x(8) - a*x(4) c(6)=57.425 + 1.098d0*x(8) - 0.038*x(8)*x(8) + 1 0.325d0*x(6) - a*x(7) c(7)=-c(5) + (1.d0/a-a)*x(4) c(8)=-c(6) + (1.d0/a-a)*x(7) * * Jacobian of the inequalities constraints: * gc(1)=1.12d0 + 0.13167*x(8) - 0.00667*x(8)*x(8) gc(2)=-gc(1) gc(3)=-a gc(4)=1.d0/a gc(5)=0.325d0 gc(6)=-0.325d0 gc(7)=3.d0 gc(8)=-3.d0 gc(9)=-a gc(10)=1.d0/a gc(11)=0.13167d0*x(1)-2.d0*0.00667*x(1)*x(8) gc(12)=1.098d0-2.d0*0.038*x(8) gc(13)=-gc(11) gc(14)=-gc(12) gc(15)=-b gc(16)=1.d0/b gc(17)=-0.222d0 gc(18)=-a gc(19)=0.222d0 gc(20)=1.d0/a * * Constraints. (Equalities): * e(1)=1.22d0*x(4) - x(1) - x(5) e(2)=98000.d0*x(3)/(x(4)*x(9)+1000.d0*x(3)) - x(6) e(3)=(x(2)+x(5))/x(1) - x(8) * * Jacobian of the equalities constraints: * ge(1)=-1.d0 ge(2)=-(x(2)+x(5))/(x(1)*x(1)) ge(3)=1.d0/x(1) ge(4)=98000.d0*x(4)*x(9)/((x(4)*x(9)+1000.d0*x(3))**2) ge(5)=1.22d0 ge(6)=-98000.d0*x(3)*x(9)/((x(4)*x(9)+1000.d0*x(3))**2) ge(7)=-1.d0 ge(8)=1.d0/x(1) ge(9)=-1.d0 ge(10)=-1.d0 ge(11)=-98000.d0*x(3)*x(4)/((x(4)*x(9)+1000.d0*x(3))**2) * return end *--------------------------------------------------ALKIL.for