esa / pygmo2

A Python platform to perform parallel computations of optimisation tasks (global and local) via the asynchronous generalized island model.
https://esa.github.io/pygmo2/
Mozilla Public License 2.0
422 stars 57 forks source link

[New user question] Pass options to ipopt #92

Closed a-jp closed 2 years ago

a-jp commented 2 years ago

I currently use pyomo, when using ipopt I can pass options to ipopt as follows:

solver = SolverFactory('ipopt')
opts = {'halt_on_ampl_error': 'yes',
           'tol': tolerance, 'bound_relax_factor': 0.0}
results = solver.solve(model, tee=False, options=opts)

When using pygmo I set up the ipopt solver like this:

prob = pg.problem(problem)
uda = pg.ipopt()
algo = pg.algorithm(uda)

How would I pass the same options to ipopt that I do when using pyomo?

Thanks, Andy

bluescarni commented 2 years ago

Hi @a-jp

you can set Ipopt's options after the construction of the uda object. See the docs here for some examples:

https://esa.github.io/pygmo2/algorithms.html?highlight=ipopt#pygmo.ipopt

a-jp commented 2 years ago

Thanks

bluescarni commented 2 years ago

Feel free to come over to the gitter channel the next time you have a question:

https://gitter.im/pagmo2/Lobby

Closing the report.