Setting parameters in pyomo

2019-09-01 04:42发布

I am using CPLEX with pyomo. I would like to set the parameter mip.limits.solutions = 1. How to do this with either .options( or .set_options( or any other way?

I have tried the following but nothing works:

   from pyomo.environ import *

   opt = SolverFactory("cplex")

   opt.set_options('miplimitssolutions=1')  # does not work
   opt.set_options('mip.limits.solutions=1')  # does not work

   opt.options['mip'] = 'limits'  # this works up to here but how to continue?

1条回答
男人必须洒脱
2楼-- · 2019-09-01 05:17

Pyomo's (LP file-based) CPLEX interface passes options using CPLEX's "Interactive" API. In this case, the interactive version of that option is "mip limits solutions":

from pyomo.environ import *
opt = SolverFactory("cplex")
opt.options['mip limits solutions'] = 1
查看更多
登录 后发表回答