asherikov/qpmad

Incorrect results from getInequalityDual for unconstrained problems

miker2 opened this issue · 2 comments

I've run into an issue recently when using qpmad and calling getInequalityDual despite my call to solve() returning OK.

I've identified the issue to be due to lazy initialization of the ActiveSet variables. Lazy initialization of these variables happens here: https://github.com/asherikov/qpmad/blob/master/include/qpmad/solver.h#L357 which may never be called despite the problem being solved successfully.

The result in my case is an exception being thrown because getInequalityDual is trying to allocate a matrix of arbitrary size (e.g. in my case >1e8 elements)

My solution to this problem is to brace initialize the sizes in active_set.h to zero (see attached patch), which solves the exception problem, but probably isn't doing the right thing regards to initializing the sizes to the correct values.

Would the more correct thing to do be to move the call to initializeMachineryLazy outside of the if block (or even before the containing for loop) at the expense of some performance?

init_sizes.txt

This should fix it I think -> https://github.com/asherikov/qpmad/tree/as_getdual_fix, pls add a test case.

merged.