*----------------------------------------------------------- * Date created: February 15, 2001 * * Distribution of electrons on a sphere * (R.J.,Vanderbei) * * Bondarenko, A.S., Bortz, D.M., More, J.J., * COPS: Large-Scale Nonlinearly Constrained Optimization * Problems. * Technical Report ANL/MCS-TM-237, * September 1998 (October 1999 - revision), pp. 5-6 * * 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,'Distribution of electrons on a sphere') write(1,11) 11 format(5x,'by R.J. Vanderbei') write(1,12) 12 format(5x,'COPS, pp.5-6') * * Dimension of the problem: * np=5 n=3*np m=0 me=np mb=0 nszc=0 nsze=3*np * * Initial point: * do i=1,n x(i)=float(i) end do * * Index vector for simple bounds: cb >= 0. * * * Rows indices of the nonzeros of the Jacobian of the Equalities * k=1 do i=1,3 do j=1,np icge(k)=j k=k+1 end do end do * * Starting address of columns of the Jacobian of the Equalities * do i=1,n ipge(i)=i end do ipge(n+1)=n+1 * return end * *-------------------------------------------------------------- * Distribution of electrons on a sphere * by R.J.,Vanderbei. * Bondarenko, A.S., Bortz, D.M., More, J.J., * COPS: Large-Scale Nonlinearly Constrained Optimization * Problems. * Technical Report ANL/MCS-TM-237, * September 1998 (October 1999 - revision), pp. 5-6 *-------------------------------------------------------------- * 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 u, v * * Objective function and its gradient: * np=5 * objf=0.d0 do i=1,n gobj(i)=0.d0 end do * do i=1,np-1 do j=i+1,np u=(x(i)-x(j))**2 + (x(np+i)-x(np+j))**2 + (x(2*np+i)-x(2*np+j))**2 v=2.d0*u*sqrt(u) * objf = objf + 1.d0/sqrt(u) * gobj(i) = -2.d0*(x(i)-x(j))/v + gobj(i) gobj(j) = 2.d0*(x(i)-x(j))/v + gobj(j) gobj(np+i) = -2.d0*(x(np+i)-x(np+j))/v + gobj(np+i) gobj(np+j) = 2.d0*(x(np+i)-x(np+j))/v + gobj(np+j) gobj(2*np+i)= -2.d0*(x(2*np+i)-x(2*np+j))/v + gobj(2*np+i) gobj(2*np+j)= 2.d0*(x(2*np+i)-x(2*np+j))/v + gobj(2*np+j) end do end do * * * Bounds on variables: * * * Constraints. (Equalities): * np2=2*np do i=1,np e(i) = x(i)**2 + x(np+i)**2 + x(np2+i)**2 - 1.d0 end do * * Jacobian of the Equalities constraints: * do i=1,n ge(i) = 2.d0*x(i) end do * return end *--------------------------------------------------DES.for * Remark: * For different values of parameter np, with the initial point * x0(i)=i, the initial values of objective function, f(x0), and * the optimal values of objective, f(x*), are as follows: * * ------------------------------------------------------- * np f(x0) f(x*) * ------------------------------------------------------- * 50 101.0134 1055.182314691 * 75 168.9337 2454.369689043 * 100 241.7584 4448.350634334 * 150 397.6079 10236.438492618 * 200 563.2665 18439.039580786 * -------------------------------------------------------