Setting parameters in pyomo

廉价感情. 提交于 2019-12-11 15:41:55

问题


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:


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


来源:https://stackoverflow.com/questions/48899924/setting-parameters-in-pyomo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!