%% Solve an MILP with Linear Inequalities
% Solve the problem
%  \mathop {\min }\limits_x 8{x_1} + {x_2}{\rm{\ subject\ to\ }}\left\{ {\begin{array}{*{20}{l}}
% {{x_2}{\rm{\ is\ an\ integer}}}\\
% {{x_1} + 2{x_2} \ge  - 14}\\
% { - 4{x_1} - {x_2} \le  - 33}\\
% {2{x_1} + {x_2} \le 20.}
% \end{array}} \right.
% Write the objective function vector and vector of integer variables.

f = [8;1];
intcon = 2;

%
% Convert all inequalities into the form A*x <= b by multiplying “greater than” inequalities by -1.

A = [-1,-2;
    -4,-1;
    2,1];
b = [14;-33;20];

%
% Call intlinprog.

x = intlinprog(f,intcon,A,b)

% Copyright 2012 The MathWorks, Inc.