Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  removing model from program to clean memory

    Posted 05/30/12 12:53 PM

    Originally posted by: SystemAdmin


    I am implementing Lagrangian decomposition method for my problem. I am using concert to solve it. While implementing Lagrangian decomposition I had to create couple of models ( for example, IloModel Model1(env), IloModel Model2(env)) .After solving each model and getting objvalue I do not use them further. I am trying to remove the whole model, once I have obtained objvalue. I am using same decision variables for all those model. I am not sure how to remove those models from the program. If I use method like Model1.end(), it terminate the whole program. I also tried Model1.remove(objFunction), but it does not work. Basically I want to free the memory, after I have used the mdoel. Would you please tell me whether you have any idea about how to remove those models from the program after I have obtained objvalue from them?
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: removing model from program to clean memory

    Posted 05/30/12 06:58 PM

    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