Dr.PB
Dr.PB

Reputation: 1067

use CPLEX from MATLAB

I have a text file of lp problem

   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).

   read abc.txt lp
   opt

I know cplex can be used from matlab, I added required path and saved it. Matlab R2014a. But don't know proper command(i.e. matlab commands/m-file) to read problem from file and optimize it. also write the solution to a file.

(Text file must be the medium because number of variables will be large.)

Upvotes: 0

Views: 453

Answers (2)

Dr.PB
Dr.PB

Reputation: 1067

cplex=Cplex()

cplex.readModel('abc.txt')

cplex.solve

Upvotes: 0

Shai
Shai

Reputation: 114786

Have you tried reading model using

cplex.readModel('abc.txt');

and cplexmilp for the optimization?

Upvotes: 0

Related Questions