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