check

Updated:

check is used to examine satisfaction of constraints.

Syntax

[primalfeas,dualfeas] = check(F);


Examples

After solving a problem, we can easily check how well the constraints are satisfied.

x = sdpvar(2,1);
F = [-1 <= x <= 1];
optimize(F,sum(x));
check(F)


The constraint residuals are defined as smallest eigenvalue, smallest element, negated largest absolute-value element and largest distance to an integer for semidefinite inequality, element-wise inequality, equality and integrality constraints respectively. Hence, a solution is feasible if all residuals related to inequalities are non-negative.

Sometimes it is convenient to have the numerical values of the primal and dual constraint violations

[primalfeas,dualfeas] = check(F);