How to obtain the solution transition using Casadi's Bonmin solver

85 Views Asked by At

I am using Casadi's Bonmin solver to solve MINLP problems. I want to use the callback function of casadi.opti to obtain the transition of the solution, but it doesn't work. If the solver is ipopt, the code below will work, but if I use bonmin, the transition of the solution will not be displayed.

import casadi as ca

opti = ca.Opti()

x1 = opti.variable()
x2 = opti.variable()

opti.set_initial(x1, 1)
opti.set_initial(x2, 10)

obj = x1**2 + x2**2
opti.minimize(obj)

opti.subject_to( x1*x2 >= 1 )

p_opts = {}
s_opts = {'print_level': 4}
opti.solver('ipopt', p_opts, s_opts)

opti.callback(lambda i: print(i, opti.debug.value(x1)))

sol = opti.solve()

How can I obtain the transition of the solution using bonmin? If anyone knows, please let me know.

I confirmed that the transition of the solution can be obtained by applying the callback function with the ipopt solver.

0

There are 0 best solutions below