Originally posted by: open_ball
Hi,
I am creating a Benders framework in Java API and was wondering if the way that I plan to update the sub problem seems reasonable.
I create two maps in which the constraints and their right hand sides are stored.
HashMap<ArcTime, IloRange> constraintSet;
HashMap<IloConstraint, IloNumExpr> RHS;
Then, I fill both maps as;
constraintSet.put(arcTime, (IloRange) cplex.addLe(subVariable,0));
RHS.put(constraintSet.get(arcTime) , cplex.prod(bound.get(arc), masterVariable));
Is this a correct way to proceed to sub problem to avoid regenerating the LP model? Also, is there a more efficient way that would decrease the computation time of this operation?
In addition to this, I have another question. After getting responded at here, I defined masterVariable as
IloNumVar masterVariable= cplex.numVar(0,bound.get(arc));
cplex.add(masterVariable);
master.put(arc, masterVariable); \\HasMap<arc,IloNumVar> master = new HashMap<arc,IloNumVar>();
Now, when I enter into the lazy call back function, I need to reach the values of all masterVariable. From the example provided by CPLEX, I can see that I should use
context.getCandidatePoint(master );
However, master is defined as a HashMap, not as an IloNumVar instance. How can I solve this issue? Should I iterate thru the map and parse each variable one by one? or is there a more straight forward way?
#CPLEXOptimizers#DecisionOptimization