1 comment

• Gurobi Staff

Hi Gianluca,

There is no good way to reformulate the constraint. The problem is that each variable holds a different index, i.e., even if the constraint would read $$x_{c,s} \geq x_{f,c}\cdot x_{f,s}$$, you would still need the 18 million constraints, because you have to iterate over all $$c,f,s$$ combinations. Adding a large number of constraints almost always results in long construction times. However, you could try some of the following:

• Reduce the number of $$c$$ indices
• You could try to perform some presolving on your own, i.e., you could try to determine whether some of the variables are 0 or 1 if you have some additional knowledge
• You could generate the model once and write it to an MPS or LP file, see Model.write(). Subsequently, you can compress the file with, e.g., $$\texttt{bz2}$$, and read the model  instead of constructing the model every time

Best regards,
Jaromił