All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
roboptim::Result Class Reference

Represents the solution of an optimization problem. More...

#include <roboptim/core/result.hh>

Inheritance diagram for roboptim::Result:
roboptim::ResultWithWarnings

Public Types

typedef Function::size_type size_type
 Import size type from Function class. More...
 
typedef Function::value_type value_type
 Import value type from Function class. More...
 
typedef Function::vector_t vector_t
 Import vector type from Function class. More...
 
typedef Function::argument_t argument_t
 Import argument type from Function class. More...
 
typedef Function::result_t result_t
 Import result type from Function class. More...
 

Public Member Functions

 Result (const size_type inputSize, const size_type outputSize=1)
 Instantiate a result and fix input/output sizes. More...
 
virtual ~Result ()
 
virtual std::ostream & print (std::ostream &o) const
 Display the result on the specified output stream. More...
 

Public Attributes

size_type inputSize
 Input size (i.e. argument size). More...
 
size_type outputSize
 Output size (i.e. result size). More...
 
argument_t x
 Point found by the solver. More...
 
result_t value
 Function value at the point found by the solver. More...
 
result_t constraints
 Final constraints values. More...
 
value_type constraint_violation
 Final violation of the constraints. More...
 
vector_t lambda
 Lagrange multipliers. More...
 
std::vector< SolverWarningwarnings
 Vector of warnings. More...
 

Detailed Description

Represents the solution of an optimization problem.

This class is returned by a solver if a result has been found. It is a set of mutable fields representing the solution and its associated meta-information.

A vector of warnings is provided, which can help identify the cause of termination or possible issues in the optimization process.

Examples:
result.cc.

Member Typedef Documentation

typedef Function::argument_t roboptim::Result::argument_t

Import argument type from Function class.

typedef Function::result_t roboptim::Result::result_t

Import result type from Function class.

Import size type from Function class.

Import value type from Function class.

typedef Function::vector_t roboptim::Result::vector_t

Import vector type from Function class.

Constructor & Destructor Documentation

roboptim::Result::Result ( const size_type  inputSize,
const size_type  outputSize = 1 
)
explicit

Instantiate a result and fix input/output sizes.

Parameters
inputSizeinput size value
outputSizeoutput size value

References constraints, lambda, value, and x.

roboptim::Result::~Result ( )
virtual

Member Function Documentation

std::ostream & roboptim::Result::print ( std::ostream &  o) const
virtual

Display the result on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References constraint_violation, constraints, roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), roboptim::GenericFunction< T >::infinity(), inputSize, lambda, outputSize, value, warnings, and x.

Referenced by roboptim::operator<<().

Member Data Documentation

value_type roboptim::Result::constraint_violation

Final violation of the constraints.

Referenced by print().

result_t roboptim::Result::constraints

Final constraints values.

Referenced by print(), Result(), and roboptim::GenericDummySolverLastState< T >::solve().

size_type roboptim::Result::inputSize

Input size (i.e. argument size).

Referenced by print().

vector_t roboptim::Result::lambda

Lagrange multipliers.

The vector of multipliers is expected to be ordered as follows:

  • argument bounds multipliers (n),
  • constraints multipliers (m) as ordered in problem.constraints(),
  • objective multipliers (only relevant for multi-dimensional cost functions).

Referenced by roboptim::ResultAnalyzer< T >::checkKKT(), print(), Result(), and roboptim::GenericDummySolverLastState< T >::solve().

size_type roboptim::Result::outputSize

Output size (i.e. result size).

Referenced by print().

result_t roboptim::Result::value

Function value at the point found by the solver.

Referenced by print(), Result(), and roboptim::GenericDummySolverLastState< T >::solve().

std::vector<SolverWarning> roboptim::Result::warnings

Vector of warnings.

Each element of this vector is a potential problem that occurred during the optimization. It may also simply indicate how the optimization terminated (e.g. user-defined callback).

Referenced by print().