Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only

Changing Multiple constraints help

  • 1.  Changing Multiple constraints help

    Posted 02/11/12 04:51 PM

    Originally posted by: DavePSU


    So I have this model that runs fine but I would like to modify the LB or UB of certain constraints with each iteration. The syntax looks like this:

    var MODELQ = MODEL;
    MODELQ.generate();
    subCplex.solve();

    for ( b in thisOplModel.F){
    for ( c in thisOplModel.H){
    if (MODELQ.Q1[b][c][T] == 0){
    MODEL.ChangeQ1D[b][c][T].UB = 0;
    }
    else{
    MODEL.ChangeQ1[b][c][T].LB = 1;
    }
    if (MODELQ.Q2[b][c][T] == 0){
    MODEL.ChangeQ2D[b][c][T].UB = 0;
    }
    else{
    MODEL.ChangeQ2[b][c][T].LB = 1;
    }
    }
    }

    So the first if statement is checked and for the current data it is true so it sets the UB for b = 1, c = 1, T = 1 to 0. The program then checks the second IF statement and an error comes up (No Solution Exists), which I think is due to me trying to change more than one constraint before I solve the model again. I have included a solve statement in the first IF statement and it works. The problem is I do not want to solve a bunch of models that I do not need to and I am hoping there is an easier way to change multiple constraints between solves.

    Any help would be awesome.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer