jarredbarber/eigen-QP

Solver Produces Incorrect Solutions

Closed this issue · 3 comments

I have attached a minimal example that demonstrates issues with quadprog.

The solution to this QP should be equal to the value of c, but quadprog sets x to nan.

#include "eigen-qp.hpp"
#include <Eigen/Core>
#include <iostream>
using namespace std;

int main(int argc, char **argv){
   Eigen::Matrix<double, 2,1> x;
   Eigen::Matrix<double, 2,2> Q = 2*Eigen::Matrix<double, 2,2>::Identity();
   Eigen::Matrix<double, 2,1> c = 2*Eigen::Matrix<double, 2,1>::Random();
   Eigen::Matrix<double, 2,2> A; A << 0,0,0,0; 
   
   Eigen::Matrix<double, 2,1> b; b << 1.0,1.0;
   
   EigenQP::quadprog(Q,c,A,b,x);
   cout << x << endl;

}

Hello @jarredbarber! Thanks for the awesome library.

Any news on this? Did someone find a solution?

I traced the issue and it comes from here.

No news; I haven't had time to work on this, but if you have any ideas feel free to submit a PR.

This is fixed now. There were some math mistakes that (IIRC) were fixed in a version that never got pushed to Github.