Hello,
I’m struggling to get the CRA solvers (cra_solve
; cra_penalty_solve
) from compas_cra working properly.
Provided sample scripts from compas_assembly, compas_dem, compas_cra or manually implementing the solver all raise the same error:
path\to\condaenvrionment\lib\site-packages\pyomo\opt\base\solvers.py", line 596, in solve
raise ApplicationError(
pyomo.common.errors.ApplicationError: Solver (ipopt) did not exit normally
exemplary log of the solver:
Starting equilibrium solve...
Aeq: (6, 12)
Afr: (32, 12)
1
1
--- set up time: 0.006998300552368164 seconds ---
finished setup... now trying to solve it...
Ipopt 3.14.9: linear_solver=mumps
tol=0.001
constr_viol_tol=0.0001
compl_inf_tol=0.0001
acceptable_tol=0.0001
acceptable_constr_viol_tol=0.01
acceptable_compl_inf_tol=0.01
ERROR: Solver (ipopt) returned non-zero return code (3221226505)
ERROR: See the solver log above for diagnostic information.
I’m on windows and manually copied the ipopt binaries into the respective environment folders as pointed out in the documentation. I tried with both the suggested ipopt versions 3.14.9 as well as the most recent 3.14.17, same issue with both.
I’ve gone back and forth between compas, python and pyomo versions that work with compas_cra as well.
I tried to change the d_bnd
and eps
values inside the cra_pyomo.py
as well as loosening tolerances in solver.options
, tried solvers mumps
, ma57
and ma27
.
The ipopt solver works as stand-alone script without calling it through compas_cra (chatgpt wrote this script):
import compas
from compas.geometry import Box, Frame, Translation
from pyomo.environ import ConcreteModel, Var, Objective, SolverFactory, minimize
support = Box(1, 1, 1)
free = Box(1, 1, 1, frame=Frame.worldXY().transformed(Translation.from_vector([0, 0, support.zsize])))
support_center = support.frame.point
free_center = free.frame.point
print("Support center:", support_center)
print("Free block center (initial):", free_center)
target = [support_center[0], support_center[1], support_center[2] + support.zsize]
print("Target position for free block:", target)
model = ConcreteModel()
model.x = Var(initialize=free_center[0])
model.y = Var(initialize=free_center[1])
model.z = Var(initialize=free_center[2])
model.obj = Objective(
expr=(model.x - target[0])**2 + (model.y - target[1])**2 + (model.z - target[2])**2,
sense=minimize
)
solver = SolverFactory('ipopt')
solver.options["tol"] = 1e-4
solver.options["constr_viol_tol"] = 1e-4
solver.options["compl_inf_tol"] = 1e-4
result = solver.solve(model, tee=True)
print("Solver result:", result)
print("Optimal free block center:")
print("x =", model.x.value)
print("y =", model.y.value)
print("z =", model.z.value)
print("Target was:", target)
I have little idea how to resolve the issue and am very thankful for any help.
Best,
Michael