QpOASES inscrutable Errors #23
-
|
Hiya all.
This is the error I'm getting when I run my code. However, I don't know what this error means and do not know how I should change my approach to fix it. Any suggestions are on how I could approach this are welcome including but not limited to:
I am relatively new to a large portion of what I am doing here so if I have made an obvious mistake or have posted this to the wrong place please let me know and I'll do my best to fix it. Edit: @mmmarinho Fixed the formatting of the output. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 20 replies
-
|
Welcome to the DQ Robotics community! The place is adequate, but more information is needed. Don't worry, our community will help you get up to speed. @juanjqo, could you please help @ElliotWinterbottom? Kind regards, |
Beta Was this translation helpful? Give feedback.
-
|
Hiya @bvadorno |
Beta Was this translation helpful? Give feedback.
-
|
Hiya @bvadorno. The Hessians and control inputs are available here along with some other hopefully useful data Thanks again, |
Beta Was this translation helpful? Give feedback.
-
|
It looks like the problem is non-convex (the matrix H you are using is not positive definite). I tried to solve the problem using minimal example:clear all
close all
clc
A = [eye(5,5); -eye(5,5)];
b = [148,148,148,148,1,148,148,148,148,-0.1]';
f= [0,0,0, 0,2000]';
H = [1.03859e+06,682318 ,248958,-185255, -4.8028e+07;
682318,576044,370956, 101739,7.36292e+06;
248958, 370956, 415868, 373893, 3.15979e+07;
-185255, 101739, 373893, 581917, 1.96213e+07;
-4.8028e+07, 7.36292e+06, 3.15979e+07, 1.96213e+07, 3.57663e+10];
options = optimoptions('quadprog','Display','iter', 'Algorithm','interior-point-convex');
[x,fval,exitflag,output,lambda] = quadprog(H, f, A, b, [], [], [], [],[], options)OutputSolved 0 variables, 0 equality, and 10 inequality constraints during the presolve.
The problem is non-convex.
x =
-0.0010
0.0010
0.0006
-0.0008
1.5800
fval =
4.4644e+10
exitflag =
-6
output =
struct with fields:
message: 'The problem is non-convex.'
algorithm: 'interior-point-convex'
firstorderopt: 5.6511e+10
constrviolation: 0.5800
iterations: 0
linearsolver: 'dense'
cgiterations: []
lambda =
struct with fields:
ineqlin: [10×1 double]
eqlin: [0×1 double]
lower: [5×1 double]
upper: [5×1 double]Checking the matrix H>> chol(H)
Error using chol
Matrix must be positive definite.If you are trying to solve a non-convex problem, maybe proxsuite could be an alternative. For instance, Caution The class DQ_PROXQPSolver.h is not an official DQ Robotics class and is experimental. #include <iostream>
#include <dqrobotics/DQ.h>
#include <dqrobotics/solvers/DQ_QPOASESSolver.h>
#include <dqrobotics/solvers/DQ_PROXQPSolver.h>
#include <memory>
using namespace DQ_robotics;
/**
* @brief solve_and_show_data solve using the solver list
* @param solver_names The list of the solver names to show
* @param solvers the list of the solvers
* @param H the n x n matrix of the quadratic coeficitients of the decision variables.
* @param f the n x 1 vector of the linear coeficients of the decision variables.
* @param A the m x n matrix of inequality constraints.
* @param b the m x 1 value for the inequality constraints.
* @param Aeq the m x n matrix of equality constraints.
* @param beq the m x 1 value for the inequality constraints.
*/
void solve_and_show_data(const std::vector<std::string>& solver_names,
const std::vector<std::shared_ptr<DQ_QuadraticProgrammingSolver>>& solvers,
const Eigen::MatrixXd& H,
const Eigen::VectorXd& f,
const Eigen::MatrixXd& A,
const Eigen::VectorXd& b,
const Eigen::MatrixXd& Aeq,
const Eigen::VectorXd& beq);
int main()
{
Eigen::Matrix<double,5,5> H;
Eigen::Vector<double,5> f;
Eigen::Matrix<double,10,5> A;
Eigen::Vector<double,10> b;
Eigen::MatrixXd Aeq; // empty equality constraints
Eigen::VectorXd beq;
A << MatrixXd::Identity(5,5), -MatrixXd::Identity(5,5);
b << 148,148,148,148,1,148,148,148,148,-0.1;
std::vector<std::string> solver_names = {"ProxQP", "qpOASES"};
std::vector<std::shared_ptr<DQ_QuadraticProgrammingSolver>>
solvers = {std::make_shared<DQ_PROXQPSolver>(), std::make_shared<DQ_QPOASESSolver>()};
H<<1.03859e+06,682318 ,248958,-185255, -4.8028e+07,
682318,576044,370956, 101739,7.36292e+06,
248958, 370956, 415868, 373893, 3.15979e+07,
-185255, 101739, 373893, 581917, 1.96213e+07,
-4.8028e+07, 7.36292e+06, 3.15979e+07, 1.96213e+07, 3.57663e+10;
f << 0,0,0, 0,2000;
solve_and_show_data(solver_names,solvers,H,f,A,b,Aeq,beq);
H<< 1.00041e+06 , 701754 , 270534 , -151405 , -4.74162e+07,
701754 , 653099 , 410488 , 115582 , 1.73432e+07,
270534 , 410488 , 417877 , 360139 , 3.09511e+07,
-151405 , 115582 , 360139 , 552401 , 1.76042e+07,
-4.74162e+07 , 1.73432e+07, 3.09511e+07, 1.76042e+07, 3.4999e+10;
solve_and_show_data(solver_names,solvers,H,f,A,b,Aeq,beq);
H << 994130 , 703431 , 273671 , -145626, -4.74491e+07,
703431 , 662732 , 416530 , 117741, 1.80003e+07,
273671 , 416530 , 420327 , 358725, 3.09832e+07,
-145626 , 117741 , 358725, 547122, 1.72701e+07,
-4.74491e+07, 1.80003e+07, 3.09832e+07, 1.72701e+07, 3.43859e+10;
solve_and_show_data(solver_names,solvers,H,f,A,b,Aeq,beq);
return 0;
}
void solve_and_show_data(const std::vector<std::string>& solver_names,
const std::vector<std::shared_ptr<DQ_QuadraticProgrammingSolver>>& solvers,
const Eigen::MatrixXd& H,
const Eigen::VectorXd& f,
const Eigen::MatrixXd& A,
const Eigen::VectorXd& b,
const Eigen::MatrixXd& Aeq,
const Eigen::VectorXd& beq)
{
std::cout<<"--------------------"<<std::endl;
int i = 0;
for (auto& solver : solvers)
{
try {
std::cout<<solver_names.at(i)<<": "<<solver->solve_quadratic_program(H, f,A,b,Aeq,beq).transpose()<<std::endl;
} catch (const std::exception& e) {
std::cout<<"Failed to solve! "<<e.what()<<std::endl;
}
i++;
}
std::cout<<"--------------------"<<std::endl;
}output: --------------------
ProxQP: 91.9142 -148 54.116 16.9945 0.0999905
qpOASES: 91.9179 -148 54.1071 17.0011 0.1
--------------------
--------------------
ProxQP: 37.9425 2.38489 -91.6269 66.4193 0.100962
qpOASES: 37.5809 2.36216 -90.7537 65.7864 0.1
--------------------
--------------------
ProxQP: 50.098 -46.171 -26.011 37.1316 0.101162
qpOASES: Failed to solve! DQ_QPOASESSolver::solve_quadratic_program(): Unable to solve quadratic program.
--------------------Kind regards, Juan |
Beta Was this translation helpful? Give feedback.
Thanks for the further explanation, @ElliotWinterbottom. Ah, I forgot you had another term related to the scaling factor. If$s$ is close to one, then it makes sense to have terms up to $10^6$ . The closed-loop gain won't be dominant because it'll add terms up to $10^4$ . So, what is really influencing the large values in th…