Skip to content

Feature suggestion: post-solver feasibility tolerance checks #434

@rileyjmurray

Description

@rileyjmurray

Sometimes when I solve a problem, cvxpy's status code is "optimal", but the resulting cvxpy Constraint objects have very large violation (on the order of 1e0 or even 1e1 on an absolute scale).

Why might this happen?

  1. Interface languages like cvxpy (or yalmip) need the translate a low-level solver's status code to something in its parlance. For example, if MOSEK has status codes at the level of "optimal / near optimal / inaccurate / infeasible", how should cvxpy map these to its status codes of "optimal / inaccurate / infeasible"? This is a hard question and there is no perfect answer.

  2. The user specifies some precision with their formulation in mind, but it may be that much higher precision is needed to account for the transformations between the user's formulation and what the solver sees. Moreover, I imagine it is very difficult to algorithmically determine increased precision requirements given the problem transformations.

Why is this a problem?

  1. It is a reasonable expectation for the user that if a solver is called with a given tolerance (say, 1e-6), that they not be returned a solution that simultaneously has status code "optimal" and has an inequality constraint that's violated by many orders of magnitude above that tolerance (say, an absolute violation of ~1.5, for a total of 7 orders of magnitude difference from the specified tolerance).

  2. Experts in optimization can and should know better than to trust a status code, but cvxpy is targeted at a broad audience of scientists and engineers. By lowering the barrier to use of advanced optimization techniques, cvxpy should also raise the safegaurds against using it incorrectly. Both cvx and cvxpy already do this by issuing warning flags or flat-out refusing to solve problems which are easily verified as being non-convex.

What steps might be taken to address this problem?

In all honesty, I think it could be a very interesting area of research in optimization to consider how numerical issues in canonization or standardization should be factored into selecting precision criteria. While it is certainly beyond the scope of cvxpy's developers to single-handedly take on this issue, it would be nice to take some early steps in that direction. Here are some bare-bones changes to cvxpy that I think would meaningfully improve the situation:

  1. Create a global "feasibility override tolerance" parameter with some large default value (say 1e-4) that the user can change to their liking.
  2. Before a call to ".solve()" returns with status code "optimal", check that max(c.violation()) < TOL for every constraint c in the problem. If this condition fails, then override the status code to "post-solver infeasible" (or something to that affect).

What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions