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);

Comments

Almost all solvers are prone to return slightly infeasible solution, hence it is up to the user to judge if a given solution actually is practically feasible or infeasible.

Also note that check only computes residuals. It does not judge if these indicate infeasibility. Once again, it is up to the user to interpret these numbers.

Leave a Comment