Is it possible model variational problems such as
minimize f(u) subject to a(u) = L (and u>=0)
using tao solvers via dolfin compiled with petsc3.5?
How can I put the equality constrains a(u)=L, its gradient and
hessian on tao solvers with dolfin?
The new example of demo folder in dolfin1.5 demo_buckling-tao.py of Tianyi Li
call the tao solver direct with dolfin. But there is only the objective
function without constrains.
from dolfin import *
if not has_petsc_tao():
print("DOLFIN must be compiled at least with PETSc 3.5 to run this demo.")
exit(0)
def __init__(self):
OptimisationProblem.__init__(self)
# Objective function
def f(self, x):
u.vector()[:] = x
return assemble(elastic_energy)
# Gradient of the objective function
def F(self, b, x):
u.vector()[:] = x
assemble(grad_elastic_energy, tensor=b)
# Hessian of the objective function
def J(self, A, x):
u.vector()[:] = x
assemble(H_elastic_energy, tensor=A)
solver = PETScTAOSolver()
solver.parameters["method"] = "tron"
solver.parameters["monitor_convergence"] = True
solver.parameters["report"] = True
solver.solve(BucklingProblem(), u.vector(), u_min.vector(), u_max.vector())
How can I put some (PDE equality optimization) constrains via tao with dolfin?
( Now the new rosembrok.py classical equality constrain optimization example from demo petsc4py3.5 folder call directly tao solvers. )