model "Polygon" uses "mmxslp" (! Polygon using single-valued Excel macro function of type XLF !) parameters N=5 end-parameters declarations area: gexp rho : array(1..N) of mpvar theta : array(1..N) of mpvar objdef: mpvar D: array(1..N,1..N) of genctr rTheta: array (1..50) of xvitem end-declarations ! Objective - sum of areas SLPDATA("UF","ExcelArea","Area","VARIANT,VARIANT","XLF", "C:\\XpressMP\\examples\\slp\\spreadsheet\\Polygon.xls","Sheet1") SLPDATA("XV",rTheta) forall (i in 1..N-1) do rTheta(i*2-1) := XVitem(rho(i)) rTheta(i*2) := XVitem(theta(i)) end-do area := Func("ExcelArea",rTheta) objdef = area objdef is_free ! Initialisation of SLP variables, plus bounds forall (i in 1..N-1) do rho(i) >= 0.1 rho(i) <= 1 SLPDATA("IV",rho(i),4*i*(N + 1 - i)/((N+1)^2)) SLPDATA("IV",theta(i),M_PI*i/N) end-do ! Third side of all triangles <= 1 forall (i in 1..N-2) do forall (j in i+1..N-1) do D(i,j) := rho(i)^2 + rho(j)^2 - rho(i)*rho(j)*2*cos(theta(j)-theta(i)) <= 1 end-do end-do ! Vertices in increasing order forall (i in 2..N-1) do theta(i) >= theta(i-1) +.01 end-do ! Boundary conditions theta(N-1) <= M_PI SLPloadprob(objdef) SLPmaximise writeln("Area = ",getobjval) forall (i in 1..N-1) do writeln("V",i,": r=",getsol(rho(i))," theta=",getsol(theta(i))) end-do end-model