pythonmathematical-optimizationsolverpyomoglpk

Specify the mip_solver corresponding executable while using gdpopt pyomo


Can someone help me with the following? I need to specify the path to the executable solver when using gdpopt in pyomo

Normally for glpk solver one can specify this path in SolverFactory as:

executable_path = '/home/user/lib/glpsol'

opt = SolverFactory('glpk',executable=executable_path)

But this desn't work if I want to use gdpopt and specify the executable of glpk in the same way as in the following example:

opt = SolverFactory('gdpopt',executable=executable_path)

I have tried using the mip_solver_args parameter as follows but I had no luck.

opt = SolverFactory('gdpopt')

results = opt.solve(model, mip_solver='glpk', mip_solver_args={'executable':executable_path})

Finally, I tried the same with the cbc solver but still no luck


Solution

  • The current solver parameters for GDPopt don't allow for specifying the executable argument in the SolverFactory call. I don't have the bandwidth right now to go through the PR process for a new solver option, but the benefit of open-source is that you can modify your installation of Pyomo to include the desired executable= argument.

    You will need to search for SolverFactory calls made in the mip_solve.py file: https://github.com/Pyomo/pyomo/blob/main/pyomo/contrib/gdpopt/mip_solve.py. This file should be responsible for any MIP subsolver calls that GDPopt makes. From there, you can change the SolverFactory calls in the file to include your executable=executable_path for glpk or cbc, respectively, as you wish.