*----------------------------------------------------------- * Date created: June 2, 2001 * * Combustion of Propan. * Reduced version. * A least squares approach. * * Averick, Carter, More, * The MINPACK2 Test Problem Collection (Preliminary Version) * Argonne National Laboratory * Technical Memorandum No. 150, May 1991. * * * The problem is to solve an algebraic system of 5 nonlinear * equations with 5 unknowns. * In this program a least squares approach is considered, i.e. * to minimize the summ of squares of all equations. * Additionally the nonnegativity of variables is introduced. * In the example PROPR (please see SPENPROB collection) the * problem is to minimize a constant function subject to * 5 nonlinear equality constraints. * SPENBAR package gives the same solution. * * Dr. Neculai Andrei * Research Institute for Informatics, * 8-10, Averescu Avenue, Bucharest 1, Romania * E-mail: nandrei@u3.ici.ro * web: http://www.ici.ro/camo *----------------------------------------------------------- * 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,'Combustion of Propane. A least squares approach ') write(1,11) 11 format(5x,'Simple bounded optimization') write(1,12) 12 format(5x,'Reduced version') * * Dimension of the problem: * n=5 m=0 me=0 mb=5 nszc=0 nsze=0 * * Initial point: * x(1)=10.d0 x(2)=10.d0 x(3)=0.05d0 x(4)=50.d0 x(5)=0.05d0 * * 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 * * * Starting address of columns of the Jacobian of the Equalities * * return end * *-------------------------------------------------------------- * Date created: June 2, 2001 * Combustion of Propan. Reduced version. * A least squares approach. *-------------------------------------------------------------- * 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) * double precision fjac(5,5) double precision t(5) double precision r double precision r5,r6,r7,r8,r9,r10 * * * Objective function and its gradient: * r5=0.193d0 r6=0.410621754d-3 r7=0.5451766686d-3 r8=0.44975d-6 r9=0.3407354178d-4 r10=0.9615d-6 r=10.d0 * * Objective * t(1) = x(1)*x(2)+x(1)-3.d0*x(5) * t(2) = 2.d0*x(1)*x(2)+x(1)+2.d0*r10*x(2)*x(2)+ * x(2)*x(3)*x(3)+r7*x(2)*x(3)+r9*x(2)*x(4)+ * r8*x(2)-r*x(5) t(3) = 2.d0*x(2)*x(3)*x(3)+r7*x(2)*x(3)+ * 2.d0*r5*x(3)*x(3)+r6*x(3)-8.d0*x(5) t(4) = r9*x(2)*x(4)+2.d0*x(4)*x(4)-4.d0*r*x(5) t(5) = x(1)*x(2)+x(1)+r10*x(2)*x(2)+x(2)*x(3)*x(3)+ * r7*x(2)*x(3)+r9*x(2)*x(4)+r8*x(2)+r5*x(3)*x(3)+ * r6*x(3)+x(4)**2-1.d0 * objf=0.d0 do i=1,n objf=objf+t(i)*t(i) end do * * Gradient of the objective: * do 40 j = 1, n do 30 i = 1, n fjac(i,j) = 0.d0 30 continue 40 continue * fjac(1,1) = x(2)+1.d0 fjac(1,2) = x(1) fjac(1,5) =-3.d0 * fjac(2,1) = 2.d0*x(2)+1.d0 fjac(2,2) = 2.d0*x(1)+4.d0*r10*x(2)+x(3)**2+ * r7*x(3)+r9*x(4)+r8 fjac(2,3) = 2.d0*x(2)*x(3)+r7*x(2) fjac(2,4) = r9*x(2) fjac(2,5) = -r * fjac(3,2) = 2.d0*x(3)*x(3)+r7*x(3) fjac(3,3) = 4.d0*x(2)*x(3)+r7*x(2)+4.d0*r5*x(3)+r6 fjac(3,5) = -8.d0 * fjac(4,2) = r9*x(4) fjac(4,4) = r9*x(2)+4.d0*x(4) fjac(4,5) = -4.d0*r * fjac(5,1) = x(2)+1.d0 fjac(5,2) = x(1)+2.d0*r10*x(2)+x(3)**2+r7*x(3)+ * r9*x(4)+r8 fjac(5,3) = 2.d0*x(2)*x(3)+r7*x(2)+2.d0*r5*x(3)+r6 fjac(5,4) = r9*x(2)+2.d0*x(4) * do i=1,n gobj(i)=0.d0 do j=1,n gobj(i)=gobj(i)+fjac(j,i)*2.d0*t(j) end do end do * * Bounds on variables: * do i=1,11 cb(i)=x(i) end do * * Constraints. (Inequalities): * * * Jacobian of the inequalities constraints: * * * Constraints. (Equalities): * * * Jacobian of the equality constraints: * * return end *------------------------------------------------PROPRLS.for