小编kab*_*lla的帖子

如何使用PuLP的Gurobi求解器设置MIP启动(初始解决方案)?

我正在使用PuLPPython中的模块来制定混合整数程序.我试图找出如何MIP start通过PuLP接口设置(即程序的可行解决方案).

这里MIP start给出如何设置的详细信息

PuLP软件包的开发人员声称您可以通过此处PuLP界面访问完整的Gurobi模型

贴在下面是两个完整的模型.我已经使这些尽可能小,同时防止gurobi求解器使用启发式找到最佳值.

我试图在两个模型中设置初始解决方案(到最佳值),但在PuLP模型中它被忽略,但在gurobipy模型中它按预期工作.

如何通过PuLP接口为Gurobi解决方案设置初始解决方案?

from pulp import *

prob = LpProblem("min example",LpMinimize)

x1=LpVariable("x1",0,None,LpInteger)
x2=LpVariable("x2",0,None,LpInteger)
x3=LpVariable("x3",0,None,LpInteger)
x4=LpVariable("x4",0,None,LpInteger)

# Objective function
prob += 3*x1 + 5*x2 + 6*x3 + 9*x4

# A constraint
prob += -2*x1 + 6*x2 -3*x3 + 4*x4 >= 2, "Con1"
prob += -5*x1 + 3*x2 + x3 + 3*x4 >= -2, "Con2"
prob += …
Run Code Online (Sandbox Code Playgroud)

python mathematical-optimization gurobi integer-programming pulp

7
推荐指数
1
解决办法
5401
查看次数