Originally posted by: BerkUstun
I'm currently working on a MIP where I use a Big M formulation to set an indicator variable equal to 0 or 1. After reading the CPLEX 12.4 manual, I found out that we could use indicator constraints in order to avoid numerical problems and possibly speed up the solver.
Unfortunately, I'm a little confused on how to set this up so I was hoping that someone could help me by explaining how to incorporate a very simple constraint that I've outlined below.
The constraint is:
z = 1 if 1*x_1 -2*x_2 + 5*x_3 < 0
z = 0 if 1*x_1 -2*x_2 + 5*x_3 >= 0
where:
-
z is a binary variable that I want to add to my LP
-
x_1, x_2 and x_3 are integer variables that are already included in my LP and that have ub/lb = 25/-25
As it stands, I am currently
not using the addRows and addCols methods to create my model. Instead, I'm building matrices and vectors for the constraints and variables (A, rhs, lhs, ub, lb, ctype) and then using a small script such as:
LP = Cplex()
LP.Model.A = A;
LP.Model.rhs = rhs;
LP.Model.lhs = lhs;
LP.Model.ub = ub;
LP.Model.lb = lb;
LP.Model.ctypes = ctype;
LP.solve
If there is any way to use indicator constraints and still build my model like this I would really appreciate knowing that too.
#CPLEXOptimizers#DecisionOptimization