Largest Small Hexagon
nco
Ipopt
GAMS
short
P(I) -> P(I++1) -> 0
TOTAREA TOTAL AREA OF THE HEXAGON
EQUATIONS AREADEF(I) AREA DEFINITION FOR TRIANGLE I.
MAXDIST(I,J) MAXIMAL DISTANCE BETWEEN I AND J
OBJ1 FIRST DEFINITION OF OBJECTIVE
OBJ2 SECOND DEFINITION OF OBJECTIVE;
MAXDIST(I,J)$(ORD(I) LT ORD(J)).. SQR(X(I)-X(J))+SQR(Y(I)-Y(J)) =L= 1;
AREADEF(I).. AREA(I) =E= 0.5*(X(I)*Y(I++1)-Y(I)*X(I++1)) ;
OBJ1.. TOTAREA =E= 0.5*SUM(I,X(I)*Y(I++1)-Y(I)*X(I++1));
OBJ2.. TOTAREA =E= SUM(I,AREA(I));
MODEL SMALL /MAXDIST,OBJ1/
LARGE /MAXDIST,OBJ2,AREADEF/ ;
*
* INITIAL CONDITIONS
*
X.FX("1") = 0; Y.FX("1") = 0; Y.FX("2") = 0;
X.L("2") = 0.5; X.L("3") = 0.5; X.L("4") = 0.5;
X.L("5") = 0; X.L("6") = 0;
Y.L("3") = 0.4; Y.L("4") = 0.8; Y.L("5") = 0.8;
Y.L("6") = 0.4;
*
*syntax for setting GAMS options
*
option iterlim=500;
SOLVE LARGE USING NLP MAXIMIZING TOTAREA;
]]>
Finds the largest area possible for a hexagon with a
diameter of 1 with 22 equations, 19 variables, and 97 non-zeroes.