This commit is contained in:
Claudio Maggioni 2020-12-19 23:27:43 +01:00
parent cbc8fbfd84
commit e5b5431e06
9 changed files with 260 additions and 63 deletions

View file

@ -86,6 +86,11 @@ while(z~=0)
% Compute reduced cost coefficients % Compute reduced cost coefficients
r_D = c_Daux - (c_Baux * BiD); r_D = c_Daux - (c_Baux * BiD);
% Exercise 4: Uncomment this to experience "oscillation"
%fprintf("iteration %d: in %d out %d z %d\n", nIter+1, idxIN, idxOUT, z);
%B
%D
% Detect inefficient loop if nIter > total number of basic solutions % Detect inefficient loop if nIter > total number of basic solutions
nIter = nIter + 1; nIter = nIter + 1;

View file

@ -0,0 +1,27 @@
type = 'max';
A = [
%x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0;
0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0;
0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0;
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1;
320 0 0 0 510 0 0 0 630 0 0 0 125 0 0 0;
0 320 0 0 0 510 0 0 0 630 0 0 0 125 0 0;
0 0 320 0 0 0 510 0 0 0 630 0 0 0 125 0;
0 0 0 320 0 0 0 510 0 0 0 630 0 0 0 125;
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1];
h = [18; 32; 25; 17; 11930; 22552; 11209; 5870; 16; 32; 40; 28];
% c is row vector form of following matrix C
C = [135; 200; 410; 520] * [1 1.1 1.2 1.3];
c = C';
c = c(:)';
sign = ones(1,12) * -1;
[z,x_B,index_B] = simplex (type,A,h,c,sign);
histogram([index_B x_B']')

View file

@ -0,0 +1,9 @@
type = 'max';
A = [4 3; 4 1; 4 2; 1 0; 0 1];
sign = [-1 ; -1 ; -1 ; 1 ; 1 ];
h = [12 ; 8 ; 8 ; 0 ; 0 ];
c = [3 4];
[z,x_B,index_B] = simplex (type,A,h,c,sign);
histogram([index_B x_B']')

View file

@ -7,13 +7,12 @@ function [z,x_B,index_B] = simplex (type,A,h,c,sign)
% c = coefficients of the objective function % c = coefficients of the objective function
% sign = vector holding information about the constraints if the system % sign = vector holding information about the constraints if the system
% needs to be standardized (-1: less or equal, 0: equal, 1:vgreater or equal) % needs to be standardized (-1: less or equal, 0: equal, 1:vgreater or equal)
m = size(A,1); m = size(A,1);
n = size(A,2); n = size(A,2);
% Compute the maximum number of basic solutions of the original % TODO: Compute the maximum number of basic solutions of the original problem (i.e., the maximum number of iterations necessary to solve the problem)
% problem (i.e., the maximum number of iterations necessary to solve the problem) itMax = factorial(m + n)/(factorial(m) * factorial(n));
itMax = factorial(2*m+n)/(factorial(n+m)*factorial(m));
% Writing the problem in standard form % Writing the problem in standard form
[A_aug,h,c_aug] = standardize(type,A,h,c,m,sign); [A_aug,h,c_aug] = standardize(type,A,h,c,m,sign);
@ -25,9 +24,9 @@ itMax = factorial(2*m+n)/(factorial(n+m)*factorial(m));
[x_B,c_B,index_B] = simplexSolve(type,B,D,c_B,c_D,h,x_B,x_D,index_B,index_D,itMax); [x_B,c_B,index_B] = simplexSolve(type,B,D,c_B,c_D,h,x_B,x_D,index_B,index_D,itMax);
% Compute the value of the objective function % Compute the value of the objective function
z = sum(c_B' .* x_B) + sum(c_D' .* x_D); z = dot(c_B, x_B);
% Output of the solution % Output of the solution
[x_B,index_B] = printSol(z,x_B,index_B,m,n); [x_B,index_B] = printSol(z,x_B,index_B,m,n);
end end

View file

@ -19,11 +19,11 @@ tol = max(size(r_D));
% Check the optimality condition, in order to skip the loop if the % Check the optimality condition, in order to skip the loop if the
% solution is already optimal % solution is already optimal
optCheck = typeCond(type, sum(r_D <= 0), sum(r_D >= 0)); optCheck = typeCond(type, sum(r_D < 0), sum(r_D > 0));
while optCheck ~= tol while optCheck ~= tol
% Find the index of the entering variable % Find the index of the entering variable
idxIN = find(r_D == typeCond(type, max(r_D), min(r_D)), 1, 'first'); idxIN = find(r_D == typeCond(type, max(r_D), min(r_D)));
in = D(:,idxIN); in = D(:,idxIN);
c_in = c_D(1,idxIN); c_in = c_D(1,idxIN);
@ -31,16 +31,16 @@ while optCheck ~= tol
% Evaluate the coefficients ratio for the column corresponding to % Evaluate the coefficients ratio for the column corresponding to
% the entering variable % the entering variable
ratio = Bih / BiD; ratio = Bih ./ BiD(:,idxIN);
% Find the smallest positive ratio % Find the smallest positive ratio
idxOUT = find(ratio == min(ratio(ratio > 0)), 1, 'first'); idxOUT = find(ratio == min(ratio(ratio > 0)));
out = B(:,idxOUT); out = B(:,idxOUT);
c_out = c_B(1,idxOUT); c_out = c_B(1,idxOUT);
index_out = index_B(1,idxOUT); index_out = index_B(1,idxOUT);
% TODO: Update the matrices by exchanging the columns % Update the matrices by exchanging the columns
B(:,idxOUT) = in; B(:,idxOUT) = in;
D(:,idxIN) = out; D(:,idxIN) = out;
c_B(1,idxOUT) = c_in; c_B(1,idxOUT) = c_in;
@ -57,7 +57,7 @@ while optCheck ~= tol
% Check the optimality condition, in order to exit the loop if the % Check the optimality condition, in order to exit the loop if the
% solution is already optimal % solution is already optimal
optCheck = typeCond(type, sum(r_D <= 0), sum(r_D >= 0)); optCheck = typeCond(type, sum(r_D < 0), sum(r_D > 0));
% Detect inefficient looping if nIter > total number of basic solutions % Detect inefficient looping if nIter > total number of basic solutions
nIter = nIter + 1; nIter = nIter + 1;

View file

@ -6,7 +6,7 @@ function [A_aug,h,c_aug] = standardize(type,A,h,c,m,sign)
% c = coefficients of the objective function % c = coefficients of the objective function
% m = size(A, 1) % m = size(A, 1)
% sign = vector holding information about the constraints if the system % sign = vector holding information about the constraints if the system
% needs to be standardized (-1: less or equal, 0: equal, 1:vgreater or equal) % needs to be standardized (-1: less or equal, 0: equal, 1: greater or equal)
% return arguments are: % return arguments are:
% (1) A_aug = augmented matrix A, containing also the surplus and slack variables % (1) A_aug = augmented matrix A, containing also the surplus and slack variables
% (2) c_aug = augmented coefficients vector c (check compatibility of dimensions with A) % (2) c_aug = augmented coefficients vector c (check compatibility of dimensions with A)
@ -44,11 +44,11 @@ end
c_aug = [c, zeros(1,m)]; c_aug = [c, zeros(1,m)];
if strcmp(type,'max') if strcmp(type,'max')
% Extend matrix A by adding the slack variables A_aug = [A aug_matrix];
A_aug = [A (+1 * full(aug_matrix == +1))]; % Extend matrix A by adding the slack variables
elseif strcmp(type,'min') elseif strcmp(type,'min')
A_aug = [A -aug_matrix];
% Extend matrix A by adding the surplus variables % Extend matrix A by adding the surplus variables
A_aug = [A (-1 * full(aug_matrix == -1))];
else else
error('Incorrect type specified. Choose either a maximisation (max) or minimisation (min) problem.') error('Incorrect type specified. Choose either a maximisation (max) or minimisation (min) problem.')
end end

View file

@ -5,7 +5,7 @@ close all;
clear; clear;
clc; clc;
runTests = [0 0 1 0 0 0]; runTests = [1 1 1 1 1 1];
%% Test 1 (example page 86) %% Test 1 (example page 86)
if runTests(1) if runTests(1)

Binary file not shown.

View file

@ -4,6 +4,7 @@
\usepackage{pgfplots} \usepackage{pgfplots}
\pgfplotsset{compat=1.17} \pgfplotsset{compat=1.17}
\usepackage{mathrsfs} \usepackage{mathrsfs}
\usepackage{hyperref}
\usetikzlibrary{arrows} \usetikzlibrary{arrows}
\input{assignment.sty} \input{assignment.sty}
\definecolor{zzttqq}{rgb}{0.6,0.2,0} \definecolor{zzttqq}{rgb}{0.6,0.2,0}
@ -15,7 +16,7 @@
\setduedate{Friday, December 18, 2020, 11:59 PM} \setduedate{Friday, December 18, 2020, 11:59 PM}
\serieheader{Numerical Computing}{2020}{Student: Claudio Maggioni}{Discussed \serieheader{Numerical Computing}{2020}{Student: Claudio Maggioni}{Discussed
with: --}{Solution for Project 6}{} with: Gianmarco De Vita (Exercise 2)}{Solution for Project 6}{}
\newline \newline
\assignmentpolicy \assignmentpolicy
@ -70,7 +71,7 @@ the inequalities above.
\begin{center} \begin{center}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm] \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\begin{axis}[ \begin{axis}[
x=0.3cm,y=0.3cm, x=0.2cm,y=0.2cm,
xmin=-1, ymin=-1, xmax=40,ymax=32, xmin=-1, ymin=-1, xmax=40,ymax=32,
axis lines=middle, axis lines=middle,
ymajorgrids=true,xmajorgrids=true] ymajorgrids=true,xmajorgrids=true]
@ -100,14 +101,15 @@ solutions, and therefore we evaluate the minimization function in these points:
m(40,0) = 160 \\ m(40,0) = 160 \\
\end{aligned}\] \end{aligned}\]
And therefore we have as a solution $(x, y) = (40, 0)$, with $z = 160$. And therefore we have as a solution $(x, y) = (24, 8)$, with $z = 104$, as this
is a minimization problem.
\subsection{Problem 2 as linear programming problem} \subsection{Problem 2 as linear programming problem}
The following is the linear programming formulation of problem 2: The following is the linear programming formulation of problem 2:
\begin{equation*} \begin{equation*}
\begin{aligned} \begin{aligned}
\text{max} &\; 85x + 110y \\ \text{max} &\; (85 - 25) x + (110 - 40) y \\
\text{s.t.} & \begin{cases} \text{s.t.} & \begin{cases}
25 x + 40 y \leq 7000 \\ 25 x + 40 y \leq 7000 \\
x + y \leq 265 \\ x + y \leq 265 \\
@ -128,66 +130,51 @@ We first solve the system of inequalities for y:
\end{cases} \end{cases}
= =
\begin{cases} \begin{cases}
y < 280 - x \\ y < 175 - \frac{5}{8}x \\
x \leq 265 - x \\ x \leq 265 - x \\
x, y \geq 0 x, y \geq 0
\end{cases} \end{cases}
\] \]
From this solution it is clear that the region of satisfactory $x$s and $y$s is From this solution it is clear that the region of satisfactory $x$s and $y$s is
bounded by $x = 0$, $y = 0$, and $y = 265 - x$. bounded by $x = 0$, $y = 0$, $y = 265 - x$, and $y = 175 - \frac58 x$.
Here is a plot of the feasability region: Here is a plot of the feasability region:
\begin{center} \begin{center}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm] \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
\begin{axis}[ \begin{axis}[
x=0.03cm,y=0.03cm, x=0.015cm,y=0.015cm,
axis lines=middle, axis lines=middle,
xmin=-10,ymin=-10,xmax=275,ymax=275] xmin=-10,ymin=-10,xmax=300,ymax=300]
\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] \fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612]
(0,265) -- (0,0) -- (265,0) -- cycle; (265,0) -- (240,25) -- (0,175) -- (0,0) -- cycle;
\draw [line width=2pt,color=zzttqq] (0,265)-- (0,0); \draw [line width=2pt] (0,175)-- (280,0);
\draw [line width=2pt,color=zzttqq] (0,0)-- (265,0); \draw [line width=2pt] (265,0)-- (0,265);
\draw [line width=2pt,color=zzttqq] (265,0)-- (0,265);
\end{axis} \end{axis}
\end{tikzpicture} \end{tikzpicture}
\end{center} \end{center}
We then proceed to evaluate the maximization function at all verticies of the We then proceed to evaluate the maximization function at all verticies of the
feasability region, i.e. $\{ (0, 0), (0, 265), (265, 0) \}$. feasability region, i.e. $\{ (0, 0), (265, 0), (0, 175), (240,25) \}$.
\[ m(x, y) = 85x + 110y \] \[ m(x, y) = 60x + 70y \]
\[\begin{aligned} \[\begin{aligned}
m(0,0) = 0 \\ m(0,0) = 0 \\
m(0,265) = 29150 \\ m(0,175) = 12250 \\
m(265,0) = 22525 \\ m(240,25) = 16150 \\
m(265,0) = 15900 \\
\end{aligned}\] \end{aligned}\]
We then conclude the tailor should produce 265 trousers of the second type, for We then conclude the tailor should produce 240 trousers of the first type and
a revenue of 29,150.-- Fr. 25 trousers of the second type, for
a revenue of 16,150.-- Fr.
\section{Implementation of the Simplex Method [35 points]} \section{Implementation of the Simplex Method [35 points]}
In this first part of the assignment, you are required to complete 2 functions The implementation of the simplex method can be found in the
which are part of a dummy implementation of the simplex method. Specifically you \texttt{Project\_6\_Claudio\_Maggioni/} folder.
have to complete the TODOs in:
\begin{itemize}
\item \emph{standardise.m}, which writes a maximisation or minimisation input
problem in standard form;
\item \emph{simplexSolve.m}, which solves a maximisation or minimisation
problem using the simplex method.
\end{itemize}
You are given also some already-implemented functions to help you in your task:
\emph{simplex.m} is a wrapper which calls all the functions necessary to find a
solution to the linear program; \emph{auxiliary.m} solves the auxiliary problem
to find a feasible starting basic solution of the linear program;
\emph{printSol.m} is a function which prints the optimal solution found by the
simplex algorithm. Finally, \emph{testSimplex.m} presents a series of 6
problems to check if your implementation is correct, before moving to the next
part of the assignment. Additional details to aid you in your implementation
can be found in the comments inside the code.
\section{Applications to Real-Life Example: Cargo Aircraft [25 points]} \section{Applications to Real-Life Example: Cargo Aircraft [25 points]}
@ -234,12 +221,123 @@ The following four cargos are available for shipment during the next flight:
\end{tabular} \end{tabular}
\end{center} \end{center}
Any proportion of the four cargos can be accepted, and the profit obtained for each cargo is increased by $10\%$ if it is put in $S_2$, by $20\%$ if it is put in $S_3$ and by $30\%$ if it is put in $S_4$, due to the better storage conditions. The objective of this problem is to determine which amount of the different cargos will be transported and how to allocate it among the different compartments, while maximising the profit of the owner of the cargo plane. Specifically you have to: Any proportion of the four cargos can be accepted, and the profit obtained for
\begin{enumerate} each cargo is increased by $10\%$ if it is put in $S_2$, by $20\%$ if it is put
\item Formulate the problem above as a linear program: what is the objective function? What are the constraints? Write down all equations, with comments explaining what you are doing. in $S_3$ and by $30\%$ if it is put in $S_4$, due to the better storage conditions
\item Create a script \emph{exercise2.m} which uses the simplex method implemented in the previous exercise to solve the problem. What is the optimal solution? Visualise it graphically and briefly comment the results obtained (are you surprised of this outcome on the basis of your data?). . The objective of this problem is to determine which amount of the different
\end{enumerate} cargos will be transported and how to allocate it among the different compartments,
while maximising the profit of the owner of the cargo plane.
\subsection{Formulate the problem above as a linear program: what is the
objective function? What are the constraints? Write down all equations, with
comments explaining what you are doing.}
From the problem description we can determine that this problem has 16 variables
$x_{i,j}$, where $1 \leq i,j \leq 4 \; i,j \in N$. Each variable represents a
weight in tonnes, with $i$ determining the type of cargo used and $j$ the
compartment used. Therefore the variables of this problem to optimize represent
how much cargo to put where and in which quantity.
From this initial discussion we can easily derive the objective function to
maximize (as the objective function will output revenue, and we want to be
greedy as most Swiss people):
\[\text{max}\; z =
\text{grandsum}\left[\left(\begin{bmatrix}135\\200\\410\\520\end{bmatrix}\cdot\begin{bmatrix}1&1.1&1.2&1.3
\end{bmatrix}\right) \odot \begin{bmatrix}
x_{1,1}&x_{1,2}&x_{1,3}&x_{1,4}\\
x_{2,1}&x_{2,2}&x_{2,3}&x_{2,4}\\
x_{3,1}&x_{3,2}&x_{3,3}&x_{3,4}\\
x_{4,1}&x_{4,2}&x_{4,3}&x_{4,4}\\\end{bmatrix}\right]\]
where $\odot$ is an element-wise or Hadamard product and $\text{grandsum}(A)$
simply sums all elements of $A$. The column vector represents the value per
ton of each good while the row vector represents the revenue multipliers
associated with each cargo hold.
We can move to cargo hold constraints on weight, which check if the cargo holds are
overloaded:
\[\begin{aligned}
\sum_{i = 1}^4 x_{i,1} \leq 18 & \hspace{1cm} & \sum_{i = 1}^4 x_{i,2} \leq 32
& \hspace{1cm} &
\sum_{i = 1}^4 x_{i,3} \leq 25 & \hspace{1cm} & \sum_{i = 1}^4 x_{i,4} \leq 17
\end{aligned}\]
Then we consider compartment constraints on space, which check if the cargos
will fit:
\[\begin{aligned}
320 x_{1,1} + 510 x_{2,1} + 630 x_{3,1} + 125 x_{4,1} \leq &\; 11930 \\
320 x_{1,2} + 510 x_{2,2} + 630 x_{3,2} + 125 x_{4,2} \leq &\; 22552 \\
320 x_{1,3} + 510 x_{2,3} + 630 x_{3,3} + 125 x_{4,3} \leq &\; 11209 \\
320 x_{1,4} + 510 x_{2,4} + 630 x_{3,4} + 125 x_{4,4} \leq &\; 5870 \\
\end{aligned}\]
Then we have a final set of constraints to check if we are loading more cargo
than we own:
\[\begin{aligned}
\sum_{i=1}^4 x_{1,i} \leq 16 & \hspace{1cm} &
\sum_{i=1}^4 x_{1,i} \leq 32 & \hspace{1cm} &
\sum_{i=1}^4 x_{1,i} \leq 40 & \hspace{1cm} &
\sum_{i=1}^4 x_{1,i} \leq 28
\end{aligned}\]
Therefore, we have a final minimization problem in standard form with 16
variables and 12 feasability constraints.
\subsection{Create a script \emph{exercise3.m} which uses the simplex method
implemented in the previous exercise to solve the problem. What is the optimal
solution? Visualise it graphically and briefly comment the results obtained
(are you surprised of this outcome on the basis of your data?)}
The file that solves this problem using our MATLAB's implementation of the
simplex method can be found in the \emph{exercise3.m} file.
The optimal solution according to the simplex method is the following:
\[\begin{bmatrix}
x_{1,1}&x_{1,2}&x_{1,3}&x_{1,4}\\
x_{2,1}&x_{2,2}&x_{2,3}&x_{2,4}\\
x_{3,1}&x_{3,2}&x_{3,3}&x_{3,4}\\
x_{4,1}&x_{4,2}&x_{4,3}&x_{4,4}\\\end{bmatrix} =
\begin{bmatrix}0&0&0&0\\18&6&0&0\\0&26&14&0\\0&0&11&17\end{bmatrix}\]
The revenue for this load is of 41890.- Fr.
Figure~\ref{fig:hist} shows a graphical representation of this solution.
The solution seems quite intuitive: the simplex method seems to have found quite
a greedy solution, placing the most valuable cargo in the ``best'' cargo hold,
proceeding with less valuable cargos and ``worse'' cargo holds once either the
filling constraints of the hold are reached or we run out of our most valuable
cargo left.
It is notable that weight limits are reached before space limits, but in
hindsight it is a quite likely scenario for a cargo plane. This problem has
quite realistic data, as the total weight limit (82 tonnes) matches almost
exactly the designed load capacity of a cargo variant Boeing 747
(81.6 tonnes\footnote{Source: Wikipedia at
\url{https://en.wikipedia.org/wiki/Boeing_747\#Background}}).
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[ybar interval,
ymax=40,
ymin=0,
minor y tick num = 3,
xticklabels={{$S_1$},{$S_2$},{$S_3$},{$S_4$}}]
\addplot coordinates { (1,0) (2,0) (3,0) (4,0) (5,0) };
\addplot coordinates { (1,18) (2,6) (3,0) (4,0) (5,0) };
\addplot coordinates { (1,0) (2,26) (3,14) (4,0) (5,0) };
\addplot coordinates { (1,0) (2,0) (3,11) (4,17) (5,0) };
\legend {$C_1$, $C_2$, $C_3$, $C_4$}
\end{axis}
\end{tikzpicture}
\caption{Solution to the Cargo Airplane as an histogram of tonnes loaded per
cargo hold per cargo type. Y-axis is the amount tonnes loaded, X-axis is the cargo hold
where the cargo should be loaded, bar color is the cargo type loaded.}\label{fig:hist}
\end{figure}
\section{Cycling and Degeneracy [15 points]} \section{Cycling and Degeneracy [15 points]}
@ -252,10 +350,69 @@ Consider now the following simple problem:
& && x_1, x_2 \geq 0. & && x_1, x_2 \geq 0.
\end{alignat*} \end{alignat*}
\begin{enumerate} \subsection{Create a script \emph{exercise4.m} which uses the simplex method
\item Create a script \emph{exercise3.m} which uses the simplex method implemented above to solve this problem. Do you achieve convergence within the maximum number of iterations (given by the maximum number of possible basic solutions)? Do you notice any strange behaviour? (\emph{hint:} check, e.g., the indices of the entering and departing variables) implemented above to solve this problem. Do you achieve convergence within the
\item Look at the number of constraints and at the number of unknowns: what can you notice about the underlying system of equations? Represent them graphically and try to use this information to explain the behaviour of your solver in the previous point. maximum number of iterations (given by the maximum number of possible basic
\end{enumerate} solutions)? Do you notice any strange behaviour? (\emph{hint:} check, e.g., the
indices of the entering and departing variables)}
The MATLAB implementation for this problem can be found under file
\emph{exercise4.m} in the resources folder (i.e.
\texttt{Project\_6\_Claudio\_Maggioni/}).
The simplex method implementation for this problem fails with an error in the
auxiliary problem initialization. The error message is ``The original LP problem does not admit a feasible
solution''. This error message appears when the simplex method does not
converge in the expected maximum number of iterations. The large number of
iterations (793 before forced termination) is caused by an ``oscillation'' or
vicious cycle of swap operations between matrix $B$ and matrix $D$. This
oscillation is cause by the fact that entering and departing variable indexes do
not change, and stay fixed at values 6 and 4 from the second iteration onwards.
This causes an unnecessary continuous oscillation between two solutions that are
equally not optimal ($z = 28$) according to the auxiliary problem definition,
terminating the auxiliary algorithm abnormally after too many iterations.
\subsection{Look at the number of constraints and at the number of unknowns:
what can you notice about the underlying system of equations? Represent them
graphically and try to use this information to explain the behaviour of your
solver in the previous point.}
In figure~\ref{fig:strange} lies a graphical representation of this linear
programming problem.
The anomaly in the feasability region of this problem is that its perimeter has
triangular shape, and it is made up only of one constraint other than the
trivial positivity constraints at the axes (i.e. the constraints different from
$4x +2y \leq 8$ do not make a difference in the feasability region).
\begin{figure}[h]
\centering
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-0.5,
ymin=-0.5,
xmax=6,
ymax=6]
\clip(-4.052471790978185,-1.8483084480511438) rectangle (6.897018211059206,6.075664579739015);
\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (0,4) -- (0,0) -- (2,0) -- cycle;
\draw [line width=2pt,domain=0:6] plot(\x,{(-12--4*\x)/-3});
\draw [line width=2pt,domain=0:6] plot(\x,{(-8--4*\x)/-2});
\draw [line width=2pt,domain=0:6] plot(\x,{(--8-4*\x)/1});
\draw [line width=2pt] (0,-1.8483084480511438) -- (0,6.075664579739015);
\draw [line width=2pt,domain=0:6] plot(\x,{(-0-0*\x)/1});
\draw [line width=2pt,color=zzttqq] (0,4)-- (0,0);
\draw [line width=2pt,color=zzttqq] (0,0)-- (2,0);
\draw [line width=2pt,color=zzttqq] (2,0)-- (0,4);
\end{axis}
\end{tikzpicture}
\caption{Feasability region plot of maximization problem for exercise 4. Note
the fact that the region perimeter is a triangle.}\label{fig:strange}
\end{figure}
\end{document} \end{document}