Matlab CPLEX&x2B;雅尔米普--”;未找到解算器";?
我正在尝试开始,这是一个Matlab接口,用于优化解算器,如。我有一个目标函数obj和约束cons,我把它们插入了YalmipMatlab CPLEX&x2B;雅尔米普--”;未找到解算器";?,matlab,ubuntu,mathematical-optimization,linear-programming,cplex,Matlab,Ubuntu,Mathematical Optimization,Linear Programming,Cplex,我正在尝试开始,这是一个Matlab接口,用于优化解算器,如。我有一个目标函数obj和约束cons,我把它们插入了Yalmip options=sdpsettings('solver','Cplex'); %windows needs uppercase 'Cplex' and unix is ok with 'cplex' or 'Cplex' solvesdp(cons,obj,options); %prints 'Warning: Solver not found' 在上述代码中,sol
options=sdpsettings('solver','Cplex'); %windows needs uppercase 'Cplex' and unix is ok with 'cplex' or 'Cplex'
solvesdp(cons,obj,options); %prints 'Warning: Solver not found'
在上述代码中,solvesdp
打印警告:未找到解算器。包含obj
、cons
的.m
和对Yalmip的调用在我朋友的计算机上工作,我们很困惑为什么它在我的计算机上不工作
以下是我在我的Ubuntu 12.04机器上使用Matlab R2012b对CPLEX和Yalmip的设置步骤:
/home/user/IBM/ILOG/CPLEX_Studio125/CPLEX
home/user/Yalmip
下面,我将解释我是如何尝试诊断问题的。很明显,Matlab可以看到CPLEX,Matlab可以看到Yalmip,但是Yalmip看不到CPLEX。 确认Yalmip和CPLEX在我的matlab路径中:
MATLAB> path
/home/user/ibm/ILOG/CPLEX_Studio125/cplex/examples/src/matlab
/home/user/ibm/ILOG/CPLEX_Studio125/cplex/matlab
/home/forrest/ibm/ILOG/CPLEX_Studio125/cplex/matlab/help
/home/forrest/ibm/ILOG/CPLEX_Studio125/cplex/matlab/help/helpsearch
/home/forrest/ibm/ILOG/CPLEX_Studio125/cplex/matlab/help/topics
/home/user/yalmip
/home/user/yalmip/demos
/home/user/yalmip/extras
/home/user/yalmip/modules
/home/user/yalmip/modules/bilevel
/home/user/yalmip/modules/global
/home/user/yalmip/modules/moment
/home/user/yalmip/modules/parametric
/home/user/yalmip/modules/robust
/home/user/yalmip/modules/sos
/home/user/yalmip/operators
/home/user/yalmip/solvers
...
为了验证Matlab确实可以找到CPLEX,我运行了help cplexlp
。它给出了有效的输出:
MATLAB> help cplexlp
cplexlp
Solve linear programming problems.
x = cplexlp(f,Aineq,bineq) solves the linear programming problem min f*x such that Aineq*x <= bineq.
...
我还环顾了IBM论坛,寻找这方面的答案。一位朋友向我指出了诊断CPLEX/Yalmip的问题,但这篇文章更关注Windows,并没有真正解决我的问题
更多详情:
- Yalmip版本2012-09-26
- CPLEX版本12.5
Yalmip/solvers/definesolvers.m
的文件。在definesolvers.m中,有一系列类似这样的语句:
solver(i) = lpsolver;
solver(i).tag = 'CPLEX';
solver(i).version = 'IBM';
solver(i).subversion = '12.4';
solver(i).checkfor = {'cplexlp.m','cplexlink124'};
...
这些语句适用于CPLEX 12.0、12.1、12.2、12.3和12.4。但是,我使用的是CPLEX 12.5,对于CPLEX 12.5没有这样的声明
我将12.4
的所有实例替换为12.5
,并将cplexlink124
的实例替换为cplexlink125
。我的优化代码现在可以工作了
下面是yalmiptest
的新输出:
>> yalmiptest
+++++++++++++++++++++++++++++++++++++++++++++++
| Searching for installed solvers |
+++++++++++++++++++++++++++++++++++++++++++++++
| Solver| Version/module| Status|
+++++++++++++++++++++++++++++++++++++++++++++++
| CPLEX| IBM| found|
| CPLEX| IBM| found|
| CPLEX| IBM| found|
| LINPROG| | found|
| QUADPROG| | found|
| LMILAB| | found|
| FMINCON| geometric| found|
| FMINCON| standard| found|
| FMINSEARCH| | found|
| BNB| | found|
| BINTPROG| | found|
| CUTSDP| | found|
| BMIBNB| | found|
| KKTQP| | found|
| NONE| | found|
| LSQNONNEG| | found|
| LSQLIN| | found|
| GUROBI| GUROBI| not found|
| GUROBI| MEX| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
...
我猜剩余的CPLEX | IBM | notfound |
行意味着没有找到CPLEX 12.0、12.1、12.2和12.3
solver(i) = lpsolver;
solver(i).tag = 'CPLEX';
solver(i).version = 'IBM';
solver(i).subversion = '12.4';
solver(i).checkfor = {'cplexlp.m','cplexlink124'};
...
>> yalmiptest
+++++++++++++++++++++++++++++++++++++++++++++++
| Searching for installed solvers |
+++++++++++++++++++++++++++++++++++++++++++++++
| Solver| Version/module| Status|
+++++++++++++++++++++++++++++++++++++++++++++++
| CPLEX| IBM| found|
| CPLEX| IBM| found|
| CPLEX| IBM| found|
| LINPROG| | found|
| QUADPROG| | found|
| LMILAB| | found|
| FMINCON| geometric| found|
| FMINCON| standard| found|
| FMINSEARCH| | found|
| BNB| | found|
| BINTPROG| | found|
| CUTSDP| | found|
| BMIBNB| | found|
| KKTQP| | found|
| NONE| | found|
| LSQNONNEG| | found|
| LSQLIN| | found|
| GUROBI| GUROBI| not found|
| GUROBI| MEX| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
| CPLEX| IBM| not found|
...