%% Compute Multiple Constraint Violations
% Check whether a point satisfies a constraint that has multiple conditions.
% Set up an optimization variable and a vector of constraints.

x = optimvar('x',3,2);
cons = sum(x,2) <= [1;3;2];

% Check whether the point pt.x = [1,-1;2,3;3,-1] satisfies these constraints.

pt.x = [1,-1;2,3;3,-1];
infeas = infeasibility(cons,pt)

% The point is not feasible with respect to the second constraint.
% Copyright 2012 The MathWorks, Inc.