Hi all,
I’m doing a pde constraint optimization. I have shared my minimal code below, I am getting a “Rounding errors prevent progress” error during optimization.
def optimization(chi, u0):
for i in range(len(max_disp)):
print("i:", i)
disp = Constant([0.0, max_disp[i]])
bcs, dss = bcs_(mesh, V_vector, disp)
u = Function(V_vector)
Ic, J_, v, F = kinematics(u)
# Stored strain energy density (compressible neo-Hookean model)
Psi = H(chi) * psi( Ic, J_, v, F)
# Total potential energy
Pi = Psi * dx
# Compute first variation of Pi (directional derivative about u in the direction of v)
dPi = derivative(Pi, u, v)
step_size = np.linspace(0, max_disp[i], 100)
solve(dPi == 0, u, bcs,
form_compiler_parameters=ffc_options)
stress = diff(Psi, F)
stress_calculation = (project(stress, W_tensor))
t = dot(stress, normal)
t = assemble(-t[1] * dss(1))
error += (t - f_desired[i]) ** 2
J =c1 * error + assemble( 0.5 * c2 * dot(grad(chi), grad(chi))) * dx)
control = Control(chi)
rf = ReducedFunctional(J, control)
problem = MoolaOptimizationProblem(rf)
f_moola = moola.DolfinPrimalVector(chi)
moola.BFGS(problem, f_moola, options={'jtol': 0,
'gtol': 1e-9,
'Hinit': "default",
'maxiter': 200,
'mem_lim': 10})(rf, method="L-BFGS-B",
tol=1e-50, options={"jtol": 1e-50,
"rjtol": 1e-50,
"gtol": 1e-50,
"rgtol": 1e-50,
"maxiter": 200,
"display": 2,
"maxcorint": 1e+1000000,
"line_search": "strong_wolfe",
"line_search_options": {"ftol": 1e-50, "gtol": 1e-50,
"xtol": 1e-1000,
"start_stp": 1},
"record": ("grad_norm", "objective"),
# method specific parameters:
"mem_lim": 100000,
"Hinit": "default",
})
sol = solver.solve()
f_opt = sol['control'].data
return f_opt
Does using IPOPT at this point affect the result? Since there was a download problem, I changed my minimization as below, but this time I cannot get iterate enough.
f_opt = minimize(rf, method="L-BFGS-B",
tol=1e-50, options={"jtol": 1e-50,
"rjtol": 1e-50,
"gtol": 1e-50,
"rgtol": 1e-50,
"maxiter": 200,
"display": 2,
"maxcorint": 1e+1000000,
"line_search": "strong_wolfe",
"line_search_options": {"ftol": 1e-50, "gtol": 1e-50,
"xtol": 1e-1000,
"start_stp": 1},
"record": ("grad_norm", "objective"),
# method specific parameters:
"mem_lim": 100000,
"Hinit": "default",
})
file = File(