简体   繁体   English

使用 CPLEX/AMPL 解决的 SOCP 问题比使用 CPLEX/MATLAB 解决的速度快 10 倍,为什么?

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

I solved an optimal power flow (OPF) problem modeled as a second-order cone programming (SOCP).我解决了一个建模为二阶锥规划 (SOCP) 的最优潮流 (OPF) 问题。 At first I solved using solver CPLEX in AMPL lenguage, and took 0.08s;起初我在AMPL语言中使用求解器CPLEX求解,耗时0.08s; then I solved the same problem with CPLEX for Matlab (command cplexqcp) and took 0.86s.然后我用 CPLEX for Matlab(命令 cplexqcp)解决了同样的问题,耗时 0.86s。 Times shown correspond only to the times demand by the solver (CPLEX).显示的时间仅对应于求解器 (CPLEX) 的时间需求。 Does anyone know what makes such a time difference?有谁知道是什么造成了这样的时差? Time results for CPLEX/AMPL: CPLEX/AMPL 的时间结果:

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

Time results for CPLEX/MATLAB: 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.注意:该问题有 542 个变量。

Hard to say without access to the detail, but my first guess would be preprocessing.很难说没有详细信息,但我的第一个猜测是预处理。 Before passing the problem to the solver, AMPL will attempt to simplify it eg eliminating variables that are dependent on other variables.在将问题传递给求解器之前,AMPL 将尝试对其进行简化,例如消除依赖于其他变量的变量。 This can make a significant difference to the solution time.这会对求解时间产生重大影响。

(For large problems, it can also make a big difference to data I/O time between AMPL and solver, but for only 542 variables that's probably not a big issue.) (对于大型问题,它也会对 AMPL 和求解器之间的数据 I/O 时间产生很大差异,但对于仅 542 个变量来说,这可能不是什么大问题。)

Another possibility is that AMPL and Matlab are invoking CPLEX with different options (eg different solution tolerances).另一种可能性是AMPL 和Matlab 使用不同的选项(例如不同的解决方案容差)调用CPLEX。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM