Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to destruct my IloStructure ?

    Posted 03/19/13 01:22 PM

    Originally posted by: sana_


    Hello,

    I want to know if the instruction env.end() will destroy all my IloExtractable structures that explicitly points to the IloEnv env ?

    Example:

    I define an IloEnv env;
    IloIntVarArray X(env);
    .... code
    env.end();

    I want to know if the X handles were destructed or if I should define my own destructor of X if I want to liberate memory??

    Thanks a lot !
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to destruct my IloStructure ?

    Posted 03/19/13 01:30 PM

    Originally posted by: SystemAdmin


    X will be destroyed. env.end() will destroy everything that was constructed with env in the constructor.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to destruct my IloStructure ?

    Posted 03/19/13 02:02 PM

    Originally posted by: sana_


    I have this problem in my program:

    class Variables
    {
    public:
    IloArray<IloIntVarArray> m_shifts;
    vector<vector<int>> m_values;

    public:
    Variables(IloEnv env, int nbr_emp) : m_shifts(env, nbr_emp), m_values(vector<vector<int>>()) { }

    void set_elements(...)
    {
    ...
    }
    };

    int main
    {
    for(unsigned int ins = 0; ins < my_instances.m_elements.size(); ins ++)
    {
    Data my_data;
    my_data.set_elements(my_instances.m_elementsins.m_path, my_instances.m_elementsins.m_period_minute);

    clock_t start_main = clock();

    IloEnv env;

    Variables my_variables(env, my_data.m_employes.m_elements.size());
    my_variables.set_elements(...);

    ...

    clock_t end_main = clock();
    double temps_main=(end_main - start_main) / (double)CLOCKS_PER_SEC;

    env.end();
    }
    return 0;
    }

    The problem is NP-Hard and the IloArray<IloIntVarArray> is huge. In the first iteration the problem is perfectly executed. When I move to the instance 2, there is a bug.

    If I do not use the boucle "for" and I begin by testing my instance 2, the problem is perfectly executed.

    That's why I thought that I need a destructor for the IloArray<IloIntVarArray> m_shifts.

    It's very strange !!!
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: How to destruct my IloStructure ?

    Posted 03/19/13 03:05 PM

    Originally posted by: SystemAdmin


    Can you monitor the memory consumption? For example by using the task manager on Windows or the 'top' command on other systems?
    Does it look like you are leaking memory?
    What is the "bug" that you mention? Is it out of memory?
    In the code you posted I could not see any memory leak.
    #CPLEXOptimizers
    #DecisionOptimization