I am interested to know whether there are any performance overheads for specifying Pyomo Constraints in different ways. For example, which of the two ways is better? I am trying to speed up one of my models who uses the second option. Can someone provide more information?
Option 1:
def teaOKrule(model):
return(model.x['butter'] + model.x['scones'] == 3)
model.TeaConst = Constraint(rule=teaOKrule)
Option 2:
@model.Constraint(model.s)
def hello_wor(model, i, j):
return model.s[i, j] <= model.b[i, j]