'Invalid constraint expression in Pyomo
I have the attached coding but I am getting the following error:
ERROR: Rule failed when generating expression for Constraint LimiteCCS_constraint with index COL: ValueError: Invalid constraint expression. The constraint expression resolved to a trivial Boolean (True) instead of a Pyomo object. Please modify your rule to return Constraint.Feasible instead of True.
Error thrown for Constraint LimiteCCS_constraint[COL]
Could you help me in how to correct this?
The attached code is:
model.CCSFactor = Param(model.REGION, default=0)
model.CCSTagTecnologia = Param(model.REGION, model.TECNOLOGIA, model.YEAR, default=0)
def CCSActividad_rule(model,r):
return ( sum(model.ActividadTotalTec[r, k, y]*model.CCSTagTecnologia[r, k, y]
for k in model.TECNOLOGIA for y in model.YEAR)
== model.CCSActividad[r] )
model.CCSActividad_constraint = Constraint(model.REGION, rule= CCSActividad_rule)
def LimiteCCS_rule(model, r):
return model.CCSActividad[r]*model.CCSFactor[r] <= model.LimiteCCS[r]
model.LimiteCCS_constraint = Constraint(
model.REGION, rule=LimiteCCS_rule)```
Thanks in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
