Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 11/25/12 07:49 PM

    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


  • 2.  Re: Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 11/26/12 02:28 AM

    Originally posted by: SystemAdmin


    I think that Cplex.addIndicators is what you are looking for.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 11/26/12 11:49 AM

    Originally posted by: BerkUstun


    Thanks!

    I've read through the function but I have a quick follow-up quesiton.

    Going back to my example, say that I define a variable z as follows:

    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

    In other words, z takes on a value of 1 if a constraint has a negative rhs and 0 if a constraint has a positive rhs.

    I am wondering if I should be adding a single indicator constraint to my LP to define z as shown above. Or, should I be adding two separate indicator constraints to my LP (the first one would be complemented with a sense of "L" and the second constraint would not be complemented with a sense of "G").
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 11/28/12 02:58 AM

    Originally posted by: SystemAdmin


    Formulating a strict "less than" condition is always dicey since the mathematical theory behind integer programming does not support that. So a strict <b has always be turned into something like <=b-eps with a small eps. So you should avoid using < constraints if possible.
    Does your variable z appear in the objective function? In that case you can probably get away with a single indicator constraint that only forces z to under certain conditions. If those certain conditions are not satisfied then z will always be 0 in an optimal solution (assuming that z has a positive coefficient in the objective function).
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 11/26/12 11:52 AM

    Originally posted by: BerkUstun


    One other follow-up question: I can see how indicator constraints can prevent numerical issues that arise from the big M formulation. However I'm wondering whether they are also likely to yield a computational benefit of some sort?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 11/28/12 02:56 AM

    Originally posted by: SystemAdmin


    Indicator constraints are a more "explicit" formulation of constraints that may help CPLEX in presolve or during branch and bound. However, whether this actually makes a difference for a particular problem instance depends on the problem instance.
    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: Defining an indicator variable for an MIP using CPLEX 12.4 for MATLAB

    Posted 12/03/12 12:41 AM

    Originally posted by: BerkUstun


    Thanks for your help!

    I implemented the indicator constraints but they did not speed up the execution of my MIP.

    In this case, using the indicator constraints did not speed up my MIP. I think this is because I have 400 indicator constraints in my MIP, which has 425 total constraints. The faster problem in my example has about 800 Big-M style constraints with ~825 total constraints.
    #CPLEXOptimizers
    #DecisionOptimization