Decision Optimization

 View Only
Expand all | Collapse all

SOCP problem solved with CPLEX/AMPL it´s 10 times faster than when is solved with CPLEX/MATLAB, why?

  • 1.  SOCP problem solved with CPLEX/AMPL it´s 10 times faster than when is solved with CPLEX/MATLAB, why?

    Posted Tue November 10, 2020 11:02 AM

    I solved an optimal power flow (OPF) problem modeled as a second-order cone programming (SOCP). At first I solved using solver CPLEX in AMPL lenguage, and took 0.080s for the solver; then I solved the same problem with CPLEX for Matlab (command cplexqcp) and took 0.86s. Times shown correspond only to the times demand by the solver (CPLEX). Does anyone know what makes such a time difference?

    Time results for CPLEX/AMPL:

    Elapsed AMPL time : 0.430s
    Elapsed Solve time : 0.080s
    Elapsed CPU time: 0.510s

    Time results for CPLEX/MATLAB:

    tic
    [x,fval]=cplexqcp([],f,[],[],Aeq,beq,l,Qc,r,Li,Ls);
    toc : Elapsed time is 0.860856 seconds.

    Note: The problem has 542 variables.



    ------------------------------
    Jonathan Ayala Marcelo
    ------------------------------

    #DecisionOptimization


  • 2.  RE: SOCP problem solved with CPLEX/AMPL it´s 10 times faster than when is solved with CPLEX/MATLAB, why?

    IBM Champion
    Posted Tue November 10, 2020 02:12 PM
    Isn't 0.86 secs. the total time taken for MATLAB to generate the problem and pass it to CPLEX, CPLEX to solve it, and MATLAB to recover the solution from CPLEX? So CPLEX's share of that 0.86 seconds may be fairly small.

    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------



  • 3.  RE: SOCP problem solved with CPLEX/AMPL it´s 10 times faster than when is solved with CPLEX/MATLAB, why?

    Posted Tue November 10, 2020 04:27 PM
    Thanks for reply Prof. Paul, I think you are right. Then we can conclude that matlab takes longer in pass data to cplex and recover its solution that AMPL for the same, right?. Initially I thought that work with CPLEX/MATLAB would be more effiicient that work with CPLEX/AMPL because time would be save in the decodification of the AMPL  mathematical modeling, but I see that in general terms AMPL is more efficient than Matlab for work with cplex.

    ------------------------------
    Jonathan Ayala Marcelo
    ------------------------------



  • 4.  RE: SOCP problem solved with CPLEX/AMPL it´s 10 times faster than when is solved with CPLEX/MATLAB, why?

    IBM Champion
    Posted Tue November 10, 2020 04:39 PM
    I would hesitate to claim either of AMPL and MATLAB is faster than the other based on one problem instance. Since I have no experience using MATLAB, and have not used AMPL in a while, I'll just say that I have no idea which is faster interfacing with CPLEX. Also, I don't know whether the "[e]lapsed AMPL time" in the output includes the time to recover the solution from CPLEX and convert it to AMPL variables, while it seems likely the MATLAB time includes the time spent getting the solution into x and the objective value into fval (assuming I'm interpreting the MATLAB code correctly).

    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------