Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Conflict Refiner in CP Optimizer

    Posted Tue June 26, 2018 03:03 AM

    Originally posted by: SaumyaB


    Hi,

    I have a model that has 4 constraints C1, C2, C3 and C4. C4 is a constraint that causes infeasibility in some problem instances (as it involves setting an upper bound on an expression. What I would like to do is use conflict Refiner and every time there is a conflict, increase the upper bound by 1 and then use C4 with this updated value. Here is a partial code of the same:

    // Check for conflict

    if(cp.refineConflict())  {
            //Model is infeasible
            cp.writeConflict(cp.output());
            System.out.println("Conflict found. Increasing limit");
             upperbound = upperbound + 1;

             // Remove the original C4 constraint add it again with the updated limit value

    }

    I am not sure on how to remove C4 (with original upper bound) and add C4 with the updated upper bound value and do so in an iterative manner. 

    Any help on this is greatly appreciated. Thanks.


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Conflict Refiner in CP Optimizer



  • 3.  Re: Conflict Refiner in CP Optimizer

    Posted Wed June 27, 2018 02:46 AM

    Originally posted by: SaumyaB


    Hi Alex,

     

    Thanks for providing the example link. I am using CP Optimizer with Java and CPLEX 12.7.1. But I am unable to find an equivalent function in Java API to access and set the upper bound on the right hand side of the constraint (as done in OPL in the line thisOplModel.GasUb[i].UB=5). I do see the function cp.getObjBound() for accessing the bound on objective though.

     

     


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Conflict Refiner in CP Optimizer

    Posted Wed June 27, 2018 02:56 AM

    Hi,

    what you can do in OPL can be done in other APIs

    Have you tried setUb and setLb on IloRange ?

    regards


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Conflict Refiner in CP Optimizer

    Posted Wed June 27, 2018 08:21 AM

    Originally posted by: GGR


    Hi

     

    It is not possible in constraint programming to <<remove>> a constraint from a model. The trick that gives you Alex is in fact a de facto rewriting of the model.The changing of coefficient using OPL because is a Linear Programming facility which is not available in CP Optimizer stand alone.

     

    So to change your constraint in Java you have to end the previous model and then create a new one ignoring the obsolete constraint (gas <= infinity)  but adding the  new constraint (chloride - gas < 5). Note that is the same thing for C++, .Net and Python.

     

    Hope that helps.


    #CPOptimizer
    #DecisionOptimization