Originally posted by: HadiUON
Hi experts,
I found something unusual in Cplex or maybe there is something that I'm not aware of it. I found out ending the objective function is so costly. For example assume that you have an LP model and different objective functions (Obj_i) which you want to solve your model for each of them.
Suppose the "cost " as follows:
IloObjective cost(env);
Consider the following loop which is based on the number of objective functions:
Loop{
cost.end();
cost=IloObjective (env);
cost = IloMaximize(env, obj_i);
model.add(cost);
cplex.extract(model);
cplex.solve();
model.remove(cost);
cplex.clear();
}
In my instances , this loop terminates after 5000 iterations. My instances have only 80 decision variables. The runtime of this loop was 250 seconds which 230 seconds is because of the first two commands, i.e. :
cost.end();
cost=IloObjective (env);
To me it is something unusal. What I did to fix it is just removing the above two commands from the loop. However, I'm not sure whether or not it is a good idea. Is this a bug? If yes, What should we do to fix it to not facing a memory leak?
Thanks
#CPLEXOptimizers#DecisionOptimization