Skip to content

Commit

Permalink
Merge pull request #126 from fabinsch/get-obj-value
Browse files Browse the repository at this point in the history
Solver: add function to get the objective value
  • Loading branch information
GiulioRomualdi authored Nov 17, 2022
2 parents 3a15343 + d7326fb commit 376bb1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/OsqpEigen/Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ namespace OsqpEigen
*/
OsqpEigen::Status getStatus() const;

/**
* Get the primal objective value
* @return The primal objective value
*/
const c_float getObjValue() const;

/**
* Get the optimization problem solution.
* @return an Eigen::Vector contating the optimization result.
Expand Down
5 changes: 5 additions & 0 deletions src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ OsqpEigen::Status OsqpEigen::Solver::getStatus() const
return static_cast<OsqpEigen::Status>(m_workspace->info->status_val);
}

const c_float OsqpEigen::Solver::getObjValue() const
{
return m_workspace->info->obj_val;
}

OsqpEigen::ErrorExitFlag OsqpEigen::Solver::solveProblem()
{
if(!m_isSolverInitialized){
Expand Down

0 comments on commit 376bb1a

Please sign in to comment.