Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  env.end() takes long time???

    Posted 10/10/11 11:18 AM

    Originally posted by: SystemAdmin


    Hi

    I am using CPLEX12.1 to solve an IP problem. The problem has on the order of 5000 binary variables and around 8000 constraints. CPLEX is able to solve the problem instantly (~0.2sec). As my algorithm requires to solve the IP problem in multiple iterations, I need to "end" the environment object after each instance. But when I use env.end() to delete the env object, it always takes about 3-5 minutes. Does anyone know why this could happen? And what should I do to reduce this time?

    Thank you very much.

    Eddie
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: env.end() takes long time???

    Posted 10/10/11 01:38 PM

    Originally posted by: SystemAdmin


    I tried, but was unable to reproduce the issue using a model with 60K constraints and 160K columns. Are you sure that the delay occurs in the 'env.end()' function call? Is 'cplex.clearModel()' in your code as well? If it is and you are ending the environment in every iterations, then clearModel need not be called; so can you comment that and try again?

    If you have a sav/mps/lp version of the underlying IP, you could try using the following program to see if 'env.end()' really takes that long. Do change <file_path> with your sav/mps/lp full path name (like, "C:\\test\\check.lp") and the TiLim parameter if need be.

    #include <ilcplex/ilocplex.h>
    #include <time.h>
    ILOSTLBEGIN
    int main (int argc, char **argv)
    { 
       for(int c=0;c<20;c++){
       IloEnv env;
       try {
                    IloModel model(env);
                    IloCplex cplex(env);
                    cplex.importModel(model, <file_path>);
                    cplex.setParam(IloCplex::TiLim,1);
                    cplex.extract(model);
                    cplex.solve();
       }
       catch (IloException& e) {
          cerr << "Concert exception caught: " << e << endl;
       }
       catch (...) {
          cerr << "Unknown exception caught" << endl;
       }
       double start = clock();
       env.end();
       double end = clock();
       cout<<"Time to end environment:"<<(end-start)/1000<<endl;
       }
       return 0;
    }  // END main
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: env.end() takes long time???

    Posted 10/11/11 05:45 PM

    Originally posted by: SystemAdmin


    This is a FAQ. Try ending each instance of IloCplex in the environment, then each IloModel, and then the env.

    Paul

    Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: env.end() takes long time???

    Posted 10/11/11 08:22 PM

    Originally posted by: SystemAdmin


    If ending the IloCplex, IloModel and IloEnv objects in every iteration does not help, then please monitor the memory consumption by your application. Specifically, it is important to see if the memory consumption goes down after the invocation of the 'env.end()' call. If the memory increases with every iteration, then you will need to set an environment variable called 'MKL_DISABLE_FAST_MM' to a value of 1. Now, try running your application to see if this addition helps or not.
    #CPLEXOptimizers
    #DecisionOptimization