Originally posted by: Maichel_Aguayo
Hello,
I want to solve a main model, and then copy it and create two sub-problems (in different environments IloEnv) so that new variables and constraints can be added to the sub-problems in addition to the one copied from the original model. Once the main model is copied, it has to be deleted to free memory (it wont be used again).
As example consider the main problem; max: x1 + 2 x2 + 3 x3 + x4, Subject To - x1 + x2 + x3 <= 20 and x1 - 3 x2 + x3 <= 30, and 0 <= x1 <= 40.
This problem is defined in the environment denoted by env_root. Then, this model (variables and constraints) needs to be copied into two different sub-problems (each one in different environment: env_node1 and env_node2) . After copying the main model, it is deleted. Furthermore, new variables and constraints will be added to the sub-problems as indicated:
1). Sub-problem 1: Add the variable "x5" and the constraint "x1+x3<=40". This sub-problem should look like this: Maximize x1 + 2 x2 + 3 x3 + 5x5, Subject To - x1 + x2 + x3 - x5 <= 20, x1 - 3 x2 + x3 - 2 x5 <= 30, x1+ x3 <= 40, x5 <= 4..
2). Sub-Problem 2: Add the variable "x6" and the constraint" x1+ x6 <=40". This one should be: Maximize x1 + 2 x2 + 3 x3 + 6x6, Subject To, - x1 + x2 + x3 - x6 <= 20, x1 - 3 x2 + x3 -3 x6 <= 30, x1+ x6 <=40", 0 <= x1 <= 40, and 0 <= x6 <= 6.
I have the following problems:
a). By deleting "env_root" my program crashes. However, if "env_root" is not deleted, then it runs. How should I define the new environments so that "env_root" can be deleted?
b). Coefficients to the objective function for the new variables cannot be added. For instance, for sub-problem 1, the coefficient of the new variable "x5" does not appear in the model (see Node1.lp file). The same occurs in Sub-problem 2 ( Node1.lp) . How should it be done?
c). Constraints involving the new variables cannot be defined. For instance, "x1+x6 <=30" cannot be added to the sub-problem 2.
I am using CPLEX_Studio 12.5.1 in concert with c++. Attached are my code, and lp files for the main model and sub-problems.
I am implementing a branch-and-price algorithm using Cplex as a LP solver, and this routine will be executed every time I need to branch.
Thanks for your answers,
Maichel
#CPLEXOptimizers#DecisionOptimization