Код: Выделить всё
import pyomo.environ as pyo
model = pyo.ConcreteModel()
model.x = pyo.Var(range(2), domain=pyo.Reals)
model.Constraint2 = pyo.Constraint(expr=sum([x for x in model.x]) >= 0)
Код: Выделить всё
ValueError: Invalid constraint expression. The constraint expression resolved to a trivial Boolean (True) instead of a Pyomo object
Код: Выделить всё
model.Constraint2 = pyo.Constraint(expr=model.x[0] + model.x[1] >= 0)
Подробнее здесь: https://stackoverflow.com/questions/793 ... esolved-to