1
$\begingroup$

I wish to write MATLAB codes to solve the following linear programming problem found in Bertsimas' lecture notes: Investment problem

My attempt was as follows (sequence of variables for f' is A, B, C, D, E, Cash1, Cash2, Cash3):

f = [0 -1 0 -1.75 -1.4 0 0 -1.06];  A = [1 0 1 1 0 1 0 0; -0.3 1 -1.1 0 0 -1.06 1 0; -1 -0.3 0 0 1 0 -1.06 1; 1 0 0 0 0 0 0 0; 0 0 1 0 0 0 0 0; 0 0 0 0 1 0 0 0];  b = [1; 0; 0; 0.5; 0.5; 0.75];  lb = zeros(8, 1);  linprog(f, A, b, [], [], lb) 

Is it correct?
What would be a better solution? Thanks.

1 Answers 1

1

Assuming the formulation is correct the implementation looks fine. Perhaps it would be more consistent to use an upper bound like you used a lower bound:

ub = [0.5000       Inf    0.5000       Inf    0.7500       Inf       Inf       Inf] 

This allows you to make the matrix A and the vector b smaller, the result is of course the same.