```
### - two lists with exercises (theory and computational practice)
### - one exam on theory on April 21st (yes, on Tiradentes holiday)
### - one Matlab/Octave project at the end of June
### - plus a 3rd list for PhD students
```

Using national and imported oil, $oil_1$ and $oil_2$, the company produces standard and premium gasoline, $prod_1$ and $prod_2$.

Oil cost is $(c_1,c_2)^T=(2,3)^T$

Variable for input oil is $(x_1,x_2)^T$ so that production cost is $f(x):=c^Tx$

Demand for standard and premium gasoline is $(h_1,h_2)^T$

Each oil has a specific quality, different amounts needed to produce each type of gas ("productivity").

Need 2 units of national oil or 6 units of imported oil to make one unit of standard gasoline $$\hspace{5cm}2x_1+6x_2\geq h_1$$

Likewise for premium gas, $$\hspace{5cm}3x_1+3x_2\geq h_2$$

Refineries can process no more oil than their capacity: $x_1+x_2\leq 100\iff\hspace{1cm} -x_1-x_2\geq-100$.

We obtain the linear program

$$\left\{\begin{array}{ll}\min&2x_1+3x_2\\ \mbox{s.t.}&2x_1+6x_2\geq h_1\\ &3x_1+3x_2\geq h_2\\ &x_1+x_2\leq 100\\ &x_1\,,x_2\geq 0\,,\end{array}\right.$$a particular instance of the linear programming problem $$\left\{\begin{array}{ll}\min&c^Tx\\ \mbox{s.t.}&Ax\geq b\\ &x\geq 0\,.\end{array}\right.$$

In [10]:

```
%Let's use OCTAVE glpk to solve the LP
%type help glpk to see the input/output arguments
%[XOPT, FMIN, ERRNUM, EXTRA] = glpk (C, A, B, LB, UB,CTYPE, VARTYPE, SENSE, PARAM)
VARTYPE='CC';%continuous variables
LB=[0;0];UB=[];%bounds
c=[2;3];%cost function
h=[180;162];%demand of gasoline
b=[h;-100];%right hand side
A=[2 6;3 3;-1 -1];CTYPE='LLL';%all constraints given as >=
[XOPT, FMIN, ERRNUM, EXTRA] = glpk (c, A, b, LB, UB,CTYPE, VARTYPE)
```

In [10]:

```
x=0:100;y1=100-x;y2=30-x/3;y3=54-x;
X1=[x' x' x'];YMatrix1=[y1' y2' y3'];
% Create figure
figure1 = figure('XVisual',...
'0x7a (TrueColor, depth 32, RGB mask 0xff0000 0xff00 0x00ff)');
% Create axes
axes1 = axes('Parent',figure1,'FontSize',8);
ylim(axes1,[0 100]); xlim(axes1,[0 100]);
box(axes1,'on');hold(axes1,'all');
% Create multiple lines using matrix input to plot
plot1 = plot(X1,YMatrix1,'Parent',axes1,'LineWidth',4);
set(plot1(1),'DisplayName',' Capacity');
set(plot1(2),'DisplayName',' Std Gas');
set(plot1(3),'DisplayName',' Prem Gas');
% Create legend
legend1 = legend(axes1,'show');
```