Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Extremely slow computation

    Posted Wed January 30, 2019 04:58 PM

    Originally posted by: Devin063


    Greetings,

    I am new to CPLEX. Currently, I am working on a linear programming problem in matlab.

     

    When I use optimization function linprog with interior point method by matlab, the computation can finish just several seconds. However, when I use cplexlp function of CPLEX with interior point algorithm and same tolerance in matlab, it sometimes can cost several minutes. Because I need call linear programming solver frequently, my program now is extremely slow.

    At the same time, I noticed that even I specified to use interior point method by "cplexoptimset('Algorithm','interior-point','MaxIter', 2000,'Display','final','ExportModel', 'model.sav')" , the clone1.log file still says, "Dual simplex solved model." as figure shows.

     

    The attached file is export of model for analysis. Can anyone tell me how can I diagnose the reason for slowness? And how can I improve the computation time?

     

    Thank you very much!

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Extremely slow computation

    Posted Fri February 01, 2019 10:15 AM

    The 'dual simplex solved model' line is expected. That is the output from the crossover to a basic solution. CPLEX uses concurrent crossover and in your case dual crossover is faster than primal. Does linprog() also provide a basic solution? Maybe it does not and that is the difference between the two? In that case you may want to configure CPLEX so that it does no crossover.

    Are you sure you attached the correct model? The model.sav file you attached solves within a blink here on an 8 core machine. How many threads to do you use? Can you show the full engine log?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: Extremely slow computation

    Posted Fri February 01, 2019 11:17 AM

    Originally posted by: Devin063


    Thank you a lot! You have answered several questions I asked. Your answers are very helpful to my research. I am new to CPLEX.

     

    My model actually is a nested optimization problem. The exterior optimization problem is a nonlinear optimization problem solved by matlab, and the inner optimization problem is a linear programming problem solved by CPLEX. Same as what you mentioned, we indeed found that for our inner optimization problem, dual  simplex method by CPLEX is much quicker than interior-point method by CPLEX.

    However, because of multiple optimal solutions of the linear programming problem, we found that interior point method can obtain a much more reasonable solution than dual simplex method. So we have no choice but to use interior point method. Now, I try to analyze the reason why the program is so slow and would like to accelerate it.

     

    I don't konw whether linprog of matlab has crossover process or not. I asked in matlab community, but one answered me. I used the default function of cplexlp (https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.6.2/ilog.odms.cplex.help/refmatlabcplex/html/cplexlp-m.html), which dose not has parameter of threads. The log file sometimes can be very large. I picked a smaller one for uploading.

     

     

     

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: Extremely slow computation

    Posted Thu February 07, 2019 02:13 AM

    The log file you picked is a clone.log. That means, it contains only output from a sub-thread. What we would need is the engine log (maybe this is what you meant by the "big" file). Note that these log files are appended, so they grow over time. If you just want to have the log output for a particular solve then just delete the file before you start a new solve. What we need to see is the log file that contains information like this:

    Tried aggregator 1 time.
    LP Presolve eliminated 53 rows and 9 columns.
    Aggregator did 1 substitutions.
    Reduced LP has 45 rows, 35 columns, and 256 nonzeros.
    Presolve time = 0.00 sec. (0.10 ticks)
    Parallel mode: using up to 8 threads for barrier.
    Number of nonzeros in lower triangle of A*A' = 550
    Using Approximate Minimum Degree ordering
    Total time for automatic ordering = 0.00 sec. (0.02 ticks)
    Summary statistics for Cholesky factor:
      Threads                   = 8
      Rows in Factor            = 45
      Integer space required    = 94
      Total non-zeros in factor = 708
      Total FP ops to factor    = 14394
     Itn      Primal Obj        Dual Obj  Prim Inf Upper Inf  Dual Inf Inf Ratio
       0  -1.3001084e+02  -1.1934939e+03  2.10e+03  3.89e+02  7.00e+04  1.00e+00
       1  -4.1296386e+01   1.9984365e+03  6.40e+02  1.18e+02  3.89e+03  5.17e-04
       2  -3.8633462e+00   4.7278039e+02  4.73e+01  8.74e+00  1.14e+03  2.16e-03
       3  -4.1193921e-01   4.3459301e+02  7.54e+00  1.39e+00  2.01e+02  2.39e-03
       4  -1.0327860e-01   7.9495349e+01  1.29e+00  2.38e-01  5.94e+01  1.43e-02
       5  -5.5078048e-02   6.7408646e+00  1.41e-01  2.61e-02  6.59e+00  1.75e-01
       6  -6.6787095e-02   5.1350275e-01  6.67e-03  1.23e-03  6.86e-01  2.17e+00
       7  -7.9237024e-02  -5.4905544e-02  3.90e-05  7.21e-06  3.12e-02  5.45e+01
       8  -1.1184368e-01  -1.0836445e-01  7.33e-06  1.36e-06  6.02e-03  4.69e+02
       9  -1.1553138e-01  -1.1603159e-01  1.47e-06  2.72e-07  3.96e-04  2.99e+04
      10  -1.1599542e-01  -1.1599782e-01  7.70e-09  1.40e-09  5.82e-08  1.80e+08
      11  -1.1599705e-01  -1.1599705e-01  1.75e-11  2.06e-13  8.34e-12  2.74e+11
      12  -1.1599705e-01  -1.1599705e-01  1.02e-11  2.55e-17  3.03e-15  1.65e+15
    Barrier time = 0.01 sec. (0.37 ticks)

    BTW, the log above is for the model you attached to your original post. As you can see, it solves in 0.01 seconds. So I guess you attached the wrong model?


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: Extremely slow computation

    Posted Wed February 13, 2019 11:22 AM

    Originally posted by: Devin063


    Thank you very much!

    But I don't know how to generate engine file through Matlab APIs.

    What the suffix name of the engine file?

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: Extremely slow computation

    Posted Mon February 18, 2019 03:51 AM

    The engine log can be created by setting the Display parameter to "on" (see https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/refmatlabcplex/html/cplexoptimset-m.html). From what you wrote in another thread, I think by now you figured out how to get this output.


    #CPLEXOptimizers
    #DecisionOptimization