I am coding a decomposition algorithm including scenario subproblems. I need to use model pointer to create subproblem optimization models. Then, it is needed to modify the objective function coefficient of each subproblem as the algorithm proceeds. I need to use pointers to avoid creating the subproblem models every time from scratch. How should I do that? Can I use this:
Then, is it correct to keep pointers to the implementation instances for each scenario subproblem like the followings:
Thank you much, asked 09 Oct '15, 12:02 ORSE
showing 5 of 6
show 1 more comments

If subproblems differ only in the objective function, you wouldn't need to keep an array of models and objective functions. Simply, define a single model for the subproblems and then update its objective function for each subproblem. To do so, you might remove the objective function of the subproblem model and add it again (see lines 571587 of ilobendersatsp.cpp) or update the objective function using the setExpr() method (e.g.,
spObj.setExpr(newObjExpr);
).Thank you for your reply. Due to sceanrios, subproblems differ also in their constraints. Also, each subproblem needs to be modified by changing the objective function coefficients during the main algorithm process.
Do the subproblems differ in structure and/or coefficients?
https://www.orexchange.org/questions/12859/unhandledexceptionerrorcwhenusingpointerofobjectsilomodelandiloobjectivesetlinearcoefs.
Yes, coefficient matrix of each scenario sub problem is different. After making model pointer for each subproblem, the only thing that will change for each subproblem is the objective coefficients.
Have you tried keeping models of subproblems in an IloArray object, instead of using pointers?