wingsit / qp Goto Github PK
View Code? Open in Web Editor NEWqp
qp
Hello,
I am using uQuadProg to solve problem with several inequalities and no equalities. It happens, that for some solutions "x" the citeria "CI^T*x+ci0 >= 0" is not met, but the cost function is not equal to infinity. I am passing empty matrices CE and ce0. If I try to pass something like CE=0 ce0 = 0, the program crashes reporting, that the CE and ce0 is linearly dependent.
My understanding is that if the criteria CI^T*x+ci0 >= 0 is not met, then the problem is infeasible and therefore the cost function should be infinity. Am I wrong here? How should I interpret the result x then?
Thanks.
The code crashed when I try to find the best solution without an equality constraint. I tried setting the Ce matrix to an empty matrix, and its says that the code expects N rows for an N-dimensional problem. So then I tried creating an Nx1 matrix filled with zeros. That didn't work.
I tried to specify a very simple program (here it is actually not even specified, the containers are just setup) that has no constraints. You can see that I tried to make the constraint matrices have zero rows:
Eigen::MatrixXd Ci(n,0);
and the constraint vectors have zero length:
int zero = 0;
Eigen::VectorXd ce(zero);
Here is the code, but when I run it I get:
QPDemo: /home/doriad/src/QP/eigen/Eigen/src/Core/Matrix.h:235: Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Matrix(Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Index) [with _Scalar = double; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1; Eigen::Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::Index = long int]: Assertion `dim > 0' failed.
Can you please let me know how to specify a problem with no constraints?
int main (int argc, char *const argv[])
{
int n = 2;
Eigen::MatrixXd G(n,n);
Eigen::MatrixXd Ci(n,0);
Eigen::MatrixXd Ce(n,0);
Eigen::VectorXd g0(n);
int zero = 0;
Eigen::VectorXd ce(zero);
Eigen::VectorXd ci(zero);
Eigen::VectorXd x(n);
double objectiveValue = QP::solve_quadprog(G, g0, Ce, ce, Ci, ci, x);
std::cout << "objectiveValue: " << objectiveValue << std::endl;
std::cout <<"Solution:" << std::endl << x << std::endl;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.