coin-or / qpOASES

Open-source C++ implementation of the recently proposed online active set strategy
GNU Lesser General Public License v2.1
365 stars 127 forks source link

Possible bug when using equality constraints #85

Open svigerske opened 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: gabrielenava

Original creation time: 2018-08-02 17:15:32

Assignee: ferreau

Version: 3.2.0

Hi all, I think I may have found a bug inside the qpOASES algorithm when performing a constrained optimization with equality constraints in MATLAB. In particular, I considered the following optimization problem:

min |u|^2

s.t. Au = 0

where u is a [29 1] vector and A is a [6 29] matrix with rank 6. In theory, this problem is well posed and the solution is u = 0. However, for some valid constraint matrices A qpOASES cannot find a solution, and returns the following error:


ERROR:  Division by zero
->ERROR:  Abnormal termination due to TQ factorisation
  ->ERROR:  Determination of step direction failed
    ->ERROR:  Abnormal termination due to TQ factorisation
      ->ERROR:  Initialisation failed! QP could not be solved!

Attached to this script there is a matlab code with an example. The constraint matrix is stored in a .mat file (attached to the issue, too). Also, relaxing the problem with inequality constraints of the form:

min |u|^2

  s.t. -eps < Au < eps,
        eps > 0

did not solve the issue. As an additional information, I noted that in case the problem is really unfeasible the error from qpOASES is different.

May you help me in understanding this issue? Thanks in advance.

svigerske commented 4 years ago

Attachment testQPOASES.zip by gabrielenava created at 2018-08-02 17:16:13

traversaro commented 4 years ago

FYI @gabrielenava @GiulioRomualdi @MiladShafiee

adamheins commented 3 years ago

This issue is quite old by now, but in case someone else runs into this with a deadline too close to try switching to another solver (like me!), I ran into the same error with a very similar problem setup (but using the C++ interface) and have seemingly been able to resolve it. My problem included a constraint of the form Ax = b, where A is 6x9, and the problem is known to be feasible.

To fix it, I set the solver options to "reliable". In C++, this is:

qpOASES::Options options;
options.setToReliable();

// qp is my QProblem object
qp.setOptions(options);

(see page 30 of the user manual).

traversaro commented 3 years ago

Thanks a lot @adamheins !

steradiant commented 3 years ago

I have the same issue. setting options.setToReliable(); didn't really solve the problem for me. I can solve a Problem with 148 constraints but as soon as the number of constraints is increasing, say to 180, I again get the error.