Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  CPLEX redefining my model prior to solving

    Posted 01/19/12 03:06 PM

    Originally posted by: Khronum


    I have noticed that as soon as I define my model on a CPLEX object in MATLAB, CPLEX re-defines this model with extra variables and changes constraints in a way that I don't understand. This happens before I try to solve the problem (and with the pre-solver and aggregator deactivated).

    For example, if I define a binary linear programming problem as follows:
    
    cplex_obj.Model.obj   = f; cplex_obj.Model.A     = A ; cplex_obj.Model.lhs   = lhs; cplex_obj.Model.rhs   = rhs;
    

    where A is 1x4000 with:
    
    A(1,1) = 1; A(1,300) = 1;
    

    and:
    
    lhs = 0; rhs = 1;
    

    The first constraint should be:
    
    Subject to: c1: 0 <= x1 + x300 <= 1
    

    with
    
    Bounds 0 <= x1 <= 1 ... 0 <= x300 <= 1 ...
    

    and
    
    Binaries x1 .... x300 ... x4000
    

    But instead if I print the model, i.e.:
    
    cplex_obj.writeModel(
    'my_model.lp')
    

    I get:
    
    c1: x1 + x300 - x4001 = 0
    

    where the variable x4001 has regular 0<= x4001 <=1 bounds.

    With this, my questions are:

    1) What is the role of x4001? Where is it defined and why is this model equivalent to the original model?
    2) Is there a way to ask cplex to preserve the original constraints as they were originally defined?

    The above is with: Latest MATLAB version on 64 bit with CPLEX 12.3.
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: CPLEX redefining my model prior to solving

    Posted 01/19/12 03:39 PM

    Originally posted by: SystemAdmin


    This is an issue with the file format. The LP file format does not support ranged rows lhs <= ax <= rhs with both finite lhs and rhs. For this reason, CPLEX needs to add an explicit slack variable, in your case called "x4001", to transform the problem into an equivalent problem that can be represented in the LP file format.

    If you have lhs <= ax <= rhs, CPLEX will turn this into
    s := ax - lhs
    0 <= s <= rhs - lhs
    

    which is an equivalent representation.

    If you use the *.sav file format, the ranged row will be preserved. But since this is a binary format, you cannot view it with a text editor. But you can load it into the interactive CPLEX, and then use "display problem all" to see the content.
    Tobias
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: CPLEX redefining my model prior to solving

    Posted 01/22/12 01:41 PM

    Originally posted by: Khronum


    That explains it. Thanks!
    #CPLEXOptimizers
    #DecisionOptimization