ClearAll["Global`*"]
NM[u_]:=Sqrt[u.u] 
NM::usage="Norm";
VAA[u_,v_]:= ArcCos[u.v/(NM[u]NM[v])] 
VAA::usage="Vector Angle[u,v], bad near 0 and angle 0";
Angle[u_,v_,w_]:=VAA[u-v,w-v]
Angle::usage="the angle uvw"
AreaASA[f_]:=1/(2Cot[f]+2Cot[3Pi/10])
AreaASA::usage="The area of a triangle, one leg being the circumradius of a regular pentagon as a function of the angle at the center of the pentagon."
(*Values, Points and Lines*)
(*We fix one pentagon and move along a one parameter family defined by t2.  Then we allow variations u2,t3,u3,t4,u4 (in R^2) and th2,th3,th4 (rotations).  So we have a 9 dimensional space*)

t2::usage="horozontal right shift in pentagon family";
t3::usage="horozontal right shift in pentagon 3";
t4::usage="horozontal right shift in pentagon 4";
u2::usage="vertical shift in pentagon 2";
u3::usage="vertical shift in pentagon 3";
u4::usage="vertical shift in pentagon 4";
th2::usage="rotation in pentagon 2";
th3::usage="rotation in pentagon 3";
th4::usage="rotation in pentagon 4";
AP=Sin[(π/5)] Tan[((3π)/10)]; 
AP::usage="apothem";

(*b describes the one-parameter family,c describes the centers in the configuration space*)
b1=c1:={0,0}

b2[t2_]:={t2,0}

c2[t2_,u2_]:=b2[t2]+{0,u2-AP-1}

b3[t2_]:={Cos[-(π/10)]+(((t2+ Sin[(π/5)]) ((AP* Sin[(π/5)]+Sin[((2 π)/5)])-Cos[-(π/10)]))/(Sin[(π/5)])),(-1+Sin[-(π/10)])+
(((t2+ Sin[(π/5)]) ((-AP* Cos[(π/5)]-Cos[((2 π)/5)])-(-1+Sin[-(π/10)])))/(Sin[(π/5)])) }
c3[t2_,t3_,u3_]:=b3[t2]+{t3,u3}


b4[t2_]:={-(Cos[-(π/10)]+(((-t2+ Sin[(π/5)]) ((AP* Sin[(π/5)]+Sin[((2 π)/5)])-Cos[-(π/10)]))/(Sin[(π/5)]))),(-1+Sin[-(π/10)])+
(((-t2+ Sin[(π/5)]) ((-AP* Cos[(π/5)]-Cos[((2 π)/5)])-(-1+Sin[-(π/10)])))/(Sin[(π/5)]))}

c4[t2_,t4_,u4_] := b4[t2]+{t4,u4}

(*Pentagon Vetices: these are required to define the local nonintersection constraints *)
p12:=c1+{0,-1};
p12::usage="vertex of P1 touching P2";
p13:=c1+RotationMatrix[2Pi/5].{0,-1};
p13::usage="vertex of P1 touching P3";
p14:=c1+RotationMatrix[-2Pi/5].{0,-1};
p14::usage="vertex of P1 touching P4";
p23[t2_,u2_,th2_]:=c2[t2,u2]+ RotationMatrix[4Pi/5+th2].{0,-1};
p23::usage="vertex of P2 touching P3";
p24[t2_,u2_,th2_]:=c2[t2,u2]+ RotationMatrix[-4Pi/5+th2].{0,-1};
p24::usage="vertex of P2 touching P4";
p31[t2_,t3_,u3_,th3_]:=c3[t2,t3,u3]+RotationMatrix[2Pi/5+th3].{0,1};
p31::usage="vertex of P3 touching P1";
p32[t2_,t3_,u3_,th3_]:=c3[t2,t3,u3]+RotationMatrix[4Pi/5+th3].{0,1};
p32::usage="vertex of P3 touching P2";
p41[t2_,t4_,u4_,th4_]:=c4[t2,t4,u4]+RotationMatrix[-2Pi/5+th4].{0,1};
p41::usage="vertex of P4 touching P1";
p42[t2_,t4_,u4_,th4_]:=c4[t2,t4,u4]+RotationMatrix[-4Pi/5+th4].{0,1};
p42::usage="vertex of P4 touching P2";

(*Objective Functions*)
ob13[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[ c3[t2,t3,u3],c1,{0,-1}]];
ob14[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[c4[t2,t4,u4],c1,{0,-1}]];
ob23[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[p23[t2,u2,th2],c2[t2,u2],c3[t2,t3,u3]]];
ob24[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[p24[t2,u2,th2],c2[t2,u2],c4[t2,t4,u4]]];
ob32[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[p31[t2,t3,u3,th3],c3[t2,t3,u3],c2[t2,u2]]];
ob42[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[p41[t2,t4,u4,th4],c4[t2,t4,u4],c2[t2,u2]]];
ob31[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[p31[t2,t3,u3,th3],c3[t2,t3,u3],c1]];
ob41[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=AreaASA[Angle[p41[t2,t4,u4,th4],c4[t2,t4,u4],c1]];
ob21 [t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:= 1/(2Cot[2Pi/5]+2Cot[3Pi/10]);
Denom[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:= 
((1/2)(Det[{c2[t2,u2]-c1,c3[t2,t3,u3]-c1}]))+((1/2)(Det[{c4[t2,t4,u4]-c1,c2[t2,u2]-c1}]));

OB[t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=

(ob13[t2,u2,th2,t3,u3,th3,t4,u4,th4]+ob14[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
ob23[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
ob24[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
ob32[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
ob42[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
ob31[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
ob41[t2,u2,th2,t3,u3,th3,t4,u4,th4]+
+ob21[t2,u2,th2,t3,u3,th3,t4,u4,th4])/Denom[t2,u2,th2,t3,u3,th3,t4,u4,th4];

(*Nonintersection constraints*)
Con[1,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c2[t2,u2],p23[t2,u2,th2],p12];
Con[2,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c3[t2,t3,u3],p31[t2,t3,u3,th3],p23[t2,u2,th2]];
Con[3,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c1,p12,p31[t2,t3,u3,th3]];
Con[4,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c2[t2,u2],p23[t2,u2,th2],p32[t2,t3,u3,th3]];
Con[5,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c3[t2,t3,u3],p31[t2,t3,u3,th3],p13];
Con[6,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c4[t2,t4,u4],p41[t2,t4,u4,th4],p24[t2,u2,th2]];
Con[7,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c1,p12,p41[t2,t4,u4,th4]];
Con[8,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c2[t2,u2],p24[t2,u2,th2],p42[t2,t4,u4,th4]];
Con[9,t2_,u2_,th2_,t3_,u3_,th3_,t4_,u4_,th4_]:=
Angle[c4[t2,t4,u4],p41[t2,t4,u4,th4],p14];