*----------------------------------------------------------- * Date created: May 27, 2001 * * Combustion of Propan. * 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 11 nonlinear * equations with 11 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 * order to avoid the numerical problems with sqrt(.) function. * In the example PROP (please see SPENPROB collection) the * problem is to minimize a constant function subject to * 11 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') * * Dimension of the problem: * n=11 m=0 me=0 mb=11 nszc=0 nsze=0 * * Initial point: * x(1)=5.d0 x(2)=2.5d0 x(3)=5.d0 x(4)=0.1d0 x(5)=0.00965d0 x(6)=0.00041d0 x(7)=0.2725d0 x(8)=0.000449d0 x(9)=0.01703d0 x(10)=0.04807d0 x(11)=20.d0 * * Index vector for simple bounds: cb >= 0. * do i=1,11 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: May 27, 2001 * Combustion of Propan. 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(11,11) double precision k(10), t(11) double precision pdx, sqpdx, sqrtp, xfrac, xtau double precision eight, forty, one, p, p5, rr, + ten, three, two, zero parameter (zero=0.0d0,p5=0.5d0,one=1.0d0, + two=2.0d0,three=3.0d0,eight=8.0d0,ten=1.0d1, + forty=4.0d1) parameter (p=forty,rr=ten) data k/zero, zero, zero, zero, 1.930d-1, 2.597d-3, 3.448d-3, + 1.799d-5, 2.155d-4, 3.846d-5/ * * * Objective function and its gradient: * * Objective * pdx = p/x(11) sqpdx = sqrt(pdx) sqrtp=sqrt(p) xtau = zero do 20 i = 1, n - 1 xtau = xtau + x(i) 20 continue t(1) = x(1) + x(4) - three t(2) = two*x(1) + x(2) + x(4) + x(7) + x(8) + x(9) + + two*x(10) - rr t(3) = two*x(2) + two*x(5) + x(6) + x(7) - eight t(4) = two*x(3) + x(9) - 4.0d0*rr t(5) = k(5)*x(2)*x(4) - x(1)*x(5) t(6) = k(6)*sqrt(x(2)*x(4)) - sqrt(x(1))*x(6)*sqpdx t(7) = k(7)*sqrt(x(1)*x(2)) - sqrt(x(4))*x(7)*sqpdx t(8) = k(8)*x(1) - x(4)*x(8)*pdx t(9) = k(9)*x(1)*sqrt(x(3)) - x(4)*x(9)*sqpdx t(10) = k(10)*x(1)**2 - (x(4)**2)*x(10)*pdx t(11) = x(11) - xtau * objf=0.d0 do i=1,11 objf=objf+t(i)*t(i) end do * * Gradient of the objective: * do 40 j = 1, n do 30 i = 1, n - 1 fjac(i,j) = zero 30 continue fjac(n,j) = -one 40 continue fjac(n,n) = one * xfrac = one/(sqrt(x(11))**3) * fjac(1,1) = one fjac(2,1) = two fjac(5,1) = -x(5) fjac(6,1) = -p5*x(6)*sqpdx/sqrt(x(1)) fjac(7,1) = p5*k(7)*sqrt(x(2))/sqrt(x(1)) fjac(8,1) = k(8) fjac(9,1) = k(9)*sqrt(x(3)) fjac(10,1) = two*k(10)*x(1) * fjac(2,2) = one fjac(3,2) = two fjac(5,2) = k(5)*x(4) fjac(6,2) = p5*k(6)*sqrt(x(4))/sqrt(x(2)) fjac(7,2) = p5*k(7)*sqrt(x(1))/sqrt(x(2)) * fjac(4,3) = two fjac(9,3) = p5*k(9)*x(1)/sqrt(x(3)) * fjac(1,4) = one fjac(2,4) = one fjac(5,4) = k(5)*x(2) fjac(6,4) = p5*k(6)*sqrt(x(2))/sqrt(x(4)) fjac(7,4) = -p5*x(7)*sqpdx/sqrt(x(4)) fjac(8,4) = -x(8)*pdx fjac(9,4) = -x(9)*sqpdx fjac(10,4) = -two*x(4)*x(10)*pdx * fjac(3,5) = two fjac(5,5) = -x(1) * fjac(3,6) = one fjac(6,6) = -sqrt(x(1))*sqpdx * fjac(2,7) = one fjac(3,7) = one fjac(7,7) = -sqrt(x(4))*sqpdx * fjac(2,8) = one fjac(8,8) = -x(4)*pdx * fjac(2,9) = one fjac(4,9) = one fjac(9,9) = -x(4)*sqpdx * fjac(2,10) = two fjac(10,10) = -(x(4)**2)*pdx * fjac(6,11) = p5*sqrt(x(1))*x(6)*sqrtp*xfrac fjac(7,11) = p5*sqrt(x(4))*x(7)*sqrtp*xfrac fjac(8,11) = x(4)*x(8)*p/(x(11)**2) fjac(9,11) = p5*x(4)*x(9)*sqrtp*xfrac fjac(10,11) = x(4)**2*x(10)*p/(x(11)**2) * 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 *------------------------------------------------PROPLS.for