Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Deleting IloSolution object

    Posted 05/15/08 08:51 AM

    Originally posted by: SystemAdmin


    [Sylvain said:]

    I would like to use IloSolution objects in my program and I need to delete them.
    But the method IloSolution::end() does not seem to work as I expected.
    The following code prints out
    24048
    28056
    36072
    36072
    36072
    36072
    on my computer.
    I would expect the memory usage to decrease after deleting the IloSolution and re-increase after recreating the object but it doesn't. Any explanations ?

    IloEnv env;
    IloIntVarArray X(env, 100, 1, 100);
    IloSolution sol;
    for(IloInt i = 0; i < 2; i++) {<br /> env.out() << env.getTotalMemoryUsage() << endl;<br /> sol = IloSolution(env);
    env.out() << env.getTotalMemoryUsage() << endl;<br /> sol.add(X);
    env.out() << env.getTotalMemoryUsage() << endl;<br /> sol.end();
    }


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Deleting IloSolution object

    Posted 05/15/08 01:53 PM

    Originally posted by: SystemAdmin


    [shaw said:]

    It could be an issue about how small blocks are counted within Concert.
    Your code does not appear to leak, so everything appears to be fine.
    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Deleting IloSolution object

    Posted 05/15/08 08:57 PM

    Originally posted by: SystemAdmin


    [Sylvain said:]

    I have another code that might help understanding the problem I am facing:

    IloEnv env;
    IloSolution sol;
    IloIntVarArray X;
    for(IloInt i = 0; i < 4; i++) {<br /> env.out() << env.getTotalMemoryUsage() << endl;<br /> X = IloIntVarArray(env, 100, 1, 100);
    env.out() << env.getTotalMemoryUsage() << endl;<br /> sol = IloSolution(env);
    env.out() << env.getTotalMemoryUsage() << endl;<br /> sol.add(X);
    env.out() << env.getTotalMemoryUsage() << endl;<br /> sol.end();
    env.out() << env.getTotalMemoryUsage() << endl;<br /> X.end();
    }

    This code returns:

    16032
    24048
    28056
    36072
    36072
    36072
    40080
    40080
    40080
    40080
    40080
    48096
    48096
    48096
    48096
    48096
    52104
    52104
    52104
    52104

    The memory keeps increasing I guess because of the creation of new variables even though I am deleting them at the end of the loop.
    I am using Ilog Concert 2.3.
    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Deleting IloSolution object

    Posted 05/16/08 12:19 PM

    Originally posted by: SystemAdmin


    [shaw said:]

    Hello Sylvain,

    To get rid of all the variables, you need to do:

      for (IloInt j = 0; j < X.getSize(); j++)<br />    X[j].end();
      X.end();

    I think that should demonstrate that there no leaks.


    Paul
    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Deleting IloSolution object

    Posted 05/16/08 07:33 PM

    Originally posted by: SystemAdmin


    [alain.chabrier said:]

    X.endElements() is a short cut to end all the elements.

    Alain
    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: Deleting IloSolution object

    Posted 05/17/08 01:54 AM

    Originally posted by: SystemAdmin


    [Sylvain said:]

    Sorry, I forgot that again.

    #CPOptimizer
    #DecisionOptimization