Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  L-shaped method

    Posted 06/28/18 05:02 PM

    Originally posted by: Mahdi-N


    Hi,

     

    I am trying to implement the integer L-shaped method. I have used both lazy constraint and user defined cut functions, however, no luck so far.

    For Lazy constraint, I get the same solutions every two iterations and also after few iterations it stops and gives me some solution which is not optimal.

    For user defined, after even fewer iterations, I get some solution which is not optimal.

    Anyone knows whether I am making some mistake or there is problem with these two functions for L-shaped method?

     

    Thanks, 

    Mahdi


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: L-shaped method

    Posted 06/29/18 01:47 AM

    Most likely using only user-defined cuts is wrong since those things cut off integer feasible solutions. For this kind of thing you need lazy constraints. Are you sure your code is correct? For example, is the optimal solution triggered by something that should have been cut off but was never presented to the lazy constraint callback?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: L-shaped method

    Posted 06/29/18 11:46 AM

    Originally posted by: Mahdi-N


    Thanks Daniel,

    I have not worked with CPLEX like this for a long time and forgotten some bits. 

    I have a simple optimality cut which is based on Laporte and Louveaux 1993. The procedure is as follows:

    1) build the master model

    2) invoke cplex.use(BendersLazyCallback(...))

    3) in the lazy cut function a function gets the solution of the second stage problems.

    4) The following optimality cut is formed and added: 

    add(optcut-(exp_cost-LB)*(w_sumcut1-w_sumcut0)+(exp_cost-LB)*(n_ones-1)-LB>=0).end();

    where optcut is a variable added to the master problem obj function, LB is the lower bound and here is 0 and exp_cost is the expected cost of the second-stage problem. 

     

    In addition to repeated solutions, another problem is that when the algorithm stops after the pre-set number of iterations, I get a solution which is not right.

    Meaning that it only gives the objective function value of the master problem without optcut i.e., the objective of the second stage problem is ignored.

     

    What is wrong here?

     

      


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: L-shaped method

    Posted 06/29/18 04:02 PM

    When you say "optcut is a variable added to the master problem obj function", do you mean optcut was added to the master objective when the master was formulated (before calling solve on it), or do you mean the callback tries to add optcut to the master objective. The latter is illegal, unsupported, and likely to cause the collapse of the space-time continuum. If the former, when you say CPLEX ignores it, are you saying CPLEX does not give a value for it, or that the value given is zero?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: L-shaped method

    Posted 06/30/18 01:04 PM

    Originally posted by: Mahdi-N


    Thanks Paul,

    This variable is initially defined in the master problem and is added to the objective function.

    Then it is called in the callback function.

    Its value is zero. Can it be related to the number of iterations? meaning that I need to run the code for more iterations?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: L-shaped method

    Posted 06/30/18 02:36 PM

    Try removing ".end()" from the line that adds the cut (item 4 above). The return value of add() is a pointer to the added constraint. If you end that, I think in effect you are deleting the constraint that you just added.

    If that's not the problem, substitute the solution into the constraints (including the lazy constraints) and check whether any of them actually forces optcut to take a positive value.


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: L-shaped method

    Posted 07/01/18 04:37 AM

    Originally posted by: T_O


    Just out of curiosity: Do any variables in the second stage have upper bounds?


    #CPLEXOptimizers
    #DecisionOptimization