【发布时间】:2021-12-08 23:44:57
【问题描述】:
我正在尝试在 pyomo 中解决以下问题:
为此,我定义了以下模型,并使用MindtPy 解决:
import pyomo.environ as pyo
model = pyo.ConcreteModel()
model.x = pyo.Var(domain=pyo.NonNegativeIntegers)
model.y = pyo.Var(domain=pyo.Binary)
model.constraint = pyo.Constraint(expr = model.x * model.y <= 10)
model.objective = pyo.Objective(expr = model.x * model.y - model.y, sense = pyo.maximize)
res = pyo.SolverFactory('mindtpy').solve(model)
返回的解是x=0, y=0,这显然是次优的(x=10, y=1 是最优解)。我不知道为什么求解器无法为这样一个(显然)简单的问题给出正确的结果,所以我怀疑我的模型中的某个地方有错误。知道这里发生了什么吗?
res 回溯如下:
{
"Problem":[
{
"Name":"unknown",
"Lower bound":7.494096406374967e-09,
"Upper bound":-5.2559467146445e-09,
"Number of objectives":1,
"Number of constraints":1,
"Number of variables":2,
"Number of binary variables":1,
"Number of integer variables":1,
"Number of continuous variables":0,
"Number of nonzeros":"None",
"Sense":"maximize",
"Number of disjunctions":0
}
],
"Solver":[
{
"Name":"MindtPyOA",
"Status":"ok",
"Message":"None",
"User time":0.07270376699943881,
"System time":"None",
"Wallclock time":0.07270376699943881,
"Termination condition":"optimal",
"Termination message":"None",
"Timing":Bunch(Call after main solve = 6.144000508356839e-06,
Call after subproblem solve = 2.660000063769985e-06,
OA cut generation = 0.0005902640004933346,
fixed subproblem = 0.01827019400025165,
initialization = 0.037425839999741584,
main = 0.005608348999885493,
main loop = 0.02800907599976199,
main_timer_start_time = 5267.784403186,
total = 0.07270376699943881),
"Iterations":1,
"Num infeasible nlp subproblem":0,
"Best solution found time":0.07225401699997747
}
]
}
【问题讨论】:
-
我用Gurobi解决了这个问题,解决方法还可以(
x=10, y=1, obj=9)。我不知道这是mindtpy错误还是mindtpy求解器不支持此类问题。你可以尝试在 Pyomo Github 中打开一个关于这个问题的问题吗?我对此很感兴趣。我会关注这个问题。谢谢 -
没试过 Gurobi,谢谢你的提示!打开了一个问题here
-
我不认为 MindtPy 是一个全局求解器。所以这可能发生。另一方面,Gurobi 是一个全局二次求解器。
-
在published paper 关于
Mindtpy他们声称,事实上,MIndtpy能够找到应用所引用的分解算法的全局最优值。...The methods implemented in this toolbox are designed to find the global optimal solution of convex MINLP problems.... — (Bernal et all, 2018) -
" 凸 MINLP问题"。非凸问题需要全局求解器。海报提出了一个非凸问题。
标签: python pyomo nonlinear-optimization