Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Freeing CPLEX takes too much time

    Posted 05/15/20 03:33 PM
    Hello all,

    I am trying to solve MIP instances, each of which requires 0.1M-5M b&b nodes to solve, using CPLEX 12.71. I am solving 10 instances in a loop, and it takes more than 5 hours to free up CPLEX after each run of solving an instance. Here are the comments I used to free up cplex at the end of each loop:
    cplex.end();

    model.end();

    env.end();
    Is there anything I can do to speed this up?

    By the way, when I used cplex.end() only or env.end() only still it takes the same amount of time to free up cplex and move on to the next run. The model.end() does not seem to take any time.

    Thanks,
    Esra


    ------------------------------
    Esra Buyuktahtakin Toy
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Freeing CPLEX takes too much time

    Posted 05/19/20 12:21 PM
    Have you have seen related posts in this forum like the following:
    Is it possible for you to share one of your MIP instances in SAV format here? Is it possible for you to try using a more recent version of CPLEX (version 12.10 is currently available) to see if you get the same behavior?

    ------------------------------
    Ryan Kersh
    ------------------------------



  • 3.  RE: Freeing CPLEX takes too much time

    Posted 05/19/20 01:59 PM
    Hi Ryan,

    Yes I have seen those posts, but those suggestions did not solve my problem related to cplex freeign time. Per your request, I am attaching an LP file of the model (multi.lp). I run my codes on visual studio 13, and higher versions of cplex are not compatible with that. Pretty much, I am stuck with CPLEX 12.71 for now.

    For your information, I do not have this problem on a linux environment. For some reason, while working on Windows ending cplex takes a huge time, almost as much time as solving the problem itself.

    Thanks,
    Esra

    --
    Esra Buyuktahtakin Toy, PhD
    Associate Professor
    Mechanical and Industrial Engineering Department
    New Jersey Institute of Technology
    office: MEC 313
    phone: 973-596-5705




    ------Original Message------

    Have you have seen related posts in this forum like the following:
    Is it possible for you to share one of your MIP instances in SAV format here? Is it possible for you to try using a more recent version of CPLEX (version 12.10 is currently available) to see if you get the same behavior?

    ------------------------------
    Ryan Kersh
    ------------------------------

    #DecisionOptimization


  • 4.  RE: Freeing CPLEX takes too much time
    Best Answer

    Posted 05/19/20 03:59 PM
    Did you forget the attachment? The CPLEX forum was recently moved here so I'm sorry in advance if it's attached and I just don't see it.

    I understand that you are stuck using Visual Studio 2013. However, in case you weren't aware of it, there is the free Visual Studio 2019 Community Edition available here (it may or may not suit your needs).

    ------------------------------
    Ryan Kersh
    ------------------------------



  • 5.  RE: Freeing CPLEX takes too much time

    Posted 05/19/20 05:37 PM
    Here is the attachment to the multi.lp file. Thanks,
    Esra

    ------------------------------
    Esra Buyuktahtakin
    ------------------------------



  • 6.  RE: Freeing CPLEX takes too much time

    Posted 05/20/20 10:48 AM
    The files don't appear in the posts.  I suspect this is because the `.lp` extension is not accepted by the Forum software.  Could you please try first to rename your `.lp` file into `.txt`, or zip it?

    ------------------------------
    Xavier
    ------------------------------



  • 7.  RE: Freeing CPLEX takes too much time

    Posted 05/20/20 11:05 AM
    Edited by System Admin 01/20/23 04:12 PM
    I received the model from Esra via email. I'll attempt to share it as a zip file here.

    EDIT: It looks like it worked. :-)

    ------------------------------
    Ryan Kersh
    ------------------------------



  • 8.  RE: Freeing CPLEX takes too much time

    Posted 05/20/20 11:12 AM
    I can now open the attachment in the zip file. Thanks, Ryan!

    --
    Esra Buyuktahtakin Toy, PhD
    Associate Professor
    Mechanical and Industrial Engineering Department
    New Jersey Institute of Technology
    office: MEC 313
    phone: 973-596-5705




    ------Original Message------

    I received the model from Esra via email. I'll attempt to share it as a zip file here.

    EDIT: It looks like it worked. :-)

    ------------------------------
    Ryan Kersh
    ------------------------------

    #DecisionOptimization


  • 9.  RE: Freeing CPLEX takes too much time

    Posted 05/20/20 04:42 PM
    Hi Esra,

    Using the model you provided and CPLEX 12.7.1, I have not been able to reproduce the behavior you describe (nor with the most recent version, CPLEX 12.10). I used the following code (as suggested in one of the related threads I mentioned above):

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

    Are you able to reproduce using this code? If not, are you using any non-default parameter settings? Also, if you are willing to share you program (via email) I can try with that.

    ------------------------------
    Ryan Kersh
    ------------------------------