Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Problem with IloModel::add(IloRange());

    Posted 10/18/12 08:56 AM

    Originally posted by: sana_


    Hi,

    I am solving a problem with a column generation. So, I populate it by columns.

    Then, I want to branch by adding dynamically somme constraints like this :

    IloRangeArray my_dynamic_constraints; // declared in the beginning of the program

    In each iteration : my_dynamic_constraints.add(IloRange(env, 1, Linear Expression Variables, 1, Name_Constraint));

    But when I export the lp file, no constraints are added !
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Problem with IloModel::add(IloRange());

    Posted 10/18/12 09:13 AM

    Originally posted by: sana_


    I forget say that In the beginning, I add the IloRange to the model : my_model.add(my_dynamic_constraints);
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Problem with IloModel::add(IloRange());

    Posted 10/19/12 08:50 AM

    Originally posted by: SystemAdmin


    I did not check the source code but I am pretty sure that IloModel::add(IloRangeArray()) is a shortcut for adding all the constraints in the array individually. That means that CPLEX will watch the individual constraints for updates/changes but it will not watch the array itself for updates/changes. So CPLEX will not be notified when you expand or shrink the array. To get things working you can try this
    IloRange r(env, 1, Linear Expression Variables, 1, Name_Constraint);
    cplex.getModel().add(r);       // add new range to model
    my_dynamic_constraints.add(r); // add range to array so that array always holds all the ranges.
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Problem with IloModel::add(IloRange());

    Posted 10/22/12 10:38 AM

    Originally posted by: sana_


    Thanks a lot !

    I rectify the error.

    When the IloRangeArray is increased, the modifications are not extracted in the model directly even this set of constraints are added to the model initially.

    So, in each iteration, I added the set of constraints to the model without using the ilorange array and it works perfectly.

    Thanks !
    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Problem with IloModel::add(IloRange());

    Posted 10/22/12 04:33 PM

    Originally posted by: sana_


    I have another question.

    When we change the coefficient if variables in the objective and constraints by using IloRangeArrayr1.setLinearCoef(variable, value) why the coefficient changes immediately in the IloModel but IloRangeArray.add(r2) didn't work and r2 is not added in the IloModel ?
    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Problem with IloModel::add(IloRange());

    Posted 10/23/12 06:09 AM

    Originally posted by: SystemAdmin


    The reason is the same as for your other question: When adding an IloRangeArray to a model then CPLEX will not watch the array itself but only the ranges that are contained in the array at the time you add the array.
    If you change a range that is contained in a model which is currently extracted to an IloCplex instance then CPLEX is watching that range and will apply any change to the range to the extracted model immediately.
    More precisely, the function that changes the range notifies the IloCplex instance about the change in the range so that the IloCplex instance can update the extracted model appropriately.
    More details about this can be found here and here.
    #CPLEXOptimizers
    #DecisionOptimization