Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Create Multidimensional IloIntMap

    Posted 06/24/12 07:07 PM

    Originally posted by: LuisGuimaraes


    I want to retreive and store in C++ the values of a OPL decision variable of type dvar int+ Psi[C]DemandTuplesEnd in 0..1 where C is an IntSet and DemandTuplesEnd is a TupleSet.

    I'm trying the following code:

    typedef IloMap<IloIntMap> IloIntMap2;

    IloIntVarMap Var = opl.getElement("Psi").asIntVarMap();

    IloIntSet ids = Var.getIndexer().asIntSet();

    IloIntMap2 sol (env, ids);

    for (IloIntSetIterator it1(ids); it1.ok(); ++it1){
    IloTupleSet ids2 = Var.getSub(*it1).getIndexer().asTupleSet();
    sol*it1 = IloIntMap(env, ids);
    for (IloTupleIterator it2(ids2); it2.ok(); ++it2){
    sol.get(*it1).set(*it2, cplex.getValue(Var.getSub(*it1).get(*it2)));
    }
    }

    I'm most likely doing this wrong. Can I have some help...
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Create Multidimensional IloIntMap

    Posted 06/25/12 02:52 AM
    Hi,

    I think you should have a look at the sample2 in iterators.cpp in the folder

    examples\opl_interfaces\cpp\src

    regards
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Create Multidimensional IloIntMap

    Posted 06/25/12 05:50 AM

    Originally posted by: LuisGuimaraes


    Hi Mr. Alex Fleischer,

    Thank you for your reply. I already had a look at sample2 in examples\opl_interfaces\cpp\src. However, my problem is not how to iterate through variable defined as a IloIntVarMap with more than one dimension. The problem is to store the current solution values of this variable in a IloIntMap with more than one dimension, since I'm not being able to create such a object.

    Best Regards
    Luis
    #DecisionOptimization
    #OPLusingCPLEXOptimizer