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

Error code 31 in version 1.3 used in ACADO (error code 35 in latest version) #50

Closed svigerske closed 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: yutaochen

Original creation time: 2016-05-19 15:29:41

Assignee: ferreau

Version: 3.2.0

I frequently encounter the error message 31 when using qpOASES in ACADO, which indicates that the LU factorization has failed. This error message is not so informative as other ones, i.e. error 33 (infeasibility). Even though a LM regularization option is turned on, I still have this error.

Are there any suggestions to avoid such an error?

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 07:49:39

Can you please verify whether is actually error code 31? That one reports

31 - Initialisation via extern QP solver is not yet implemented

and is no longer thrown by any routine. So if this error code really pops up, we would appreciate any example reproducing this bug.

As you mentioned LU factorization, could it rather be error code 34?

svigerske commented 4 years ago

Comment by yutaochen created at 2016-05-27 09:05:25

No, I'm referring the error message of the ACADO version qpOASES.

In the external package folder of ACADO, there is a qpOASES (not qpOASES 3 nor qpOASES 3.0 nor qpOASES 3.2.0)

The "MessageHandling.hpp" indicates that the error 31 is the "Initialisation failed due to Cholesky decomposition"

This error is confusing because it is not infeasibility. What I can only guess is that some matrix is not well-posed so the Cholesky decomposition is failed. But how can I solve this problem?

Thank you.

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 09:23:52

Changing component from Matlab interface to used in external package.

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 09:23:52

Changing keywords from "" to "ACADO".

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 09:23:52

Changing status from new to assigned.

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 09:23:52

Version changed from 3.2.0 to prior to 3.0

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 09:38:27

ACADO still offers to use qpOASES version 1.3 for code generated NMPC solvers. You may consider switching to qpOASES_e 3.1.1 by choosing the option

ocp.set( QP_SOLVER, QP_QPOASES3 );

It would be interesting to know whether the problem persists with the latest version of qpOASES(_e).

In any case, this error implies that no Cholesky decomposition of either the full or projected Hessian matrix could be computed. This can only happen if your matrix is not positive definite (the lastest version can actually also handle semi-definite Hessian matrices). That's why I would expect adding a sufficiently large Levenberg-Marquardt regularization to overcome this issue. If not, there is something else going wrong. But as we are not offering any support for version 1.3 anymore, we can only help you finding the issue if it is still existing in qpOASES_e 3.1.1 as mentioned above.

svigerske commented 4 years ago

Comment by yutaochen created at 2016-05-27 09:52:57

Thank you for the detailed answer.

How can I use the latest qpOASES in ACADO? just copy the folder of qpOASES 3.0 (or qpOASES 3 or qpOASES 3.2.0 to the current path?)

I get an error when compiling, but this works for the old qpOASES

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 10:05:59

You need to select the option

mpc.set( QP_SOLVER, QP_QPOASES3 );

in your OCP formulation (assuming you have an object mpc of type OCPexport. Re-compiling and exporting the code should automatically copy the folder external_packages\qpoases3 into your project sub-folder. If this is not working, please contact the ACADO support team.

svigerske commented 4 years ago

Comment by yutaochen created at 2016-05-27 15:23:37

Thank you. I work with qpoases3 now in ACADO but I found that the output.info.status is -2 or -1, which is not explained in the "MessageHandling.hpp". The error message reported by the old qpoases is 31. Hence I think there are some mismatches of error message handling when using qpoases3 in ACADO.

Thanks

svigerske commented 4 years ago

Comment by ferreau created at 2016-05-27 19:22:19

Within ACADO, qpOASES_e returns the same status codes as used in Matlab or Simulink, i.e.

So, it might be that the internal error (-1) corresponds again to a failed Cholesky decomposition. Would it be possible to send us the code that produces this problem, such that we can have a closer look? If you do not want to post it here, you can send it to support@qpoases.org and we will keep it confidential.

svigerske commented 4 years ago

Comment by yutaochen created at 2016-06-07 13:45:42

Because the problem is embedded with ACADO, we cannot send you the QP. If we send you the generated code(from ACADO code generation), is it possible for you to analyse?

svigerske commented 4 years ago

Comment by ferreau created at 2016-06-07 13:54:54

Yes, if you send us the exported ACADO code such that we can compile, run and re-produce the issue, we are happy to have a look.

svigerske commented 4 years ago

Comment by yutaochen created at 2016-06-10 10:15:47

Hi Ferreau,

I have send you an email with generated code and data to the address "support@qpoases.org"

It would be appreciated if you can have a look.

Thank you!

svigerske commented 4 years ago

Comment by ferreau created at 2016-06-15 11:56:51

Thanks for sending your code and data; I have been able to reproduce the described behaviour. By using qpOASES's utility function

char fileName[6] = "H.txt"; qpOASES_writeIntoFileM( acadoWorkspace.H, 300,300, fileName,BT_FALSE );

I have been exporting the QP data as well as the primal solution into a text file. Afterwards, I loaded that data and ran qpOASES_e stand-alone with the data. QPs 42 und 43 still yield the correct solution. QP 44 has a non positive definite Hessian matrix and Cholesky decomposition fails accordingly. Actually, the Hessian matrix of QP 44 looks rather weird, so it may be that ACADO builds it the wrong way. So, I suggest to contact the ACADO support and close this issue on the qpOASES side.

svigerske commented 4 years ago

Comment by ferreau created at 2016-06-15 13:27:55

Resolution: wontFix