Originally posted by: SystemAdmin
IloModel::end() should work, I think. If it is crashing the program, my best guess would be to ask whether you first applied IloCplex::end() to the algorithm(s) that extracted the model. I'm not sure what happens if you reference an instance of IloCplex that extracted a now defunct IloModel. If that's not the problem, try surrounding IloModel::end() with a try-catch block to catch and print the (presumably thrown) exception.
You mentioned that you reuse your variables. Do you also reuse the constraints? If not, I think (not positive) that you will want to end them separately; I'm pretty sure ending the model does not end the constraints (and thus does not free their memory). This would not cause any crashes, just a memory leak.
Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
#CPLEXOptimizers#DecisionOptimization