Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Ilog Script Model Component Variables, How to Manage Properly

    Posted 06/19/10 01:55 PM

    Originally posted by: UDOPS


    I am having memory and model expansion problems with a lagrangian loop when the data set is large. As part of this I have been refining my model and trying to improve memory management where ever possible. Part of this includes carefully "end()ing" model components. I am referring to the documentation and cutstock example, and I am not clear what the proper creation and ending sequence should be.

    For example, in the cutstock example, some elements are create new outside a loop, and some elements are created new repeatedly inside a loop.

    For example, masterOpl is created outside the loop, and re-used repeatedly inside the loop:

    var masterOpl = new IloOplModel(masterDef, masterCplex);

    (inside while loop)

    masterOpl.end();
    masterOpl = new IloOplModel(masterDef,masterCplex);
    But in constrast, subOpl is created repeatedly inside the loop, with a fresh "var" statement each time. Why the different structure for model elements in the same file, and how does this impact memory management?

    (inside while loop)
    var subOpl = new IloOplModel(subDef,subCplex);
    subOpl.end();

    And finally, what does "end()" really mean, since it clearly does not delete the initial "var" declaration, but merely frees the contents? It appears the "var" statement is persistent after any related call to .end().
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Ilog Script Model Component Variables, How to Manage Properly

    Posted 08/29/10 01:20 PM

    Originally posted by: UDOPS


    I am back on this project after vacation and am still very interesting in the answer(s).
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Ilog Script Model Component Variables, How to Manage Properly

    Posted 08/30/10 02:48 AM

    Originally posted by: SystemAdmin


    Your understanding is right.

    The method end() deletes the contents of the IloOplModel object.
    The scripting variable subOpl, declared using "var", will still point to that not invalid object.
    Variables in scripting (aka ECMA-262, JavaScript) are refereces (or handles) to underlying OPL objects.

    You may want to assign "null" to scripting variables if you no longer need them, that will help the scripting engine collect some memory early, like
    subOpl.end();
    subOpl=null;
    


    To make sure to free as much memory as possible during your inner loop, you might need to end more objects than just IloOplModel. As a rule of thumb, if you create an object in scripting using 'new' you need to 'end()' it.

    Tschau, Frank
    #DecisionOptimization
    #OPLusingCPLEXOptimizer