Code Monkey home page Code Monkey logo

qp's Issues

The constraints are not met, but the cost is not infinity

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.

crashes when I have an empty Ce matrix...

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.

How to specify a problem with no constraints?

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?

include

include "uQuadProg++.hh"

include <Eigen/Eigen>

include <EigenQP.h>

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;

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.