Opened 3 years ago

Closed 3 years ago

#50 closed user support (wontFix)

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

Reported by: yutaochen Owned by: ferreau
Priority: normal Milestone:
Component: used in external package Version: prior to 3.0
Keywords: ACADO Cc:


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?

Change History (14)

comment:1 Changed 3 years ago by ferreau

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?

comment:2 Changed 3 years ago by yutaochen

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.

comment:3 Changed 3 years ago by ferreau

  • Component changed from Matlab interface to used in external package
  • Keywords ACADO added
  • Status changed from new to assigned
  • Version changed from 3.2.0 to prior to 3.0

comment:4 Changed 3 years ago by ferreau

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.

comment:5 Changed 3 years ago by ferreau

  • Summary changed from Error code 31 to Error code 31 in version 1.3 used in ACADO (error code 35 in latest version)

comment:6 Changed 3 years ago by yutaochen

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

comment:7 Changed 3 years ago by ferreau

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.

comment:8 Changed 3 years ago by yutaochen

Thank you. I work with qpoases3 now in ACADO but I found that the 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.


comment:9 Changed 3 years ago by ferreau

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

  • 1: maximum number of iterations reached
  • 0: solution found
  • -1: internal error
  • -2: infeasible problem
  • -3: unbounded problem

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 and we will keep it confidential.

comment:10 Changed 3 years ago by yutaochen

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?

comment:11 Changed 3 years ago by ferreau

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.

comment:12 Changed 3 years ago by yutaochen

Hi Ferreau,

I have send you an email with generated code and data to the address ""

It would be appreciated if you can have a look.

Thank you!

comment:13 Changed 3 years ago by ferreau

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.

Last edited 3 years ago by ferreau (previous) (diff)

comment:14 Changed 3 years ago by ferreau

  • Resolution set to wontFix
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.