Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using indicator constraints in Julia

JuMP provides a special syntax for creating indicator constraints.So, Which one is better, linearizing the indicator constraints and then write a code or using this feature?

In order to constrain the constraint x + y <= 2 to hold when z binary variable a is one:

@variable(model, x)
@variable(model, y)
@variable(model, z, Bin)
@constraint(model, z => {x + y <= 2})

Actually my question is which one is faster and more efficient, To linearize ourselves or to use code?

like image 838
Python.py Avatar asked Nov 06 '22 01:11

Python.py


1 Answers

The answer is problem- and solver-dependent. You should try both approaches and time them to find out which is more efficient for your problem.

Some solvers (e.g., Gurobi) have special support for indicators, in which case it's probably faster to use the indicators directly. If you're using a solver that doesn't have special support for indicators, we convert the indicator constraint to a SOS-I constraint (https://jump.dev/MathOptInterface.jl/stable/submodules/Bridges/reference/#MathOptInterface.Bridges.Constraint.IndicatorSOS1Bridge).

The quality of a big-M type linearization will depend on using domain knowledge to select a good big-M. JuMP doesn't do big-M reformulations automatically.

like image 137
Oscar Dowson Avatar answered Nov 15 '22 06:11

Oscar Dowson