*------------------------------------------------------------------- * Date created: February 16, 2001 * Bondarenko, Bortz, More., * COPS: Large scale Nonlinearly constrained optimization problems. * Technical Report, ANL/MCS-TN-237, Octoiber 1999 * * Largest small polygon (David Gay), pp.3-4 * * 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 from COPS, 1987') write(1,11) 11 format(5x,'Largest small polygon ') write(1,12) 12 format(5x,'pp.3-4') * * Dimension of the problem: * n=10 m=14 me=0 mb=20 nszc=48 nsze=0 * * Initial point: * do i=1,5 x(i)=.5d0 end do do i=6,10 x(i)=1.d0 end do * * 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 * C1 icgc(1)=1 icgc(2)=2 icgc(3)=3 icgc(4)=4 c2 icgc(5)=1 icgc(6)=5 icgc(7)=6 icgc(8)=7 c3 icgc(9)=2 icgc(10)=5 icgc(11)=8 icgc(12)=9 c4 icgc(13)=3 icgc(14)=6 icgc(15)=8 icgc(16)=10 c5 icgc(17)=4 icgc(18)=7 icgc(19)=9 icgc(20)=10 c6 icgc(21)=1 icgc(22)=2 icgc(23)=3 icgc(24)=4 icgc(25)=11 c7 icgc(26)=1 icgc(27)=5 icgc(28)=6 icgc(29)=7 icgc(30)=11 icgc(31)=12 c8 icgc(32)=2 icgc(33)=5 icgc(34)=8 icgc(35)=9 icgc(36)=12 icgc(37)=13 c9 icgc(38)=3 icgc(39)=6 icgc(40)=8 icgc(41)=10 icgc(42)=13 icgc(43)=14 c10 icgc(44)=4 icgc(45)=7 icgc(46)=9 icgc(47)=10 icgc(48)=14 * * Starting address of columns of the Jacobian of the Equalities * ipgc(1)=1 ipgc(2)=5 ipgc(3)=9 ipgc(4)=13 ipgc(5)=17 ipgc(6)=21 ipgc(7)=26 ipgc(8)=32 ipgc(9)=38 ipgc(10)=44 ipgc(11)=49 * return end * *-------------------------------------------------------------- * Date created: February 16, 2001 * Bondarenko, Bortz, More * COPS: Large scale Nonlinearly constrained optimization problems. * Technical Report, ANL/MCS-TN-237, Octoiber 1999 * Largest small polygon (David Gay), pp.3-4 *-------------------------------------------------------------- * 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) * * Objective function and its gradient: * objf=x(2)*x(1)*dsin(x(7)-x(6)) + x(3)*x(2)*dsin(x(8)-x(7)) + * x(4)*x(3)*dsin(x(9)-x(8)) + x(5)*x(4)*dsin(x(10)-x(9)) * objf = -objf/2.d0 * gobj(1)=-x(2)*dsin(x(7)-x(6))/2.d0 gobj(2)=-x(1)*dsin(x(7)-x(6))/2.d0 - x(3)*dsin(x(8)-x(7))/2.d0 gobj(3)=-x(2)*dsin(x(8)-x(7))/2.d0 - x(4)*dsin(x(9)-x(8))/2.d0 gobj(4)=-x(3)*dsin(x(9)-x(8))/2.d0 - x(5)*dsin(x(10)-x(9))/2.d0 gobj(5)=-x(4)*dsin(x(10)-x(9))/2.d0 gobj(6)= x(2)*x(1)*dcos(x(7)-x(6))/2.d0 gobj(7)=-x(2)*x(1)*dcos(x(7)-x(6))/2.d0 + * x(3)*x(2)*dcos(x(8)-x(7))/2.d0 gobj(8)=-x(3)*x(2)*dcos(x(8)-x(7))/2.d0 + * x(4)*x(3)*dcos(x(9)-x(8))/2.d0 gobj(9)=-x(4)*x(3)*dcos(x(9)-x(8))/2.d0 + * x(5)*x(4)*dcos(x(10)-x(9))/2.d0 gobj(10)=-x(5)*x(4)*dcos(x(10)-x(9))/2.d0 * * * Bounds on variables: * j=1 do i=1,5 cb(j)=x(i) cb(j+1)=1.d0-x(i) j=j+2 end do do i=6,10 cb(j)=x(i) cb(j+1)=3.14d0-x(i) j=j+2 end do * * Constraints. (Inequalities): * c(1)= 1.d0 - x(1)**2 - x(2)**2 + 2.d0*x(1)*x(2)*dcos(x(6)-x(7)) c(2)= 1.d0 - x(1)**2 - x(3)**2 + 2.d0*x(1)*x(3)*dcos(x(6)-x(8)) c(3)= 1.d0 - x(1)**2 - x(4)**2 + 2.d0*x(1)*x(4)*dcos(x(6)-x(9)) c(4)= 1.d0 - x(1)**2 - x(5)**2 + 2.d0*x(1)*x(5)*dcos(x(6)-x(10)) * c(5)= 1.d0 - x(2)**2 - x(3)**2 + 2.d0*x(2)*x(3)*dcos(x(7)-x(8)) c(6)= 1.d0 - x(2)**2 - x(4)**2 + 2.d0*x(2)*x(4)*dcos(x(7)-x(9)) c(7)= 1.d0 - x(2)**2 - x(5)**2 + 2.d0*x(2)*x(5)*dcos(x(7)-x(10)) * c(8)= 1.d0 - x(3)**2 - x(4)**2 + 2.d0*x(3)*x(4)*dcos(x(8)-x(9)) c(9)= 1.d0 - x(3)**2 - x(5)**2 + 2.d0*x(3)*x(5)*dcos(x(8)-x(10)) * c(10)= 1.d0 - x(4)**2 - x(5)**2 + 2.d0*x(4)*x(5)*dcos(x(9)-x(10)) * c(11)=x(7)- x(6) c(12)=x(8)- x(7) c(13)=x(9)- x(8) c(14)=x(10)-x(9) * * Jacobian of the inequalities constraints: * c1 gc(1)=-2.d0*x(1) + 2.d0*x(2)*dcos(x(6)-x(7)) gc(2)=-2.d0*x(1) + 2.d0*x(3)*dcos(x(6)-x(8)) gc(3)=-2.d0*x(1) + 2.d0*x(4)*dcos(x(6)-x(9)) gc(4)=-2.d0*x(1) + 2.d0*x(5)*dcos(x(6)-x(10)) c2 gc(5)=-2.d0*x(2) + 2.d0*x(1)*dcos(x(6)-x(7)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*x(3)*dsin(x(7)-x(8)) gc(34)=-2.d0*x(3)*x(4)*dsin(x(8)-x(9)) gc(35)=-2.d0*x(3)*x(5)*dsin(x(8)-x(10)) gc(36)=1.d0 gc(37)=-1.d0 c9 gc(38)= 2.d0*x(1)*x(4)*dsin(x(6)-x(9)) gc(39)= 2.d0*x(2)*x(4)*dsin(x(7)-x(9)) gc(40)= 2.d0*x(3)*x(4)*dsin(x(8)-x(9)) gc(41)=-2.d0*x(4)*x(5)*dsin(x(9)-x(10)) gc(42)=1.d0 gc(43)=-1.d0 c10 gc(44)= 2.d0*x(1)*x(5)*dsin(x(6)-x(10)) gc(45)= 2.d0*x(2)*x(5)*dsin(x(7)-x(10)) gc(46)= 2.d0*x(3)*x(5)*dsin(x(8)-x(10)) gc(47)= 2.d0*x(4)*x(5)*dsin(x(9)-x(10)) gc(48)=1.d0 * return end *-----------------------------------------------POLYGON.for