Polygon : Among All Polygons with nv Sides and Diameter d value at most one, Finding the One of Maximal Area

Reference

  • Neculai Andrei, Nonlinear Optimization Applications Using the GAMS Technology,Springer Optimization and Its Applications, Model Polygon (3.5) in chapter Some Mathematical Algorithms and Problems in GAMS Technology, 2013

Category : GAMS NOA library


Mainfile : polygon.gms

$onText
Polygon
Find the polygon of maximal area, among all polygons with nv sides and
diameter less than or equal to 1.
$offText

$if     set n  $set nv %n%
$if not set nv $set nv 10
set i sides /i1 * i%nv%/;
alias(i,j)

scalar pi

positive variables
  r(i)
  theta(i)
variable
  polygon_area;

equations
  obj
  distance(i,j)
  ordered(i);

* Objective function:
obj.. polygon_area =E= 0.5 * sum(j(i+1), r(i)*r(i+1)*sin(theta(i+1)-theta(i)));

* Constraints:
distance(i,j)$(ord(j)>ord(i)).. sqr(r(i))+sqr(r(j))-
                                2*r(i)*r(j)*cos(theta(j)-theta(i)) =L=1;
ordered(i+1).. theta(i) =L= theta(i+1);

pi = 2*arctan(inf);

r.up(i) = 1;
theta.up(i) = pi;

r.l(i) = 4*ord(i)*(card(i)+1-ord(i))/sqr(card(i)+1);
theta.l(i) = pi*ord(i)/card(i);

model polygon /all/;

$ifThenI x%mode%==xbook
polygon.iterlim=5000;
option reslim = 3620;
$endIf

solve polygon using nlp maximizing polygon_area;
display polygon_area.l;
* End polygon