%% Solve Integer Programming Problem with Nondefault Options
% Solve the problem
% \[\mathop {\min }\limits_x \left( { - 3{x_1} - 2{x_2} - {x_3}} \right)\;{\rm{subject}}\;{\rm{to}}\left\{ {\begin{array}{*{20}{l}}
% {{x_3}\;{\rm{binary}}}\\
% {{x_1},{x_2} \ge 0}\\
% {{x_1} + {x_2} + {x_3} \le 7}\\
% {4{x_1} + 2{x_2} + {x_3} = 12}
% \end{array}} \right.\]
% without showing iterative display.

x = optimvar('x',2,1,'LowerBound',0);
x3 = optimvar('x3','Type','integer','LowerBound',0,'UpperBound',1);
prob = optimproblem;
prob.Objective = -3*x(1) - 2*x(2) - x3;
prob.Constraints.cons1 = x(1) + x(2) + x3 <= 7;
prob.Constraints.cons2 = 4*x(1) + 2*x(2) + x3 == 12;

options = optimoptions('intlinprog','Display','off');

sol = solve(prob,'Options',options)

% Examine the solution.

sol.x
sol.x3

% Copyright 2012 The MathWorks, Inc.