Gebbran
Gebbran

Reputation: 21

Changing Bonmin options (IPOPT linear solver) within Pyomo

I am using Bonmin through Pyomo/Python, on an Windows machine. Bonmin is being using via binaries, and HSL solvers as well. I could change the default solver successfully for Bonmin but IPOPT is still using MUMPS as a linear solver.

I've tried including a bonmin.opt file within the folders (Bonmin's executable or the .py file) but it is not interpreted by Pyomo.

For assigning the linear solver to Bonmin, I use the command line below:

solver.options['linear_solver'] = 'ma27'

For assigning the linear solver to IPOPT within Bonmin, I tried many different commands but could not find any that worked. Examples include:

solver.options['ipopt.linear_solver'] = 'ma27'

solver.options['ipopt_linear_solver'] = 'ma27'

As well as many other different syntax. I have searched throughout Bonmin's and IPOPT's manuals but I still get the same warning if the syntax is accepted:

NOTE: You are using Ipopt by default with the MUMPS linear solver. Other linear solvers might be more efficient (see Ipopt documentation).

Otherwise, the syntax isn't even accepted.

Do you have any suggestions?

Upvotes: 2

Views: 1492

Answers (1)

gmavrom
gmavrom

Reputation: 440

According to the BONMIN documentation here, if you want to set options for Ipopt (when used inside BONMIN) you have to set them in the file bonmin.opt.

Something like this could, hop

import pyomo.opt
with pyomo.opt.SolverFactory("bonmin") as solver:
    solver.options.option_file_name = "bonmin.opt"
    with open("bonmin.opt", "w") as f:
        # f.write() # Here you can specify options for BONMIN using the "bonmin." prefix
        f.write("linear_solver ma27\n") # This is the IPOPT option
    solver.solve(model)

More information about option files for IPOPT can be found here.

Upvotes: 0

Related Questions