我们可以在Pyomo中添加一个模型变量作为另一个变量的上限吗?

2024-09-30 14:33:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图在pyomo Concretemodel()中执行此操作,但我得到了以下错误:

 model.Smax = Var( within=PositiveIntegers )
 model.Z = Var(model.T, bounds=(0, model.Smax))


 ValueError: Non-fixed input of type '<class 'pyomo.core.base.var.SimpleVar'>' supplied as variable 
 upper 
 bound - legal types are fixed expressions or variables.parameters

我如何更改代码使其具有该上限?或者我应该对Z[t]的最大值使用约束

谢谢


Tags: ofinputmodelvartype错误pyomofixed