这个文件用python和pyomo编写,使用ALNS算法优化MINLP铁路网络模型(适用于马德里的网络)。一切正常,但我在这个函数中出错:
def solveFO(instance):
opt = SolverFactory(str(solver))
results = opt.solve(instance, tee=True)
instance.load(results)
return float(results.Solution.Objective.__default_objective__['value'])
输出和错误:
^{pr2}$提前感谢您的帮助!在
既然已经声明了
model.obj = Objective()
,那么就可以使用value(model.obj)
来获取目标的值相关问题 更多 >
编程相关推荐