*----------------------------------------------------------- * Date created: July 4, 1996. * * Design of an electrical circuit. * * M.Lowe, Nonlinear Programming: Augmented Lagrangian * Techniques for Constrained Minimization. * Ph. D. Thesis, Montana Univ. * * 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,'Design of an electrical circuit.') write(1,12) 12 format(5x,'M.Lowe, Nonlinear Programming: Augmented') write(1,13) 13 format(5x,'Lagrangian Techniques for Constrained') write(1,14) 14 format(5x,'Minimization. Ph. D. Thesis, Montana Univ.') * * Dimension of the problem: * n=4 ! No. of variables. m=0 ! No. of inequality constraints. me=1 ! No. of equality constraints. mb=4 ! No. of simple bounds on variables. nszc=0 ! No. of non-zeros in Jacobian of c(x)>=0. nsze=4 ! No. of non-zeros in Jacobian of e(x) =0. * * Initial point: * x(1)=3.d0 x(2)=0.5d0 x(3)=20.d0 x(4)=3.d0 * * Index vector for simple bounds: cb >= 0. * do i=1,n sb(i)=i 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)=1 icge(3)=1 icge(4)=1 * * Starting address of columns of the Jacobian of the Equalities * ipge(1)=1 ipge(2)=2 ipge(3)=3 ipge(4)=4 ipge(5)=5 * return end * *-------------------------------------------------------------- * Date created: July 4, 1996 * Design of an electrical circuit. *-------------------------------------------------------------- * 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 r1,r2,r3,r4 * r1=11.d0-x(1)*x(4)-x(2)*x(4)+x(4)/x(3) r2=x(1)+10.d0*x(2)+x(4)-x(1)*x(2)*x(4)+ 1 (x(2)*x(4)-1.d0)/x(3) r3=11.d0-4.d0*x(1)*x(4)-4.d0*x(2)*x(4)+x(4)/x(3) r4=2.d0*x(1)+20.d0*x(2)+2.d0*x(4)-8.d0*x(1)*x(2)*x(4)+ 1 (4.d0*x(2)*x(4)-1.d0)/(2.d0*x(3)) * * Objective function and its gradient: * objf=r1*r1 + r2*r2 * gobj(1)=2.d0*r1*(-x(4)) + 2.d0*r2*(1.d0-x(2)*x(4)) gobj(2)=2.d0*r1*(-x(4)) + 2.d0*r2*(10.d0-x(1)*x(4)+ 1 x(4)/x(3)) gobj(3)=2.d0*r1*(-x(4)/x(3)/x(3)) + 1 2.d0*r2*(-(x(2)*x(4)-1.d0)/x(3)/x(3)) gobj(4)=2.d0*r1*(-x(1)-x(2)+1.d0/x(3)) + 1 2.d0*r2*(1.d0-x(1)*x(2)+x(2)/x(3)) * * Bounds on variables: * cb(1)=x(1)-0.1d0 cb(2)=x(2)-0.1d0 cb(3)=x(3) cb(4)=x(4) * * Constraints. (Inequalities): * * Jacobian of the inequalities constraints: * * Constraints. (Equalities): * e(1)=r1*r1 + r2*r2 - r3*r3 - r4*r4 * * Jacobian of the equalities constraints: * ge(1)= 2.d0*r1*(-x(4)) + 1 2.d0*r2*(1.d0-x(2)*x(4)) - 1 2.d0*r3*(-4.d0*x(4)) - 1 2.d0*r4*(2.d0-8.d0*x(2)*x(4)) ge(2)= 2.d0*r1*(-x(4)) + 1 2.d0*r2*(10.d0-x(1)*x(4)+x(4)/x(3)) - 1 2.d0*r3*(-4.d0*x(4)) - 1 2.d0*r4*(20.d0-8.d0*x(1)*x(4)+2.d0*x(4)/x(3)) ge(3)= 2.d0*r1*(-x(4)/x(3)/x(3)) + 1 2.d0*r2*(-(x(2)*x(4)-1.d0)/x(3)/x(3)) - 1 2.d0*r3*(-x(4)/x(3)/x(3)) - 1 2.d0*r4*(-(4.d0*x(2)*x(4)-1.d0)/2.d0/x(3)/x(3)) ge(4)= 2.d0*r1*(-x(1)-x(2)+1.d0/x(3)) + 1 2.d0*r2*(1.d0-x(1)*x(2)+x(2)/x(3)) - 1 2.d0*r3*(-4.d0*x(1)-4.d0*x(2)+1.d0/x(3)) - 1 2.d0*r4*(2.d0-8.d0*x(1)*x(2)+2.d0*x(2)/x(3)) * return end *------------------------------------------------------LOWE.for