-1

while linearizing some constraints containing divisions, I founda formulation which works and is interpreted as linear by Pyomo, and I absolutely have no idea why:

mod.coupling_temp2[m]*sum(mod.same_service[o1, o2, m] for o1, o2 in product(mod.OPERATIONS, mod.OPERATIONS)) == mod.sum_similarities[m]

Coupling_temp2 and sum_similarities are real numbers, while same_service is a binary. Shouldn't a multiplication of variables always be considered nonlinear? Everytime I tried to express a constraint as a multiplication of variables, even if they're binaries, I always get told the constraint is nonlinear, but maybe I'm tripping.

Unziello
  • 103
  • 8
  • I am no expert in Pyomo, but products of binary variables can be easily linearized. Maybe Pyomo or the solver you are using under the hood is doing that for you here? You could look at the solver log and/or the size of the original and presolved model to get an idea whether a lot of auxiliary variables are added. Another option might be that the solver manages to get rid of all the products in presolve for some reason. To know for sure you could ask to export the model as MPS and then look close at what exactly the model looks like. – Daniel Junglas Sep 13 '21 at 12:48

1 Answers1

0

In general, what you have written is not linear. However, the solver interface can see it as linear if:

  • you have fixing either the coupling_temp2 or same_service variables (i.e., one is no longer a free variable and is therefore treated as a constant)
  • OPERATIONS is an empty set (a sum over the cross product of an empty set is 0).

That said, several "linear" solvers (like Gurobi and Cplex) can solve QPs: it is also possible that the problem is quadratic and that the solver is OK with it.

jsiirola
  • 2,259
  • 2
  • 9
  • 12