简体   繁体   English

使用MATLAB的CPLEX

[英]use CPLEX from MATLAB

I have a text file of lp problem 我有一个lp问题的文本文件

   Minimize

   5.8 x_1 + 3 x_2

   subject to

   x_1 + 2.1 x_2 = 6
   3 x_2 < 4.2

   bounds

   x_1 >= 0
   x_2 >= 0

   Integer
   x_1

   end

I use these two commands for optimization from Windows PowerShell(or command prompt). 我使用这两个命令从Windows PowerShell(或命令提示符)进行优化。

   read abc.txt lp
   opt

I know cplex can be used from matlab, I added required path and saved it. 我知道可以从matlab使用cplex,我添加了所需的路径并保存了它。 Matlab R2014a. Matlab R2014a。 But don't know proper command(ie matlab commands/m-file) to read problem from file and optimize it. 但是不知道正确的命令(即matlab命令/ m文件)来从文件中读取问题并对其进行优化。 also write the solution to a file. 还将解决方案写入文件。

(Text file must be the medium because number of variables will be large.) (文本文件必须是中间文件,因为变量数量很大。)

Have you tried reading model using 您是否尝试过使用读取模型

cplex.readModel('abc.txt');

and cplexmilp for the optimization? cplexmilp进行优化?

cplex=Cplex() cplex = Cplex()

cplex.readModel('abc.txt') cplex.readModel('abc.txt')

cplex.solve cplex.solve

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

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