coin-or / qpOASES

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

hotstart SQProblem with zero constraints #41

Closed svigerske closed 4 years ago

svigerske commented 4 years ago

Issue created by migration from Trac.

Original creator: roesmann

Original creation time: 2015-08-25 10:29:31

Assignee: ferreau

Version: 3.1.1

Hi!

I've observed a small issue regarding the SQProblem hotstart method. If the constraint matrix (A_new) is a nullptr (as suggested in the manual), the auxiliary QP quits with RET_INVALID_ARGUMENTS, even if nC=0.

The auxiliary QP itself seems to work with nC=0, so I was able to fix this issue by changing

if ( A_new != 0)
  dA = new DenseMatrix(nC, nV, nV, (real_t*) A_new);
else
  return THROWERROR( RET_INVALID_ARGUMENTS );

(SQProblem.cpp Line 525) to

if ( A_new != 0 || nC==0 )
  dA = new DenseMatrix(nC, nV, nV, (real_t*) A_new);
else
  return THROWERROR( RET_INVALID_ARGUMENTS );

The setupNewAuxiliaryQP call afterwards skips the modification since nC=0 without accessing dA (and its data nullptr).

By the way, thank you for this great software package!

Cheers,

Christoph

svigerske commented 4 years ago

Comment by ferreau created at 2015-08-25 13:26:33

Changing status from new to assigned.

svigerske commented 4 years ago

Comment by ferreau created at 2015-08-25 13:28:43

Thanks a lot for reporting this bug and even providing a fix along with it!

I made the following change to version 165 in trunk:

if ( A_new != 0 )
  dA = new DenseMatrix(nC, nV, nV, (real_t*) A_new);
else
  if ( nC > 0 )
    return THROWERROR( RET_INVALID_ARGUMENTS );
svigerske commented 4 years ago

Comment by ferreau created at 2015-08-26 07:51:08

Resolution: fixed