Drake
MathematicalProgramResult Class Referencefinal

The result returned by MathematicalProgram::Solve(). More...

#include <drake/solvers/mathematical_program_result.h>

Public Member Functions

 MathematicalProgramResult ()
 Constructs the result. More...
 
SolutionResult get_solution_result () const
 Gets SolutionResult. More...
 
void set_solution_result (SolutionResult solution_result)
 Sets SolutionResult. More...
 
const Eigen::VectorXd & get_x_val () const
 Gets the decision variable values. More...
 
void set_x_val (const Eigen::VectorXd &x_val)
 Sets the decision variable values. More...
 
double get_optimal_cost () const
 Gets the optimal cost. More...
 
void set_optimal_cost (double optimal_cost)
 Sets the optimal cost. More...
 
const SolverIdget_solver_id () const
 Gets the solver ID. More...
 
void set_solver_id (const SolverId &solver_id)
 Sets the solver ID. More...
 
const AbstractValueget_solver_details () const
 Gets the solver details. More...
 
template<typename T >
T & SetSolverDetailsType ()
 Forces the solver_details to be stored using the given type T. More...
 
SolverResult ConvertToSolverResult () const
 Convert MathematicalProgramResult to SolverResult. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 MathematicalProgramResult (const MathematicalProgramResult &)=default
 
MathematicalProgramResultoperator= (const MathematicalProgramResult &)=default
 
 MathematicalProgramResult (MathematicalProgramResult &&)=default
 
MathematicalProgramResultoperator= (MathematicalProgramResult &&)=default
 

Detailed Description

The result returned by MathematicalProgram::Solve().

It stores the solvers::SolutionResult (whether the program is solved to optimality, detected infeasibility, etc), the optimal value for the decision variables, the optimal cost, and solver specific details.

Constructor & Destructor Documentation

◆ MathematicalProgramResult() [1/3]

◆ MathematicalProgramResult() [2/3]

◆ MathematicalProgramResult() [3/3]

Constructs the result.

Note
The solver_details is set to nullptr.

Member Function Documentation

◆ ConvertToSolverResult()

SolverResult ConvertToSolverResult ( ) const

Convert MathematicalProgramResult to SolverResult.

Note
This function doesn't set optimal_cost_lower_bound. If SolverResult.optimal_cost_lower_bound needs to be set (like in GurobiSolver), then the user will have to set it after calling ConvertToSolverResult.

◆ get_optimal_cost()

double get_optimal_cost ( ) const
inline

Gets the optimal cost.

◆ get_solution_result()

SolutionResult get_solution_result ( ) const
inline

Gets SolutionResult.

◆ get_solver_details()

const AbstractValue & get_solver_details ( ) const

Gets the solver details.

Throws an error if the solver_details has not been set.

◆ get_solver_id()

const SolverId& get_solver_id ( ) const
inline

Gets the solver ID.

◆ get_x_val()

const Eigen::VectorXd& get_x_val ( ) const
inline

Gets the decision variable values.

◆ operator=() [1/2]

◆ operator=() [2/2]

MathematicalProgramResult& operator= ( const MathematicalProgramResult )
default

◆ set_optimal_cost()

void set_optimal_cost ( double  optimal_cost)
inline

Sets the optimal cost.

◆ set_solution_result()

void set_solution_result ( SolutionResult  solution_result)
inline

Sets SolutionResult.

◆ set_solver_id()

void set_solver_id ( const SolverId solver_id)
inline

Sets the solver ID.

◆ set_x_val()

void set_x_val ( const Eigen::VectorXd &  x_val)
inline

Sets the decision variable values.

◆ SetSolverDetailsType()

T& SetSolverDetailsType ( )
inline

Forces the solver_details to be stored using the given type T.

If the storage was already typed as T, this is a no-op. If there were not any solver_details previously, or if it was of a different type, initializes the storage to a default-constructed T. Returns a reference to the mutable solver_details object. The reference remains valid until the next call to this method, or until this MathematicalProgramResult is destroyed.


The documentation for this class was generated from the following files: