Lecture 4&5 - Linear Programming (LP) TTK4135 - Optimalisering og regulering


We have the problem

Where

To use linear programming we need to put it on the form

Link to original
To use the linprog function in matlab, we need it on the following form

Where

The following matlab script solves this

% Define the matrices needed for linprog
c = [2410 1630 2050 1700];
A = [3 1 1 0];
b = [60];
Aeq = [1 1 1 1];
beq = [100];
lb = [0 0 0 0]'; % No negative production
ub = [inf inf inf inf]'; % No upper limits on variables
 
% Solve the optimization problem
[x_opt, J_opt] = linprog(c, A, b, Aeq, beq, lb, ub);