Skip to content

Commit

Permalink
Display error messages if any (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger authored Nov 27, 2024
1 parent f72d399 commit 07c0f1a
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,18 @@ void QPInverseProblemImpl::solveInverseProblem(double& objective,
}
}

problem.getPrimalSolution(lambda);
{
const qpOASES::returnValue primalResult = problem.getPrimalSolution(lambda);
msg_error_when(primalResult != qpOASES::SUCCESSFUL_RETURN, "QPInverseProblemImpl") << "getPrimalSolution failed";
}

objective = problem.getObjVal();

real_t * slack = new real_t[nbVariables+nbConstraints]; // dual solution: slack[0:nV-1] => corresponds to lambda, slack[nV:nC+1] => corresponds to dual variables
problem.getDualSolution(slack);
{
const qpOASES::returnValue dualResult = problem.getDualSolution(slack);
msg_error_when(dualResult != qpOASES::SUCCESSFUL_RETURN, "QPInverseProblemImpl") << "getDualSolution failed";
}

dual.resize(nbConstraints);
for (int i=0; i<nbConstraints; i++)
Expand Down Expand Up @@ -558,7 +565,7 @@ QProblem QPInverseProblemImpl::getNewQProblem(int& nWSR)
Options options;
problem.setOptions(options);

problem.setPrintLevel(qpOASES::PL_NONE);
problem.setPrintLevel(qpOASES::PL_LOW);

nWSR = 500; // problem.init() changes the variable nWSR with the number of working set recalculation it took to solve the problem. So we have to update it.

Expand Down

0 comments on commit 07c0f1a

Please sign in to comment.