Hi team Gurobi!
I would like to introduce a huge number of constraints in my model which permits to linearize the problem (about 18 million), but the loading in pyomo is very very slow (my code stops for a long time when generating them).
model.fj and model.lin are two binary variables: model.lin is equal to 1 only if the product model.fj [f,conn[c,1]] * model.fj [f,conn[c,2]] * model.fj [f,s] is equal to 1
f is defined in a range between 1 and 37
c is defined in a range between 1 and 1440
s is defined in a range between 1 and 384 (350 of non-zeros)
How can I manage the constraint in a better way?
def linearizzazione_rule(model, f, c, s):
if nu[s,1] != 0:
return model.lin[c,s] >= model.fj[f,connect[c,1]] + model.fj[f,connect[c,2]] + model.fj[f,s] - 2
model.linearizzazione_constr = Constraint(
model.FD, model.CL, model.SSN,
rule = linearizzazione_rule
Please sign in to leave a comment.