It means you must create a deep copy. As you can read in the documentation, classes like IloModel are only just handles to the actual model object. If you do something like
IloModel model1 = IloModel(env);
IloModel model2 = model1;
Then you create only one model with two references to it. You can imagine the IloModel class to be defined someting like this:
class IloModel {
IloModelI *modelI;
};
The "real" model object is the IloModelI (note the 'I' at the end of the name) instance to which the IloModel instance points. If you just do model2 = model1 then this will just copy the modelI pointer field, not the model. So you will have model1->modelI == model2->modelI, i.e., model1 and model2 point to the same object. That is why any modification done through model1 is also visible in model2.
What you need is a deep copy, i.e., create a new model that is a copy of the old one.
#CPLEXOptimizers#DecisionOptimization