%
% Numerical Mathematics and Computing, Fifth Edition
% Ward Cheney & David Kincaid
% Brooks/Cole Publ. Co.
% (c) 2003
%
% file:  lin_prog3
%
% Minimize the objective function subject to given equality constraints
%
% obj := u1 + v1 + u2 + v2 + u3 + v3;
% consts := {2*y1 + 3*y2 - 5*y3 - u1 + v1 = 4,
%              y1 - y2 - u2 +v2 = 2,
%              y1 + 2*y2 - 3*y3 - u3 + v3 = 7};
% simplex[minimize](obj, consts, NONNEGATIVE);
%
%  x =[ u1, v1, y1, u2, v2, y2, u3, v3, y3 ];
%
  f = [ 1.0; 1.0; 0.0; 1.0; 1.0; 0.0; 1.0; 1.0; 0.0 ];

  A = [];
  b = [];
  Aeq = [ -1.0, 1.0, 2.0,  0.0, 0.0,  3.0,  0.0, 0.0, -5.0; ...
           0.0, 0.0, 1.0, -1.0, 1.0, -1.0,  0.0, 0.0,  0.0; ...
           0.0, 0.0, 1.0,  0.0, 0.0,  2.0, -1.0, 1.0, -3.0 ];
  beq = [ 4.0; 2.0; 7.0 ];
  lb = [ 0.0; 0.0; 0.0; 0.0; 0.0; 0.0;0.0; 0.0; 0.0 ];
  ub = [ Inf; Inf; Inf; Inf; Inf; Inf; Inf; Inf; Inf ];
  x = linprog ( f, A, b, Aeq, beq, lb, ub )
