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_elements
ins.m_path, my_instances.m_elements
ins.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