Log the optimization process (values, Jacobians, time taken etc.). More...
#include <roboptim/core/optimization-logger.hh>
Public Types | |
| enum | LogRequestFlag { LOG_X = 1 << 0, LOG_COST = 1 << 1, LOG_CONSTRAINT = 1 << 2, LOG_CONSTRAINT_JACOBIAN = 1 << 3, LOG_CONSTRAINT_VIOLATION = 1 << 4, LOG_TIME = 1 << 5, LOG_SOLVER = 1 << 6 } |
| Requests supported by the logger. More... | |
| typedef SolverCallback< S > | parent_t |
| typedef S | solver_t |
| typedef solver_t::problem_t | problem_t |
| typedef solver_t::problem_t::value_type | value_type |
| typedef solver_t::problem_t::size_type | size_type |
| typedef solver_t::problem_t::result_t | result_t |
| typedef solver_t::solverState_t | solverState_t |
| typedef solver_t::callback_t | callback_t |
| typedef solver_t::problem_t::function_t::traits_t | traits_t |
| typedef solver_t::problem_t::function_t | function_t |
| typedef function_t::matrix_t | jacobian_t |
| typedef function_t::argument_t | argument_t |
| typedef function_t::const_argument_ref | const_argument_ref |
| typedef GenericDifferentiableFunction < traits_t > | differentiableFunction_t |
| typedef unsigned int | logRequest_t |
Public Types inherited from roboptim::SolverCallback< S > | |
| typedef S | solver_t |
| Solver type. More... | |
| typedef solver_t::problem_t | problem_t |
| Solver problem type. More... | |
| typedef solver_t::callback_t | callback_t |
| Per-iteration callback type. More... | |
| typedef solver_t::solverState_t | solverState_t |
| State of the solver. More... | |
Public Member Functions | |
| OptimizationLogger (solver_t &solver, const boost::filesystem::path &path, bool selfRegister=true, logRequest_t requests=FullLogging()) | |
| Constructor. More... | |
| virtual | ~OptimizationLogger () |
| Destructor. More... | |
| void | append (const std::string &text) |
| Append extra information to the log file. More... | |
| OptimizationLogger< S > & | operator<< (const std::string &text) |
| Append extra information to the log file. More... | |
| template<typename U > | |
| OptimizationLogger< S > & | operator<< (const U &u) |
| Append extra information to the log file. More... | |
| bool | isRequested (logRequest_t r) const |
| Determine if a given request was made by the user. More... | |
| const boost::filesystem::path & | logPath () const |
| Return the path of the log directory. More... | |
| virtual std::ostream & | print (std::ostream &o) const |
| Display the logger on the specified output stream. More... | |
| template<typename U > | |
| OptimizationLogger< T > & | operator<< (const U &u) |
Public Member Functions inherited from roboptim::SolverCallback< S > | |
| SolverCallback (const std::string &name="unnamed callback") | |
| Solver callback constructor. More... | |
| virtual | ~SolverCallback () |
| Destructor. More... | |
| const std::string & | name () const |
| Return the name of the callback. More... | |
| callback_t | callback () |
| Callback function. More... | |
| void | operator() (const problem_t &pb, solverState_t &state) |
| Evaluate the callback. More... | |
Static Public Member Functions | |
| static logRequest_t | FullLogging () |
| Log everything. More... | |
Protected Member Functions | |
| void | perIterationCallback (const problem_t &pb, solverState_t &state) |
| Wrapper around the callback function that catch exceptions. More... | |
| virtual void | perIterationCallbackUnsafe (const typename solver_t::problem_t &pb, typename solver_t::solverState_t &state) |
| const boost::filesystem::path & | path () const |
| Return the path of the log directory. More... | |
| boost::filesystem::path & | path () |
| Return the path of the log directory. More... | |
| const solver_t & | solver () const |
| Return the solver associated with the logger. More... | |
| solver_t & | solver () |
| Return the solver associated with the logger. More... | |
| unsigned | callbackCallId () const |
| Return the callback iteration index. More... | |
Protected Member Functions inherited from roboptim::SolverCallback< S > | |
| virtual void | perIterationCallbackUnsafe (const problem_t &pb, solverState_t &state)=0 |
| The actual callback function. More... | |
Log the optimization process (values, Jacobians, time taken etc.).
| S | solver type. |
| typedef function_t::argument_t roboptim::OptimizationLogger< T >::argument_t |
| typedef solver_t::callback_t roboptim::OptimizationLogger< T >::callback_t |
| typedef function_t::const_argument_ref roboptim::OptimizationLogger< T >::const_argument_ref |
| typedef GenericDifferentiableFunction<traits_t> roboptim::OptimizationLogger< T >::differentiableFunction_t |
| typedef solver_t::problem_t::function_t roboptim::OptimizationLogger< T >::function_t |
| typedef function_t::matrix_t roboptim::OptimizationLogger< T >::jacobian_t |
| typedef unsigned int roboptim::OptimizationLogger< T >::logRequest_t |
| typedef SolverCallback<S> roboptim::OptimizationLogger< T >::parent_t |
| typedef solver_t::problem_t roboptim::OptimizationLogger< T >::problem_t |
| typedef solver_t::problem_t::result_t roboptim::OptimizationLogger< T >::result_t |
| typedef solver_t::problem_t::size_type roboptim::OptimizationLogger< T >::size_type |
| typedef S roboptim::OptimizationLogger< T >::solver_t |
| typedef solver_t::solverState_t roboptim::OptimizationLogger< T >::solverState_t |
| typedef solver_t::problem_t::function_t::traits_t roboptim::OptimizationLogger< T >::traits_t |
| typedef solver_t::problem_t::value_type roboptim::OptimizationLogger< T >::value_type |
| enum roboptim::OptimizationLogger::LogRequestFlag |
Requests supported by the logger.
TODO: use strongly typed enum when moving to C++11
|
explicit |
Constructor.
| solver | solver that will be logged. |
| path | path to the log directory. |
| selfRegister | whether the logger will register itself as a callback with the solver. Set this to false if you use it with a multiplexer. |
| requests | request the logging of specific data. |
References roboptim::iendl(), roboptim::OptimizationLogger< T >::isRequested(), roboptim::OptimizationLogger< T >::LOG_CONSTRAINT, roboptim::OptimizationLogger< T >::LOG_CONSTRAINT_VIOLATION, roboptim::OptimizationLogger< T >::LOG_COST, and roboptim::OptimizationLogger< T >::LOG_X.
|
virtual |
| void roboptim::OptimizationLogger< T >::append | ( | const std::string & | text | ) |
Append extra information to the log file.
| text | text to append. |
References roboptim::iendl().
|
protected |
Return the callback iteration index.
|
static |
Log everything.
| bool roboptim::OptimizationLogger< T >::isRequested | ( | logRequest_t | r | ) | const |
Determine if a given request was made by the user.
| r | request. |
Referenced by roboptim::OptimizationLogger< T >::OptimizationLogger().
| const boost::filesystem::path & roboptim::OptimizationLogger< T >::logPath | ( | ) | const |
Return the path of the log directory.
| OptimizationLogger< T > & roboptim::OptimizationLogger< T >::operator<< | ( | const std::string & | text | ) |
Append extra information to the log file.
| text | text to append. |
| OptimizationLogger<S>& roboptim::OptimizationLogger< T >::operator<< | ( | const U & | u | ) |
Append extra information to the log file.
| u | object to print. |
| OptimizationLogger<T>& roboptim::OptimizationLogger< T >::operator<< | ( | const U & | u | ) |
|
protected |
Return the path of the log directory.
|
protected |
Return the path of the log directory.
This method is protected since streams would need to be updated, and files that were already written moved to the new location.
|
protectedvirtual |
Wrapper around the callback function that catch exceptions.
| pb | optimization problem. |
| state | state of the solver after an iteration. |
Reimplemented from roboptim::SolverCallback< S >.
|
protectedvirtual |
References roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), and roboptim::split().
|
virtual |
Display the logger on the specified output stream.
| o | output stream used for display. |
Reimplemented from roboptim::SolverCallback< S >.
References roboptim::decindent(), roboptim::iendl(), and roboptim::incindent().
|
protected |
Return the solver associated with the logger.
|
protected |
Return the solver associated with the logger.