qpOASES icon indicating copy to clipboard operation
qpOASES copied to clipboard

Possible bug when using equality constraints

Open svigerske opened this issue 5 years ago • 5 comments

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 avatar Feb 23 '20 07:02 svigerske

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

svigerske avatar Feb 23 '20 07:02 svigerske

FYI @gabrielenava @GiulioRomualdi @MiladShafiee

traversaro avatar Mar 14 '20 09:03 traversaro

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

adamheins avatar Feb 12 '21 18:02 adamheins

Thanks a lot @adamheins !

traversaro avatar Feb 15 '21 14:02 traversaro

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.

steradiant avatar Mar 13 '21 14:03 steradiant