0

What is the best way to specify whether a given variable is within a given range in Pyomo? Here I have a binary decision variable assign[t, e] which I want to fix it 0 when t is within some range specified as below. I read that this might not be the best way to do so and might cause solvers to violate this constraint. Is that the case?

def rule1(model, t, e):
   if t < model.start[e] or t >= model.end[e]:
            return model.assign[t, e] == 0
        else:
            return pyo.Constraint.Skip
    model.rule1 = pyo.Constraint(model.times, model.elements, rule=rule1)
Filkata22
  • 11
  • 4

0 Answers0