* Date created: April 11, 1997 * * Neculai Andrei, * Advanced Mathematical Programming. Theory, * Computational Methods, Applications. * Technical Press, Bucharest, 1999. * * Problem N8, pp.800. * * 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,'Problem N8. Andrei, AMP, 1999') * * Dimension of the problem: * n=10 ! No. of variables. m=0 ! No. of inequality constraints. me=5 ! No. of equality constraints. mb=2*n ! No. of simple bounds on variables. nszc=0 ! No. of non-zeros in Jacobian of c(x)>=0. nsze=30 ! No. of non-zeros in Jacobian of e(x) =0. * * Initial point: * x(1)=-2.d0 x(2)=-1.d0/2.d0 x(3)=3.d0 x(4)=1.d0/3.d0 x(5)=-4.d0 x(6)=-1.d0/4.d0 x(7)=5.d0 x(8)=1.d0/5.d0 x(9)=-6.d0 x(10)=-1.d0/6.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 Inequalities * * Starting address of columns of the Jacobian of the Inequalities * * Rows indices of the nonzeros of the Jacobian of the Equalities * icge(1)=1 icge(2)=2 icge(3)=3 icge(4)=4 icge(5)=5 icge(6)=1 icge(7)=2 icge(8)=3 icge(9)=4 icge(10)=5 icge(11)=2 icge(12)=3 icge(13)=4 icge(14)=5 icge(15)=2 icge(16)=3 icge(17)=4 icge(18)=5 icge(19)=3 icge(20)=4 icge(21)=5 icge(22)=3 icge(23)=4 icge(24)=5 icge(25)=4 icge(26)=5 icge(27)=4 icge(28)=5 icge(29)=5 icge(30)=5 * * Starting address of columns of the Jacobian of the Equalities * ipge(1)=1 ipge(2)=6 ipge(3)=11 ipge(4)=15 ipge(5)=19 ipge(6)=22 ipge(7)=25 ipge(8)=27 ipge(9)=29 ipge(10)=30 ipge(11)=31 * return end * *-------------------------------------------------------------- * Date created: April 11, 1997 * N8 Test Problem (Advanced Mathematical Programming, pp.800) *-------------------------------------------------------------- * 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 t(5) * * Objective function and its gradient: * objf= (x(1)-x(2))**2 + (x(2)-x(3))**2 + 1 (x(3)-x(4))**2 + (x(4)-x(5))**2 + 1 (x(5)-x(6))**2 + (x(6)-x(7))**2 + 1 (x(7)-x(8))**2 + (x(8)-x(9))**2 + 1 (x(9)-x(10))**2 * gobj(1)= 2.d0*(x(1)-x(2)) gobj(2)= -2.d0*(x(1)-x(2)) + 2.d0*(x(2)-x(3)) gobj(3)= -2.d0*(x(2)-x(3)) + 2.d0*(x(3)-x(4)) gobj(4)= -2.d0*(x(3)-x(4)) + 2.d0*(x(4)-x(5)) gobj(5)= -2.d0*(x(4)-x(5)) + 2.d0*(x(5)-x(6)) gobj(6)= -2.d0*(x(5)-x(6)) + 2.d0*(x(6)-x(7)) gobj(7)= -2.d0*(x(6)-x(7)) + 2.d0*(x(7)-x(8)) gobj(8)= -2.d0*(x(7)-x(8)) + 2.d0*(x(8)-x(9)) gobj(9)= -2.d0*(x(8)-x(9)) + 2.d0*(x(9)-x(10)) gobj(10)=-2.d0*(x(9)-x(10)) * * Bounds on variables: * j=1 do i=1,n cb(j)=x(i)+1000.d0 cb(j+1)=1000.d0-x(i) j=j+2 end do * * Constraints. (Inequalities): * * * Jacobian of the inequalities constraints: * * Constraints. (Equalities): * t(1)= x(1)*x(2) t(2)=t(1)*x(3)*x(4) t(3)=t(2)*x(5)*x(6) t(4)=t(3)*x(7)*x(8) t(5)=t(4)*x(9)*x(10) e(1) = t(1) - 1.d0 e(2) = t(2) - 1.d0 e(3) = t(3) - 1.d0 e(4) = t(4) - 1.d0 e(5) = t(5) - 1.d0 * * Jacobian of the equalities constraints: * c1 ge(1)=x(2) ge(2)=ge(1)*x(3)*x(4) ge(3)=ge(2)*x(5)*x(6) ge(4)=ge(3)*x(7)*x(8) ge(5)=ge(4)*x(9)*x(10) c2 ge(6)=x(1) ge(7)=ge(6)*x(3)*x(4) ge(8)=ge(7)*x(5)*x(6) ge(9)=ge(8)*x(7)*x(8) ge(10)=ge(9)*x(9)*x(10) c3 ge(11)=x(1)*x(2)*x(4) ge(12)=ge(11)*x(5)*x(6) ge(13)=ge(12)*x(7)*x(8) ge(14)=ge(13)*x(9)*x(10) c4 ge(15)=x(1)*x(2)*x(3) ge(16)=ge(15)*x(5)*x(6) ge(17)=ge(16)*x(7)*x(8) ge(18)=ge(17)*x(9)*x(10) c5 ge(19)=x(1)*x(2)*x(3)*x(4)*x(6) ge(20)=ge(19)*x(7)*x(8) ge(21)=ge(20)*x(9)*x(10) c6 ge(22)=x(1)*x(2)*x(3)*x(4)*x(5) ge(23)=ge(22)*x(7)*x(8) ge(24)=ge(23)*x(9)*x(10) c7 ge(25)=x(1)*x(2)*x(3)*x(4)*x(5)*x(6)*x(8) ge(26)=ge(25)*x(9)*x(10) c8 ge(27)=x(1)*x(2)*x(3)*x(4)*x(5)*x(6)*x(7) ge(28)=ge(27)*x(9)*x(10) c9 ge(29)=x(1)*x(2)*x(3)*x(4)*x(5)*x(6)*x(7)*x(8)*x(10) c10 ge(30)=x(1)*x(2)*x(3)*x(4)*x(5)*x(6)*x(7)*x(8)*x(9) * return end * *---------------------------------------------------AMPN8.for