This page was generated from unit-7-optimization/03_Shape_Derivative_Laplace_SemiAuto.ipynb.
7.3 PDE-Constrained Shape Optimization in NGSolve¶
- We want to solve the PDE-constrained shape optimization problem :nbsphinx-math:`begin{equation}
underset{Omegasubset mathsf{D}}{mbox{min}} ; J(u) := int_Omega |u-u_d|^q ; dx, quad qge 2
- end{equation}` subject to that \((\Omega,u)\) satisfy :nbsphinx-math:`begin{equation}
int_Omega nabla u cdot nabla v ; dx = int_Omega f v ; dx ; quad text{ for all } v in H_0^1(Omega),
end{equation}` where \(\Omega \subset \mathbb R^2\) for given \(u_d, f \in C^1(\mathbb R^2)\).
[1]:
import netgen.gui
from ngsolve import *
from netgen.geom2d import SplineGeometry
[2]:
geo = SplineGeometry()
geo.AddCircle(c=(0.5,0.5), r=0.5, bc = 'circle')
mesh = Mesh(geo.GenerateMesh(maxh = 0.08))
[3]:
#given data of our problem (chosen such that \Omega^* = [0,1]^2 is the optimal shape)
f = CoefficientFunction(2*y*(1-y)+2*x*(1-x))
ud = x*(1-x)*y*(1-y)
grad_f = CoefficientFunction( (f.Diff(x), f.Diff(y) ) )
grad_ud = CoefficientFunction( (ud.Diff(x), ud.Diff(y) ) )
State equation¶
[4]:
fes = H1(mesh, order=2, dirichlet=".*")
u, v = fes.TnT()
gfu = GridFunction(fes)
Draw (gfu, mesh, "state")
a = BilinearForm(fes, symmetric=True)
a += grad(u)*grad(v)*dx
fstate = LinearForm(fes)
fstate += f*v*dx
[5]:
def SolveStateEquation():
rhs = gfu.vec.CreateVector()
rhs.data = fstate.vec - a.mat * gfu.vec
update = gfu.vec.CreateVector()
update.data = a.mat.Inverse(fes.FreeDofs()) * rhs
gfu.vec.data += update
[6]:
a.Assemble()
fstate.Assemble()
SolveStateEquation()
Redraw()
Adjoint equation¶
- We set up the adjoint equation :nbsphinx-math:`begin{align*}
mbox{Find } p in H_0^1(Omega): int_Omega nabla w cdot nabla p , mbox dx = - partial_u J(u)(w) quad text{ for all } w in H_0^1(Omega)
- end{align*}` where \(u\) is the solution to the state equation. For \(J(u) = \int_\Omega |u-u_d|^q \mbox dx\), we get :nbsphinx-math:`begin{align*}
partial_u J(u)(w) = q int_Omega (u-u_d)^{d-1}w ,mbox dx.
end{align*}` However, we can also use the Diff(…) command:
[7]:
q=6
def Cost(u):
return (u-ud)**q*dx
p, w = fes.TnT()
gfp = GridFunction(fes)
Draw (gfp, mesh, "adjoint")
fadjoint = LinearForm(fes)
fadjoint += -1*Cost(gfu).Diff(gfu,w)
[8]:
def SolveAdjointEquation():
rhs = gfp.vec.CreateVector()
rhs.data = fadjoint.vec - a.mat.T * gfp.vec
update = gfp.vec.CreateVector()
update.data = a.mat.Inverse(fes.FreeDofs()).T * rhs
gfp.vec.data += update
[9]:
fadjoint.Assemble()
SolveAdjointEquation()
Redraw()
Note that (for linear problems) the operator on the left hand side of the adjoint equation is just the transpose of the state operator.
Automatic Shape Differentiation¶
- The formula for the shape derivative was derived as the partial derivative of the perturbed Lagrangian (brought back to the original domain): :nbsphinx-math:`begin{align*}
- dmathcal J(Omega; X) = frac{partial}{partial t} left( int_Omega xi(t)|u - u_d^t|^q mbox{d} x
int_{Omega} (F_t^{-top}nabla u) cdot (F_t^{-top} nabla p) xi(t) , dx - int_{Omega} xi(t) f^t p ,dx right)|_{t=0}
end{align*}` where
\(T_t(x)=x+tX(x)=y\)
\(F_t = DT_t = I+t DX\)
\(\xi(t) = \mbox{det}(F_t)\)
\(u_d^t = u_d \circ T_t\)
\(f^t = f \circ T_t\)
- The integrand depends on the parameter \(t\) only via \(\xi(t)\), \(F_t\) and \(T_t\). Denoting the integrand by \(G^{u,p}\), the derivative is given by :nbsphinx-math:`begin{align*}
dmathcal J(Omega; X) =& frac{d G^{u,p}}{d xi} frac{d xi}{d t} + frac{d G^{u,p}}{d F} frac{d F}{d t} + frac{d G^{u,p}}{dy} cdot frac{d T_t}{dt} \ =& frac{d G^{u,p}}{d xi} mbox{div}(X) + frac{d G^{u,p}}{d F} DX + frac{d G^{u,p}}{dy} cdot X
end{align*}`
[10]:
J = Parameter(1)
F = Id(2)
#Finv = 2*Id(2) - F # consistent linearization at F = I (avoids calling Inv() for speedup)
def Equation(u,v):
return ( (Inv(F.trans)*grad(u))*(Inv(F.trans)*grad(v))-f*v)*J*dx
# return ( (Finv.trans*grad(u))*(Finv.trans*grad(v))-f*v)*J*dx
def CostAuto(u):
return J*(u-ud)**q*dx
[11]:
VEC = H1(mesh, order=2, dim=2)
PHI, X = VEC.TnT()
Lagrangian = CostAuto(gfu) + Equation(gfu,gfp)
dJOmegaAuto = LinearForm(VEC)
dJOmegaAuto += Lagrangian.Diff(J, div(X))
dJOmegaAuto += Lagrangian.Diff(F, grad(X).trans) # grad(X).trans is Jacobian
dJOmegaAuto += Lagrangian.Diff(x, X[0]) + Lagrangian.Diff(y, X[1])
[12]:
b = BilinearForm(VEC)
b += InnerProduct(grad(X),grad(PHI))*dx + InnerProduct(X,PHI)*dx
gfX = GridFunction(VEC)
# gfset denotes the deformation of the original domain and will be updated during the shape optimization
gfset = GridFunction(VEC)
gfset.Set((0,0))
Draw(gfset,mesh,"gfset")
SetVisualization (deformation=True)
[13]:
def SolveDeformationEquationAuto():
rhs = gfX.vec.CreateVector()
rhs.data = dJOmegaAuto.vec - b.mat * gfX.vec
update = gfX.vec.CreateVector()
update.data = b.mat.Inverse(VEC.FreeDofs()) * rhs
gfX.vec.data += update
[14]:
b.Assemble()
dJOmegaAuto.Assemble()
SolveDeformationEquationAuto()
Draw(-gfX, mesh, "gfX")
[15]:
print('Cost at initial design', Integrate (CostAuto(gfu), mesh))
gfset.Set((0,0))
scale = 0.5 / Norm(gfX.vec)
gfset.vec.data -= scale * gfX.vec
Cost at initial design 6.14314805222293e-13
[16]:
mesh.SetDeformation(gfset)
a.Assemble()
fstate.Assemble()
SolveStateEquation()
print('Cost at new design', Integrate (CostAuto(gfu), mesh))
Cost at new design 5.1568007223315504e-14
Equation can also be used to define the bilinear form. The following defines the same bilinear form as above:
[17]:
aAuto = BilinearForm(fes, symmetric=True)
aAuto += Equation(u,v)
Thus, the user has to enter the PDE (in its transformed form) only once.
Finally, let us again run the full algorithm:
[18]:
#reset to and solve for initial configuration
gfset.Set((0,0))
mesh.SetDeformation(gfset)
a.Assemble()
fstate.Assemble()
SolveStateEquation()
LineSearch = False
# visoptions.vecfunction='gfset'
# visoptions.scalfunction='state'
iter_max = 600
Jold = Integrate(CostAuto(gfu), mesh)
converged = False
for k in range(iter_max):
print('cost at iteration', k, ': ', Jold)
mesh.SetDeformation(gfset)
a.Assemble()
fstate.Assemble()
SolveStateEquation()
fadjoint.Assemble()
SolveAdjointEquation()
b.Assemble()
dJOmegaAuto.Assemble()
SolveDeformationEquationAuto()
scale = 0.01 / Norm(gfX.vec)
gfsetOld = gfset
gfset.vec.data -= scale * gfX.vec
Jnew = Integrate(CostAuto(gfu), mesh)
if LineSearch:
while Jnew > Jold and scale > 1e-12:
# input('a')
scale = scale / 2
if scale <= 1e-12:
converged = True
break
gfset.vec.data = gfsetOld.vec - scale * gfX.vec
mesh.SetDeformation(gfset)
a.Assemble()
fstate.Assemble()
SolveStateEquation()
Jnew = Integrate(CostAuto(gfu), mesh)
if converged==True:
break
Jold = Jnew
Redraw(blocking=True)
cost at iteration 0 : 6.143148052222901e-13
cost at iteration 1 : 5.748924421710597e-13
cost at iteration 2 : 5.207294625812289e-13
cost at iteration 3 : 4.712190017435656e-13
cost at iteration 4 : 4.2601114125018297e-13
cost at iteration 5 : 3.8477703747758833e-13
cost at iteration 6 : 3.4720812047686925e-13
cost at iteration 7 : 3.1301529239678015e-13
cost at iteration 8 : 2.819281271068429e-13
cost at iteration 9 : 2.5369407268049563e-13
cost at iteration 10 : 2.280776583897301e-13
cost at iteration 11 : 2.0485970785397564e-13
cost at iteration 12 : 1.8383655997753434e-13
cost at iteration 13 : 1.6481929930262426e-13
cost at iteration 14 : 1.4763299739883728e-13
cost at iteration 15 : 1.3211596690422567e-13
cost at iteration 16 : 1.1811902982603246e-13
cost at iteration 17 : 1.0550480169609736e-13
cost at iteration 18 : 9.414699314953546e-14
cost at iteration 19 : 8.392973044264107e-14
cost at iteration 20 : 7.474689632685985e-14
cost at iteration 21 : 6.650149251887892e-14
cost at iteration 22 : 5.910502470517533e-14
cost at iteration 23 : 5.247691052254539e-14
cost at iteration 24 : 4.6543910161155605e-14
cost at iteration 25 : 4.123957799444085e-14
cost at iteration 26 : 3.650373173889022e-14
cost at iteration 27 : 3.228193279398466e-14
cost at iteration 28 : 2.8524967224104973e-14
cost at iteration 29 : 2.5188310865285462e-14
cost at iteration 30 : 2.2231553867853393e-14
cost at iteration 31 : 1.9617749686531554e-14
cost at iteration 32 : 1.731264284535617e-14
cost at iteration 33 : 1.528372545139328e-14
cost at iteration 34 : 1.3499094543568868e-14
cost at iteration 35 : 1.1926183920084669e-14
cost at iteration 36 : 1.053074381507224e-14
cost at iteration 37 : 9.277116989800375e-15
cost at iteration 38 : 8.131778983527424e-15
cost at iteration 39 : 7.071425326819678e-15
cost at iteration 40 : 6.090767095978861e-15
cost at iteration 41 : 5.1989109248104475e-15
cost at iteration 42 : 4.4053674613258824e-15
cost at iteration 43 : 3.711549081640755e-15
cost at iteration 44 : 3.111880553132081e-15
cost at iteration 45 : 2.597496479010797e-15
cost at iteration 46 : 2.1587136473048307e-15
cost at iteration 47 : 1.786174561527012e-15
cost at iteration 48 : 1.4712712057701287e-15
cost at iteration 49 : 1.2062547809039781e-15
cost at iteration 50 : 9.842238095292876e-16
cost at iteration 51 : 7.990702533308561e-16
cost at iteration 52 : 6.454139885437586e-16
cost at iteration 53 : 5.185364256309659e-16
cost at iteration 54 : 4.143168495695936e-16
cost at iteration 55 : 3.2917254484705695e-16
cost at iteration 56 : 2.600029680540387e-16
cost at iteration 57 : 2.0413794423590851e-16
cost at iteration 58 : 1.5928981828566553e-16
cost at iteration 59 : 1.2350938241640862e-16
cost at iteration 60 : 9.51455083136313e-17
cost at iteration 61 : 7.280815661282583e-17
cost at iteration 62 : 5.533490658243909e-17
cost at iteration 63 : 4.176022030252486e-17
cost at iteration 64 : 3.1289099105580724e-17
cost at iteration 65 : 2.327554805020378e-17
cost at iteration 66 : 1.72497566109024e-17
cost at iteration 67 : 1.3230143284374553e-17
cost at iteration 68 : 1.1437779982803126e-17
cost at iteration 69 : 1.012766861281903e-17
cost at iteration 70 : 8.83085209235137e-18
cost at iteration 71 : 7.783352043198985e-18
cost at iteration 72 : 6.8176568084789394e-18
cost at iteration 73 : 5.999358947032199e-18
cost at iteration 74 : 5.266634022645047e-18
cost at iteration 75 : 4.632985615346245e-18
cost at iteration 76 : 4.07238111282322e-18
cost at iteration 77 : 3.5830587946776685e-18
cost at iteration 78 : 3.15225474553747e-18
cost at iteration 79 : 2.7745270728089246e-18
cost at iteration 80 : 2.442582574773255e-18
cost at iteration 81 : 2.150858059234318e-18
cost at iteration 82 : 1.8946214109664467e-18
cost at iteration 83 : 1.669151584260755e-18
cost at iteration 84 : 1.4710923269124327e-18
cost at iteration 85 : 1.2966972660233959e-18
cost at iteration 86 : 1.1434495907421549e-18
cost at iteration 87 : 1.0084650529395617e-18
cost at iteration 88 : 8.89792623804512e-19
cost at iteration 89 : 7.852469460627788e-19
cost at iteration 90 : 6.932852358568858e-19
cost at iteration 91 : 6.122682861348119e-19
cost at iteration 92 : 5.409608269170318e-19
cost at iteration 93 : 4.781431310948724e-19
cost at iteration 94 : 4.228177230926763e-19
cost at iteration 95 : 3.740842102127309e-19
cost at iteration 96 : 3.3113200970103127e-19
cost at iteration 97 : 2.9330248098629085e-19
cost at iteration 98 : 2.5993352425079383e-19
cost at iteration 99 : 2.3054854193183763e-19
cost at iteration 100 : 2.046043794837901e-19
cost at iteration 101 : 1.8176041041554557e-19
cost at iteration 102 : 1.6156949344681068e-19
cost at iteration 103 : 1.4379112404521446e-19
cost at iteration 104 : 1.2805637869386683e-19
cost at iteration 105 : 1.141969004628745e-19
cost at iteration 106 : 1.0190848797404176e-19
cost at iteration 107 : 9.107376378095052e-20
cost at iteration 108 : 8.144357787688932e-20
cost at iteration 109 : 7.293684698404825e-20
cost at iteration 110 : 6.535251784829599e-20
cost at iteration 111 : 5.86363438020398e-20
cost at iteration 112 : 5.262877007707828e-20
cost at iteration 113 : 4.729558786470414e-20
cost at iteration 114 : 4.2510879518100044e-20
cost at iteration 115 : 3.8254735275727974e-20
cost at iteration 116 : 3.4426703159702806e-20
cost at iteration 117 : 3.101664203987232e-20
cost at iteration 118 : 2.7942830791558413e-20
cost at iteration 119 : 2.520182081028496e-20
cost at iteration 120 : 2.2725887749572104e-20
cost at iteration 121 : 2.0516298390330658e-20
cost at iteration 122 : 1.8516188399922292e-20
cost at iteration 123 : 1.6730163734010093e-20
cost at iteration 124 : 1.5110104368670543e-20
cost at iteration 125 : 1.3662869679215705e-20
cost at iteration 126 : 1.2347568894594798e-20
cost at iteration 127 : 1.1172404338538627e-20
cost at iteration 128 : 1.0102553171257993e-20
cost at iteration 129 : 9.146818009194148e-21
cost at iteration 130 : 8.27550664520896e-21
cost at iteration 131 : 7.497467870592575e-21
cost at iteration 132 : 6.78735906137103e-21
cost at iteration 133 : 6.1537106443660825e-21
cost at iteration 134 : 5.5748644403737445e-21
cost at iteration 135 : 5.058828238871991e-21
cost at iteration 136 : 4.587054248915909e-21
cost at iteration 137 : 4.166938474874549e-21
cost at iteration 138 : 3.7825489364190334e-21
cost at iteration 139 : 3.440653554706854e-21
cost at iteration 140 : 3.1275178208865155e-21
cost at iteration 141 : 2.849308123360703e-21
cost at iteration 142 : 2.5941421812999557e-21
cost at iteration 143 : 2.3676356949512327e-21
cost at iteration 144 : 2.159477899124321e-21
cost at iteration 145 : 1.9747964326392768e-21
cost at iteration 146 : 1.8046227860938107e-21
cost at iteration 147 : 1.6536599869442577e-21
cost at iteration 148 : 1.5140915719237936e-21
cost at iteration 149 : 1.3902497378809644e-21
cost at iteration 150 : 1.2753117505724701e-21
cost at iteration 151 : 1.173274610468749e-21
cost at iteration 152 : 1.0781815582387034e-21
cost at iteration 153 : 9.93707087263515e-22
cost at iteration 154 : 9.14664718484937e-22
cost at iteration 155 : 8.443951956857632e-22
cost at iteration 156 : 7.784193579796486e-22
cost at iteration 157 : 7.197107607361968e-22
cost at iteration 158 : 6.644647851354924e-22
cost at iteration 159 : 6.152356012392976e-22
cost at iteration 160 : 5.688822836665347e-22
cost at iteration 161 : 5.274753226120466e-22
cost at iteration 162 : 4.885302601013136e-22
cost at iteration 163 : 4.535791560853158e-22
cost at iteration 164 : 4.207640325794774e-22
cost at iteration 165 : 3.9109412702455826e-22
cost at iteration 166 : 3.6326242317889514e-22
cost at iteration 167 : 3.3790313397689313e-22
cost at iteration 168 : 3.1410441013240765e-22
cost at iteration 169 : 2.9236192161627555e-22
cost at iteration 170 : 2.719163653570262e-22
cost at iteration 171 : 2.533952819042033e-22
cost at iteration 172 : 2.3594593908609606e-22
cost at iteration 173 : 2.2072075680103535e-22
cost at iteration 174 : 2.0656537221341835e-22
cost at iteration 175 : 1.9499659982107696e-22
cost at iteration 176 : 1.8307024515428684e-22
cost at iteration 177 : 1.7292301154597016e-22
cost at iteration 178 : 1.6203824749680604e-22
cost at iteration 179 : 1.5297574206979758e-22
cost at iteration 180 : 1.4319473537363578e-22
cost at iteration 181 : 1.351614891485652e-22
cost at iteration 182 : 1.264193867635898e-22
cost at iteration 183 : 1.1936446995562963e-22
cost at iteration 184 : 1.116265373473082e-22
cost at iteration 185 : 1.0551686359795892e-22
cost at iteration 186 : 9.874085863488434e-23
cost at iteration 187 : 9.35303760710287e-23
cost at iteration 188 : 8.76729726813119e-23
cost at iteration 189 : 8.334615505532673e-23
cost at iteration 190 : 7.852823099372576e-23
cost at iteration 191 : 7.556613502204978e-23
cost at iteration 192 : 7.318677985242136e-23
cost at iteration 193 : 7.005094988493475e-23
cost at iteration 194 : 6.737688579262175e-23
cost at iteration 195 : 6.433943419481182e-23
cost at iteration 196 : 6.189808556973142e-23
cost at iteration 197 : 5.918657727464132e-23
cost at iteration 198 : 5.699538729815239e-23
cost at iteration 199 : 5.456707307906538e-23
cost at iteration 200 : 5.2591123032397747e-23
cost at iteration 201 : 5.041669290087076e-23
cost at iteration 202 : 4.863377420013792e-23
cost at iteration 203 : 4.6712462550119634e-23
cost at iteration 204 : 4.510893616046874e-23
cost at iteration 205 : 4.3462742169551904e-23
cost at iteration 206 : 4.2026500270437045e-23
cost at iteration 207 : 4.071800048113373e-23
cost at iteration 208 : 3.9462270576933784e-23
cost at iteration 209 : 3.866267080077568e-23
cost at iteration 210 : 3.7541288047150477e-23
cost at iteration 211 : 3.666053556208493e-23
cost at iteration 212 : 3.5144570895705224e-23
cost at iteration 213 : 3.428753451782126e-23
cost at iteration 214 : 3.298475707477661e-23
cost at iteration 215 : 3.235340730746131e-23
cost at iteration 216 : 3.1243249814756394e-23
cost at iteration 217 : 3.075023452499421e-23
cost at iteration 218 : 2.9768024023731884e-23
cost at iteration 219 : 2.939594911228614e-23
cost at iteration 220 : 2.86092240073054e-23
cost at iteration 221 : 2.851934413629465e-23
cost at iteration 222 : 2.839611265504352e-23
cost at iteration 223 : 2.789720252466534e-23
cost at iteration 224 : 2.712954857426454e-23
cost at iteration 225 : 2.6223265038766295e-23
cost at iteration 226 : 2.5489089061399263e-23
cost at iteration 227 : 2.491466512329164e-23
cost at iteration 228 : 2.4387851155718477e-23
cost at iteration 229 : 2.406488667882295e-23
cost at iteration 230 : 2.3643175928413898e-23
cost at iteration 231 : 2.3664268996854405e-23
cost at iteration 232 : 2.341671037119565e-23
cost at iteration 233 : 2.372210361292103e-23
cost at iteration 234 : 2.263759225399853e-23
cost at iteration 235 : 2.259048503968977e-23
cost at iteration 236 : 2.138954246626697e-23
cost at iteration 237 : 2.152883534590059e-23
cost at iteration 238 : 2.0584232339733454e-23
cost at iteration 239 : 2.0904236298161347e-23
cost at iteration 240 : 2.016315265527995e-23
cost at iteration 241 : 2.0827718713088632e-23
cost at iteration 242 : 2.0859349329320726e-23
cost at iteration 243 : 2.0713588053052743e-23
cost at iteration 244 : 2.010524072587773e-23
cost at iteration 245 : 1.958478627329188e-23
cost at iteration 246 : 1.8963718442309674e-23
cost at iteration 247 : 1.882534794803875e-23
cost at iteration 248 : 1.8373231939407207e-23
cost at iteration 249 : 1.855632433647006e-23
cost at iteration 250 : 1.8258330278694522e-23
cost at iteration 251 : 1.9085904029426643e-23
cost at iteration 252 : 1.8384654298554556e-23
cost at iteration 253 : 1.8469053440662803e-23
cost at iteration 254 : 1.7543417999570294e-23
cost at iteration 255 : 1.7494884113692692e-23
cost at iteration 256 : 1.6878709200494155e-23
cost at iteration 257 : 1.7022361722721977e-23
cost at iteration 258 : 1.6628233365374982e-23
cost at iteration 259 : 1.7062462515741735e-23
cost at iteration 260 : 1.748596118782278e-23
cost at iteration 261 : 1.7516257094023286e-23
cost at iteration 262 : 1.690593841694352e-23
cost at iteration 263 : 1.6630371258127083e-23
cost at iteration 264 : 1.589656591788966e-23
cost at iteration 265 : 1.6015905140755072e-23
cost at iteration 266 : 1.5445206483986676e-23
cost at iteration 267 : 1.5916744578558404e-23
cost at iteration 268 : 1.5527862877793297e-23
cost at iteration 269 : 1.6729286550712568e-23
cost at iteration 270 : 1.5619911673449045e-23
cost at iteration 271 : 1.6036610216958647e-23
cost at iteration 272 : 1.491083349164448e-23
cost at iteration 273 : 1.524824118307395e-23
cost at iteration 274 : 1.4417580044739888e-23
cost at iteration 275 : 1.4955430280626137e-23
cost at iteration 276 : 1.4345564124385673e-23
cost at iteration 277 : 1.534411067762619e-23
cost at iteration 278 : 1.5631883246560506e-23
cost at iteration 279 : 1.5083852879439003e-23
cost at iteration 280 : 1.499754176197709e-23
cost at iteration 281 : 1.4265049252919167e-23
cost at iteration 282 : 1.4241598199568468e-23
cost at iteration 283 : 1.383244065758075e-23
cost at iteration 284 : 1.4001151783966172e-23
cost at iteration 285 : 1.3968396576904474e-23
cost at iteration 286 : 1.4509524466086558e-23
cost at iteration 287 : 1.4685623342103492e-23
cost at iteration 288 : 1.39365963067142e-23
cost at iteration 289 : 1.4094108637267466e-23
cost at iteration 290 : 1.3199035176823348e-23
cost at iteration 291 : 1.3575125568591106e-23
cost at iteration 292 : 1.2912996215904707e-23
cost at iteration 293 : 1.3494793594144663e-23
cost at iteration 294 : 1.3195927356863042e-23
cost at iteration 295 : 1.469227094013653e-23
cost at iteration 296 : 1.374210775056151e-23
cost at iteration 297 : 1.3687278281863454e-23
cost at iteration 298 : 1.3075078602767924e-23
cost at iteration 299 : 1.2995586955828818e-23
cost at iteration 300 : 1.2603939999680233e-23
cost at iteration 301 : 1.2820013428626466e-23
cost at iteration 302 : 1.2625723014805469e-23
cost at iteration 303 : 1.3475631515421107e-23
cost at iteration 304 : 1.3255996889792002e-23
cost at iteration 305 : 1.3129380733865173e-23
cost at iteration 306 : 1.268422944420793e-23
cost at iteration 307 : 1.2402461276409336e-23
cost at iteration 308 : 1.222575955535829e-23
cost at iteration 309 : 1.2114573104107298e-23
cost at iteration 310 : 1.2171797763696447e-23
cost at iteration 311 : 1.2353486814740078e-23
cost at iteration 312 : 1.3416820093742825e-23
cost at iteration 313 : 1.2820552409014824e-23
cost at iteration 314 : 1.270517757518963e-23
cost at iteration 315 : 1.2213213475701609e-23
cost at iteration 316 : 1.1966206912726304e-23
cost at iteration 317 : 1.1810816492055466e-23
cost at iteration 318 : 1.174054680704422e-23
cost at iteration 319 : 1.1948494411745074e-23
cost at iteration 320 : 1.2227011634563857e-23
cost at iteration 321 : 1.2837445187131047e-23
cost at iteration 322 : 1.1808269976079137e-23
cost at iteration 323 : 1.2274327066449277e-23
cost at iteration 324 : 1.1154732297633447e-23
cost at iteration 325 : 1.1823234279414837e-23
cost at iteration 326 : 1.0907960401838941e-23
cost at iteration 327 : 1.1785013891714746e-23
cost at iteration 328 : 1.1164050865687122e-23
cost at iteration 329 : 1.3037890535660223e-23
cost at iteration 330 : 1.1914300597506302e-23
cost at iteration 331 : 1.1931632698653075e-23
cost at iteration 332 : 1.1383596155481878e-23
cost at iteration 333 : 1.130857036683731e-23
cost at iteration 334 : 1.0968342694402317e-23
cost at iteration 335 : 1.117235414886582e-23
cost at iteration 336 : 1.1038939013742377e-23
cost at iteration 337 : 1.1891958371408493e-23
cost at iteration 338 : 1.1659722294020985e-23
cost at iteration 339 : 1.1495576695696343e-23
cost at iteration 340 : 1.114905815787087e-23
cost at iteration 341 : 1.0830347153621157e-23
cost at iteration 342 : 1.0774086474764616e-23
cost at iteration 343 : 1.0602136817508749e-23
cost at iteration 344 : 1.0778258109829022e-23
cost at iteration 345 : 1.0917120305936306e-23
cost at iteration 346 : 1.219027598966429e-23
cost at iteration 347 : 1.1178586947231516e-23
cost at iteration 348 : 1.1398356349414738e-23
cost at iteration 349 : 1.0637900784449782e-23
cost at iteration 350 : 1.0782323636173431e-23
cost at iteration 351 : 1.0302508082146744e-23
cost at iteration 352 : 1.0642000203140903e-23
cost at iteration 353 : 1.0513805125379568e-23
cost at iteration 354 : 1.1319545639805915e-23
cost at iteration 355 : 1.1205634873422005e-23
cost at iteration 356 : 1.0667735606871455e-23
cost at iteration 357 : 1.075863541795242e-23
cost at iteration 358 : 1.0083187848476844e-23
cost at iteration 359 : 1.0394514235840133e-23
cost at iteration 360 : 9.918296790167737e-24
cost at iteration 361 : 1.0427662139644748e-23
cost at iteration 362 : 1.0377249833157092e-23
cost at iteration 363 : 1.1872272339129988e-23
cost at iteration 364 : 1.0516013875346067e-23
cost at iteration 365 : 1.0906116408765022e-23
cost at iteration 366 : 9.915107562506695e-24
cost at iteration 367 : 1.044301442912583e-23
cost at iteration 368 : 9.588032016550527e-24
cost at iteration 369 : 1.042549197527676e-23
cost at iteration 370 : 9.752617326097874e-24
cost at iteration 371 : 1.1421451434319212e-23
cost at iteration 372 : 1.0120530159000561e-23
cost at iteration 373 : 1.0671321252345153e-23
cost at iteration 374 : 9.73601921742342e-24
cost at iteration 375 : 1.0100005715352418e-23
cost at iteration 376 : 9.431136820921468e-24
cost at iteration 377 : 9.963810592220647e-24
cost at iteration 378 : 9.491539982216949e-24
cost at iteration 379 : 1.0514884685459128e-23
cost at iteration 380 : 1.0973671969133624e-23
cost at iteration 381 : 1.0124379978978314e-23
cost at iteration 382 : 1.0407195133536271e-23
cost at iteration 383 : 9.532213616761469e-24
cost at iteration 384 : 9.927526189639577e-24
cost at iteration 385 : 9.284087514772753e-24
cost at iteration 386 : 9.893275125574954e-24
cost at iteration 387 : 9.641031805427207e-24
cost at iteration 388 : 1.0785102664460324e-23
cost at iteration 389 : 9.880120343383392e-24
cost at iteration 390 : 9.970905781726273e-24
cost at iteration 391 : 9.433757270926468e-24
cost at iteration 392 : 9.532844921157902e-24
cost at iteration 393 : 9.144906694796513e-24
cost at iteration 394 : 9.450625095590065e-24
cost at iteration 395 : 9.222915253690888e-24
cost at iteration 396 : 1.0120893193641883e-23
cost at iteration 397 : 1.0606576906378075e-23
cost at iteration 398 : 9.76500113826277e-24
cost at iteration 399 : 9.967552254006641e-24
cost at iteration 400 : 9.13103724359892e-24
cost at iteration 401 : 9.564360172239336e-24
cost at iteration 402 : 8.869711656736204e-24
cost at iteration 403 : 9.604718953935012e-24
cost at iteration 404 : 9.129744855570806e-24
cost at iteration 405 : 1.0703264227662758e-23
cost at iteration 406 : 9.214758630742193e-24
cost at iteration 407 : 9.936589715411162e-24
cost at iteration 408 : 8.807775236129995e-24
cost at iteration 409 : 9.468306364972445e-24
cost at iteration 410 : 8.556918254429453e-24
cost at iteration 411 : 9.37986888019786e-24
cost at iteration 412 : 8.64225620397723e-24
cost at iteration 413 : 1.001692890087756e-23
cost at iteration 414 : 1.0117366318484751e-23
cost at iteration 415 : 9.406501103291211e-24
cost at iteration 416 : 9.64573383049788e-24
cost at iteration 417 : 8.832582871809094e-24
cost at iteration 418 : 9.216615911692963e-24
cost at iteration 419 : 8.620664804482602e-24
cost at iteration 420 : 9.21576616336881e-24
cost at iteration 421 : 9.023586896665118e-24
cost at iteration 422 : 1.0120658589044034e-23
cost at iteration 423 : 9.117003590240193e-24
cost at iteration 424 : 9.33978649684318e-24
cost at iteration 425 : 8.664407103041848e-24
cost at iteration 426 : 8.965448868761943e-24
cost at iteration 427 : 8.410329284272425e-24
cost at iteration 428 : 8.907292286940002e-24
cost at iteration 429 : 8.494742635415751e-24
cost at iteration 430 : 9.590455312920282e-24
cost at iteration 431 : 9.872316678160917e-24
cost at iteration 432 : 9.144331954959752e-24
cost at iteration 433 : 9.297411872638961e-24
cost at iteration 434 : 8.547736106976452e-24
cost at iteration 435 : 8.91896000844601e-24
cost at iteration 436 : 8.310539198865291e-24
cost at iteration 437 : 8.96359514952809e-24
cost at iteration 438 : 8.583335780490667e-24
cost at iteration 439 : 1.0049884253368403e-23
cost at iteration 440 : 8.623543239031018e-24
cost at iteration 441 : 9.30912537217442e-24
cost at iteration 442 : 8.236726641023456e-24
cost at iteration 443 : 8.873417223098865e-24
cost at iteration 444 : 8.007667133768011e-24
cost at iteration 445 : 8.792464666488475e-24
cost at iteration 446 : 8.091982466857115e-24
cost at iteration 447 : 9.390682154924032e-24
cost at iteration 448 : 9.56438861477352e-24
cost at iteration 449 : 8.819154204460385e-24
cost at iteration 450 : 9.095150800551742e-24
cost at iteration 451 : 8.283471688435953e-24
cost at iteration 452 : 8.687480601225908e-24
cost at iteration 453 : 8.080750542004939e-24
cost at iteration 454 : 8.687227639648988e-24
cost at iteration 455 : 8.458583668962027e-24
cost at iteration 456 : 9.593849892938276e-24
cost at iteration 457 : 8.57619445227154e-24
cost at iteration 458 : 8.80451001770389e-24
cost at iteration 459 : 8.163367482902659e-24
cost at iteration 460 : 8.444951217992197e-24
cost at iteration 461 : 7.920865836252523e-24
cost at iteration 462 : 8.384609531413409e-24
cost at iteration 463 : 7.993117987545463e-24
cost at iteration 464 : 8.977486194277566e-24
cost at iteration 465 : 9.386691387578084e-24
cost at iteration 466 : 8.640949001318551e-24
cost at iteration 467 : 8.785356048974735e-24
cost at iteration 468 : 8.099720211873543e-24
cost at iteration 469 : 8.411518400823095e-24
cost at iteration 470 : 7.867135870154908e-24
cost at iteration 471 : 8.43335827348989e-24
cost at iteration 472 : 8.107930826403138e-24
cost at iteration 473 : 9.46543531459578e-24
cost at iteration 474 : 8.23295672989768e-24
cost at iteration 475 : 8.745136708896748e-24
cost at iteration 476 : 7.891698786217055e-24
cost at iteration 477 : 8.301484875035034e-24
cost at iteration 478 : 7.671119037930837e-24
cost at iteration 479 : 8.207800935713374e-24
cost at iteration 480 : 7.744916102518678e-24
cost at iteration 481 : 8.705733679880483e-24
cost at iteration 482 : 9.206047337258903e-24
cost at iteration 483 : 8.329412934554103e-24
cost at iteration 484 : 8.671427823335032e-24
cost at iteration 485 : 7.844075550693669e-24
cost at iteration 486 : 8.27038831858744e-24
cost at iteration 487 : 7.637632824072383e-24
cost at iteration 488 : 8.253900952421255e-24
cost at iteration 489 : 7.95550635709845e-24
cost at iteration 490 : 9.137985926805844e-24
cost at iteration 491 : 8.19945995453941e-24
cost at iteration 492 : 8.323799723995614e-24
cost at iteration 493 : 7.847000322533408e-24
cost at iteration 494 : 7.950339740129585e-24
cost at iteration 495 : 7.605683934202384e-24
cost at iteration 496 : 7.875554619761877e-24
cost at iteration 497 : 7.661076668603316e-24
cost at iteration 498 : 8.350502123198522e-24
cost at iteration 499 : 9.033581651328805e-24
cost at iteration 500 : 8.24270066537402e-24
cost at iteration 501 : 8.349094579007436e-24
cost at iteration 502 : 7.769311815962525e-24
cost at iteration 503 : 7.969730189182678e-24
cost at iteration 504 : 7.535906565428042e-24
cost at iteration 505 : 7.959885894099143e-24
cost at iteration 506 : 7.734947740488526e-24
cost at iteration 507 : 8.886256460103128e-24
cost at iteration 508 : 8.003444590364755e-24
cost at iteration 509 : 8.224310855190433e-24
cost at iteration 510 : 7.694345741916853e-24
cost at iteration 511 : 7.758280153927732e-24
cost at iteration 512 : 7.479291715168328e-24
cost at iteration 513 : 7.644932811739978e-24
cost at iteration 514 : 7.538745897407212e-24
cost at iteration 515 : 8.024907850916764e-24
cost at iteration 516 : 8.948881391019389e-24
cost at iteration 517 : 7.94942102662015e-24
cost at iteration 518 : 8.288998132790141e-24
cost at iteration 519 : 7.530683365592622e-24
cost at iteration 520 : 7.880608916429161e-24
cost at iteration 521 : 7.316719426228324e-24
cost at iteration 522 : 7.836176886119179e-24
cost at iteration 523 : 7.565491741683666e-24
cost at iteration 524 : 8.623972262387716e-24
cost at iteration 525 : 8.008043916468711e-24
cost at iteration 526 : 7.850308110598894e-24
cost at iteration 527 : 7.699890724616702e-24
cost at iteration 528 : 7.442854451046264e-24
cost at iteration 529 : 7.45773308895614e-24
cost at iteration 530 : 7.346222376778029e-24
cost at iteration 531 : 7.496620612613466e-24
cost at iteration 532 : 7.703523992747876e-24
cost at iteration 533 : 8.806694442141847e-24
cost at iteration 534 : 7.909823800563621e-24
cost at iteration 535 : 7.973135266830171e-24
cost at iteration 536 : 7.51295254940079e-24
cost at iteration 537 : 7.586373287822326e-24
cost at iteration 538 : 7.277954664430643e-24
cost at iteration 539 : 7.54686384363979e-24
cost at iteration 540 : 7.437273561103972e-24
cost at iteration 541 : 8.340369001224536e-24
cost at iteration 542 : 7.87053488092415e-24
cost at iteration 543 : 7.766878313788732e-24
cost at iteration 544 : 7.561849481782181e-24
cost at iteration 545 : 7.285401128621374e-24
cost at iteration 546 : 7.34924485457382e-24
cost at iteration 547 : 7.153105124603377e-24
cost at iteration 548 : 7.384829082475271e-24
cost at iteration 549 : 7.407300753873126e-24
cost at iteration 550 : 8.612764914800576e-24
cost at iteration 551 : 7.808054085023556e-24
cost at iteration 552 : 7.831070652140296e-24
cost at iteration 553 : 7.456201450961622e-24
cost at iteration 554 : 7.375086752544841e-24
cost at iteration 555 : 7.231565800760723e-24
cost at iteration 556 : 7.280514913399261e-24
cost at iteration 557 : 7.406489770594734e-24
cost at iteration 558 : 7.844901041455167e-24
cost at iteration 559 : 8.153690181800896e-24
cost at iteration 560 : 7.300894256045878e-24
cost at iteration 561 : 7.788212934796453e-24
cost at iteration 562 : 6.857341410155916e-24
cost at iteration 563 : 7.538352535925466e-24
cost at iteration 564 : 6.724038865685958e-24
cost at iteration 565 : 7.540245035897763e-24
cost at iteration 566 : 6.891497089082911e-24
cost at iteration 567 : 8.490362131019625e-24
cost at iteration 568 : 7.93284852499434e-24
cost at iteration 569 : 7.484930697961693e-24
cost at iteration 570 : 7.62435987805963e-24
cost at iteration 571 : 7.021745495142171e-24
cost at iteration 572 : 7.364761760226972e-24
cost at iteration 573 : 6.912182853598512e-24
cost at iteration 574 : 7.460870561722787e-24
cost at iteration 575 : 7.423422278239133e-24
cost at iteration 576 : 8.206295131664638e-24
cost at iteration 577 : 7.186243973498339e-24
cost at iteration 578 : 7.675683723384848e-24
cost at iteration 579 : 6.730672408781484e-24
cost at iteration 580 : 7.450337905856431e-24
cost at iteration 581 : 6.561285546905567e-24
cost at iteration 582 : 7.429506666847053e-24
cost at iteration 583 : 6.629612525792018e-24
cost at iteration 584 : 7.97073084678101e-24
cost at iteration 585 : 7.922536276002556e-24
cost at iteration 586 : 7.521120199641165e-24
cost at iteration 587 : 7.456144994417707e-24
cost at iteration 588 : 7.086248068283383e-24
cost at iteration 589 : 7.1220037001534e-24
cost at iteration 590 : 6.902818808440557e-24
cost at iteration 591 : 7.11959092667606e-24
cost at iteration 592 : 7.113293822692934e-24
cost at iteration 593 : 7.977039581973752e-24
cost at iteration 594 : 7.323171477960519e-24
cost at iteration 595 : 7.370466094747482e-24
cost at iteration 596 : 7.045307680196176e-24
cost at iteration 597 : 6.951280836447903e-24
cost at iteration 598 : 6.863371161342301e-24
cost at iteration 599 : 6.842213954258551e-24
[ ]: