Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geometric and numerical aspects of redundancy #3

Closed
stephane-caron opened this issue Dec 12, 2022 · 0 comments
Closed

Geometric and numerical aspects of redundancy #3

stephane-caron opened this issue Dec 12, 2022 · 0 comments

Comments

@stephane-caron
Copy link
Member

I propose to add the following problem to the github_ffa test set. The problem can be constructed as follows:

def get_problem(alpha: float):
    return Problem(
        P=np.eye(2),
        q=np.zeros(2),
        G=None,
        h=None,
        A=np.array([[1.0, 0.0], [1.0, alpha]]).reshape((1, 2)),
        b=np.array([0.0, 1.0]),
        lb=None,
        ub=None,
        name=f"weds_{alpha=}",
        optimal_cost=0.5 / (1 + alpha ** 2),
    )

Motivation

This problem is fully determined by its constraints, that is, the cost function is irrelevant. The condition number of the constraints matrix is $1/\alpha$, which can trip some solvers off depending on their algorithm.

For instance, OSQP solves the problem for $\alpha=10^{-3}$:

In [14]: P, q, A, b = get_problem(1e-3) 
    ...: solve_qp(P, q, A=A, b=b, solver="osqp")                                                                                                   
/home/frankd/src/qpsolvers/qpsolvers/solvers/conversions/warnings.py:35: UserWarning: Converted P to scipy.sparse.csc.csc_matrix
For best performance, build P as a scipy.sparse.csc_matrix rather than as a numpy.ndarray
  warnings.warn(
/home/frankd/src/qpsolvers/qpsolvers/solvers/conversions/warnings.py:35: UserWarning: Converted A to scipy.sparse.csc.csc_matrix
For best performance, build A as a scipy.sparse.csc_matrix rather than as a numpy.ndarray
  warnings.warn(
Out[14]: array([-1.29069624e-09,  1.00000000e+03])

But it wrongly asserts that the problem is unfeasible for $\alpha=10^{-4}$:

In [15]: P, q, A, b = get_problem(1e-4) 
    ...: solve_qp(P, q, A=A, b=b, solver="osqp")                                                                                                   
/home/frankd/src/qpsolvers/qpsolvers/solvers/conversions/warnings.py:35: UserWarning: Converted P to scipy.sparse.csc.csc_matrix
For best performance, build P as a scipy.sparse.csc_matrix rather than as a numpy.ndarray
  warnings.warn(
/home/frankd/src/qpsolvers/qpsolvers/solvers/conversions/warnings.py:35: UserWarning: Converted A to scipy.sparse.csc.csc_matrix
For best performance, build A as a scipy.sparse.csc_matrix rather than as a numpy.ndarray
  warnings.warn(
/home/frankd/src/qpsolvers/qpsolvers/solvers/osqp_.py:192: UserWarning: OSQP exited with status 'primal infeasible'
  warnings.warn(f"OSQP exited with status '{res.info.status}'")

Solution

The solution $(x^*, y^*)$ to this problem is $x^* = 0$, $y^* = \frac{1}{\alpha}$.

References

This problem is inspired from Geometric and numerical aspects of redundancy. GHFFA01 is a relaxed version of this problem.

@stephane-caron stephane-caron transferred this issue from qpsolvers/qpbenchmark Dec 14, 2023
@stephane-caron stephane-caron changed the title [GHFFA02] Geometric and numerical aspects of redundancy Geometric and numerical aspects of redundancy Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant