我不仅要获得 MIP 的最佳解决方案,还要获得 5 个最佳解决方案。我知道,如何让 Gurobi 保存 5 个最佳解决方案,但我不知道如何像使用最佳解决方案(见下文)一样访问它们,特别是 2 个决策变量的值x[i,j]
和y[j]
model.setParam(GRB.Param.PoolSearchMode, 2)
model.SetParam(GRB.Param.PoolSolutions, 5)
# ..... opt. model
if model.Status == GRB.OPTIMAL:
for j in jt:
print ('z[%f] = %f' %(j, y[j].x))
for i in ft:
for j in jt:
print ('x[%f,%f] = %f' %(i,j, x[i,j].x))
提前致谢!