Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Reporting a bug

    Posted Thu July 04, 2013 07:11 PM

    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


  • 2.  Re: Reporting a bug

    Posted Mon July 15, 2013 02:23 AM

    How did you conclude that the time is spent in the two statements you mentioned? I am pretty sure that at least the running time of

    cost = IloObjective(env)

    should not change significantly between iterations. Does it help to do model.remove(cost) before doing cost.end()?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Reporting a bug

    Posted Mon July 15, 2013 03:08 AM

    Originally posted by: HadiUON


    Thanks Daniel,

    I just used the ctime library for calculating the loops' runtime and also those two statements.

    Even putting model.remove(cost) cannot solve the run-time issue.

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Reporting a bug

    Posted Tue July 16, 2013 01:30 AM

    I looked at your code example again. The statement

    cost = IloObjective(env)

    is redundant and will in fact cause a memory leak (cost will be overwritten by the subsequent cost = IloMaximize). So this statement must be removed. That leaves cost.end(). Does removal of this statement still make a significant difference?


    #CPLEXOptimizers
    #DecisionOptimization