diff --git a/src/glpk-wrapper.cpp b/src/glpk-wrapper.cpp index 50d698248cce7a832305ec6129069339b2efe8cd..550844b68518cb594f3ea4b1382c3b5a364228cf 100644 --- a/src/glpk-wrapper.cpp +++ b/src/glpk-wrapper.cpp @@ -107,7 +107,8 @@ glp_load_matrix(lp,idConsMat-1,ia,ja,ar); int res = glp_simplex(lp, &opts); - if(res == 0) + res = glp_get_status(lp); + if(res == GLP_OPT) { cost = glp_get_obj_val(lp); //obtains a computed value of the objective function idrow = 1; diff --git a/src/solver-abstract.cpp b/src/solver-abstract.cpp index 86b543293dcb89dcb38d4a04c5329569118d7077..7964e9700940a02b72788ee72ea3f4505cb9186c 100644 --- a/src/solver-abstract.cpp +++ b/src/solver-abstract.cpp @@ -19,6 +19,7 @@ #include "solver/solver-abstract.hpp" #ifdef USE_GLPK_SOLVER #include <solver/glpk-wrapper.hpp> +#include <glpk.h> #endif #include <solver/eiquadprog-fast.hpp> @@ -135,7 +136,7 @@ ResultData solve( const MatrixXd & A, #ifdef USE_GLPK_SOLVER case SOLVER_GLPK: { - res.success_ = (solvers::solveglpk(g,D,d,A,b,minBounds, maxBounds,res.x,res.cost_) == 0); + res.success_ = (solvers::solveglpk(g,D,d,A,b,minBounds, maxBounds,res.x,res.cost_) == GLP_OPT); return res; } #endif diff --git a/tests/test-transition.cc b/tests/test-transition.cc index b198cc0331f0c631d63ff3386b1553ea4c0875a8..fafe64f99a96951081939c6f06deb76c1e2fdde3 100644 --- a/tests/test-transition.cc +++ b/tests/test-transition.cc @@ -150,6 +150,18 @@ void check_transition(bezier_com_traj::ProblemData& pData, VectorX Ts,bool shoul if(shouldFail){ BOOST_CHECK(!res.success_); + if(test_continuous) + { + res = bezier_com_traj::computeCOMTraj(pData,Ts,-1,solvers::SOLVER_QUADPROG); + BOOST_CHECK(!res.success_); + pData.representation_ == bezier_com_traj::FORCE; + res = bezier_com_traj::computeCOMTraj(pData,Ts,-1,solvers::SOLVER_QUADPROG); + BOOST_CHECK(!res.success_); +#ifdef USE_GLPK_SOLVER + res = bezier_com_traj::computeCOMTraj(pData,Ts,-1,solvers::SOLVER_GLPK); + BOOST_CHECK(!res.success_); +#endif + } return; }