humoto
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
humoto::ConfigurableOptimizationProblem Class Referenceabstract

Detailed Description

Class representing the hierarchy of the problem.

Definition at line 19 of file configurable_optimization_problem.h.

#include <configurable_optimization_problem.h>

Inheritance diagram for humoto::ConfigurableOptimizationProblem:
Inheritance graph

Public Member Functions

 ConfigurableOptimizationProblem ()
 Default constructor. More...
 
void computeViolations (humoto::Violations &violations, const humoto::Solution &solution) const
 Compute violations based on the solution. More...
 
void determineActiveSet (humoto::ActiveSet &active_set, const humoto::Solution &solution) const
 Determine active set based on the solution. This active set may differ from the active set returned by the solver due to tolerances. More...
 
void form (humoto::Solution &solution, const humoto::Model &model, const humoto::ControlProblem &control_problem)
 Form hierarchy. More...
 
void form (humoto::Solution &solution, humoto::ActiveSet &active_set_guess, const humoto::Model &model, const humoto::ControlProblem &control_problem)
 Form hierarchy. More...
 
void form (humoto::Solution &solution, humoto::Solution &solution_guess, humoto::ActiveSet &active_set_guess, const humoto::Model &model, const humoto::ControlProblem &control_problem, const humoto::Solution &old_solution)
 Form hierarchy. More...
 
void form (humoto::Solution &solution, humoto::Solution &solution_guess, const humoto::Model &model, const humoto::ControlProblem &control_problem, const humoto::Solution &old_solution)
 Form hierarchy. More...
 
std::size_t getNumberOfLevels () const
 Returns number of levels in the hierarchy. More...
 
template<class t_QPConstraints >
void getQPProblem (QPProblemBase< t_QPConstraints > &qp_problem, const humoto::SolutionStructure &sol_structure, const bool initialize_upper_triangular_part=true) const
 Form a QP problem. More...
 
void initializeActiveSet (humoto::ActiveSet &active_set) const
 Initialize active set of the hierarchy. More...
 
void log (humoto::Logger &logger, const LogEntryName &parent=LogEntryName(), const std::string &name="") const
 Log hierarchy as a set of tasks. More...
 
const humoto::HierarchyLeveloperator[] (const std::size_t level_index) const
 Access hierarchy level (const) More...
 
humoto::HierarchyLeveloperator[] (const std::size_t level_index)
 Access hierarchy level. More...
 
void processActiveSet (const humoto::ActiveSet &active_set)
 Process actual active set: extract active sets of individual tasks. More...
 
void pushTask (TaskSharedPointer task_pointer, const std::size_t level_index, const std::string &task_class_name)
 Push task to the hierarchy. More...
 
void pushTask (TaskSharedPointer task_pointer, const std::size_t level_index)
 Add task to the optimization problem. More...
 
void readConfig (t_Reader &reader, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read configuration (assuming the configuration node to be in the root). More...
 
void readConfig (t_Reader &reader, const std::string &node_name, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read configuration (assuming the configuration node to be in the root). More...
 
void readConfig (t_Reader &reader, const char *node_name, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read configuration (assuming the configuration node to be in the root). More...
 
void readConfig (const std::string &file_name, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read configuration (assuming the configuration node to be in the root). More...
 
void readConfig (const std::string &file_name, const std::string &node_name, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read configuration (assuming the configuration node to be in the root). More...
 
void readConfig (const std::string &file_name, const char *node_name, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read configuration (assuming the configuration node to be in the root). More...
 
void readNestedConfig (t_Reader &reader, const std::string &node_name, const bool crash_on_missing_entry=default_crash_on_missing_entry_)
 Read nested configuration node. More...
 
void reset (const std::size_t number_of_levels)
 Reset the optimization problem. More...
 
void writeConfig (t_Writer &writer) const
 Write configuration. More...
 
void writeConfig (t_Writer &writer, const std::string &node_name) const
 Write configuration. More...
 
void writeConfig (const std::string &file_name) const
 Write configuration. More...
 
void writeConfig (const std::string &file_name, const std::string &node_name) const
 Write configuration. More...
 
void writeNestedConfig (t_Writer &writer) const
 Write nested configuration node. More...
 
void writeNestedConfig (t_Writer &writer, const std::string &node_name) const
 Write nested configuration node. More...
 

Protected Member Functions

virtual void finalize ()
 This function is called automaticaly after reading a configuration file. Does nothing by default. More...
 
void formHierarchy (humoto::Solution &solution, const humoto::Model &model, const humoto::ControlProblem &control_problem, const bool is_active_set_guessing_enabled)
 Form hierarchy. More...
 
virtual const std::string & getConfigSectionID () const=0
 Return the default name of a configuration node corresponding to this class. More...
 
virtual humoto::TaskSharedPointer getTask (const std::string &string_id) const
 Fill map with all pointers to all tasks for given module. More...
 
void guessActiveSet (ActiveSet &active_set) const
 Form active set guess. More...
 
void setDefaults ()
 Initialize to default values. More...
 

Protected Attributes

std::vector< humoto::HierarchyLevelhierarchy_
 
std::vector< std::size_t > number_of_constraints_
 
std::size_t number_of_levels_
 
std::vector< std::vector< std::string > > task_class_names_
 
std::vector< std::vector< std::string > > task_ids_
 

Static Protected Attributes

static const bool default_crash_on_missing_entry_
 

Private Member Functions

std::size_t getNumberOfEntries () const
 Count entries. More...
 
template<class t_Reader >
void readConfigEntriesTemplate (t_Reader &reader, const bool crash_on_missing_entry=true)
 Read config entries. More...
 
template<class t_Writer >
void writeConfigEntriesTemplate (t_Writer &writer) const
 Write config entries. More...
 

Constructor & Destructor Documentation

◆ ConfigurableOptimizationProblem()

humoto::ConfigurableOptimizationProblem::ConfigurableOptimizationProblem ( )
inline

Default constructor.

Definition at line 31 of file configurable_optimization_problem.h.

Member Function Documentation

◆ computeViolations()

void humoto::OptimizationProblem::computeViolations ( humoto::Violations violations,
const humoto::Solution solution 
) const
inlineinherited

Compute violations based on the solution.

Parameters
[out]violationsviolations
[in]solutionsolution

Definition at line 221 of file hierarchy.h.

◆ determineActiveSet()

void humoto::OptimizationProblem::determineActiveSet ( humoto::ActiveSet active_set,
const humoto::Solution solution 
) const
inlineinherited

Determine active set based on the solution. This active set may differ from the active set returned by the solver due to tolerances.

Parameters
[out]active_setactive set
[in]solutionsolution

Definition at line 202 of file hierarchy.h.

◆ finalize()

virtual void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::finalize ( )
inlineprotectedvirtualinherited

This function is called automaticaly after reading a configuration file. Does nothing by default.

Reimplemented in humoto::WeightedSimpleTaskBaseMixin< constraints::ConstraintsGIB< TaskBase > >, humoto::WeightedSimpleTaskBaseMixin< constraints::ConstraintsGILU< TaskBase > >, humoto::WeightedSimpleTaskBaseMixin< constraints::ConstraintsGIL< TaskBase > >, humoto::WeightedSimpleTaskBaseMixin< constraints::ConstraintsGIU< TaskBase > >, humoto::WeightedSimpleTaskBaseMixin< constraints::ConstraintsGIB0< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsAB< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsAB0< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsASU< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsASL< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsASLU< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsAU< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsAL< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsASB< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsALU< TaskBase > >, humoto::GeneralTaskBaseMixin< constraints::ConstraintsASB0< TaskBase > >, humoto::pepper_mpc::MPCParameters, humoto::pepper_mpc::MotionParameters, humoto::walking::RobotFootParameters, humoto::wpg04::MPCParameters, humoto::pepper_mpc::RobotParameters, humoto::pepper_ik::WBCParameters, humoto::pepper_ik::GeneralizedCoordinates< t_features >, humoto::wpg04::TaskCoPPosition, humoto::wpg04::TaskCoMVelocity, humoto::wpg04::TaskCoPVelocity, and humoto::wpg04::TaskTerminalConstraint.

Definition at line 102 of file config.h.

◆ form() [1/4]

void humoto::OptimizationProblem::form ( humoto::Solution solution,
const humoto::Model model,
const humoto::ControlProblem control_problem 
)
inlineinherited

Form hierarchy.

Parameters
[out]solutioninitialized solution
[in]modelmodel of the system
[in]control_problemcontrol problem associated with the model

Definition at line 106 of file hierarchy.h.

◆ form() [2/4]

void humoto::OptimizationProblem::form ( humoto::Solution solution,
humoto::ActiveSet active_set_guess,
const humoto::Model model,
const humoto::ControlProblem control_problem 
)
inlineinherited

Form hierarchy.

Parameters
[out]solutioninitialized solution
[out]active_set_guessactive set guess
[in]modelmodel of the system
[in]control_problemcontrol problem associated with the model

Definition at line 122 of file hierarchy.h.

◆ form() [3/4]

void humoto::OptimizationProblem::form ( humoto::Solution solution,
humoto::Solution solution_guess,
humoto::ActiveSet active_set_guess,
const humoto::Model model,
const humoto::ControlProblem control_problem,
const humoto::Solution old_solution 
)
inlineinherited

Form hierarchy.

Parameters
[out]solutioninitialized solution
[out]solution_guessguess of the solution
[out]active_set_guessactive set guess
[in]modelmodel of the system
[in]control_problemcontrol problem associated with the model
[in]old_solutionold solution

Definition at line 142 of file hierarchy.h.

◆ form() [4/4]

void humoto::OptimizationProblem::form ( humoto::Solution solution,
humoto::Solution solution_guess,
const humoto::Model model,
const humoto::ControlProblem control_problem,
const humoto::Solution old_solution 
)
inlineinherited

Form hierarchy.

Parameters
[out]solutioninitialized solution
[out]solution_guessguess of the solution
[in]modelmodel of the system
[in]control_problemcontrol problem associated with the model
[in]old_solutionold solution

Definition at line 164 of file hierarchy.h.

◆ formHierarchy()

void humoto::OptimizationProblem::formHierarchy ( humoto::Solution solution,
const humoto::Model model,
const humoto::ControlProblem control_problem,
const bool  is_active_set_guessing_enabled 
)
inlineprotectedinherited

Form hierarchy.

Parameters
[out]solutioninitialized solution
[in]modelmodel of the system
[in]control_problemcontrol problem associated with the model
[in]is_active_set_guessing_enabled

Definition at line 39 of file hierarchy.h.

◆ getConfigSectionID()

virtual const std::string& humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::getConfigSectionID ( ) const
protectedpure virtualinherited

Return the default name of a configuration node corresponding to this class.

Returns
the name
Attention
Implementation of this method is added automatically upon inclusion of define_accessors.h if HUMOTO_CONFIG_SECTION_ID is defined.

Implemented in humoto::TaskBase.

◆ getNumberOfEntries()

std::size_t humoto::ConfigurableOptimizationProblem::getNumberOfEntries ( ) const
inlineprivatevirtual

Count entries.

Returns
number of entries

Implements humoto::config::CommonConfigurableBase< true >.

Definition at line 206 of file configurable_optimization_problem.h.

◆ getNumberOfLevels()

std::size_t humoto::OptimizationProblem::getNumberOfLevels ( ) const
inlineinherited

Returns number of levels in the hierarchy.

Returns
number of levels in the hierarchy.

Definition at line 280 of file hierarchy.h.

◆ getQPProblem()

template<class t_QPConstraints >
void humoto::OptimizationProblem::getQPProblem ( QPProblemBase< t_QPConstraints > &  qp_problem,
const humoto::SolutionStructure sol_structure,
const bool  initialize_upper_triangular_part = true 
) const
inlineinherited

Form a QP problem.

Template Parameters
t_QPConstraintsQP constraints type
Parameters
[in]qp_problemQP problem
[in]sol_structuresolution structure
[in]initialize_upper_triangular_partof the Hessian

Definition at line 329 of file hierarchy.h.

◆ getTask()

virtual humoto::TaskSharedPointer humoto::ConfigurableOptimizationProblem::getTask ( const std::string &  string_id) const
inlineprotectedvirtual

◆ guessActiveSet()

void humoto::OptimizationProblem::guessActiveSet ( ActiveSet active_set) const
inlineprotectedinherited

Form active set guess.

Parameters
[out]active_setactive set guess

Definition at line 62 of file hierarchy.h.

◆ initializeActiveSet()

void humoto::OptimizationProblem::initializeActiveSet ( humoto::ActiveSet active_set) const
inlineinherited

Initialize active set of the hierarchy.

Parameters
[in,out]active_setactive set.

Definition at line 312 of file hierarchy.h.

◆ log()

void humoto::OptimizationProblem::log ( humoto::Logger logger,
const LogEntryName parent = LogEntryName(),
const std::string &  name = "" 
) const
inlineinherited

Log hierarchy as a set of tasks.

Parameters
[in,out]loggerlogger
[in]parentparent
[in]namename

Definition at line 293 of file hierarchy.h.

◆ operator[]() [1/2]

const humoto::HierarchyLevel& humoto::OptimizationProblem::operator[] ( const std::size_t  level_index) const
inlineinherited

Access hierarchy level (const)

Parameters
[in]level_indexindex of the level
Returns
reference to a hierarchy level.

Definition at line 256 of file hierarchy.h.

◆ operator[]() [2/2]

humoto::HierarchyLevel& humoto::OptimizationProblem::operator[] ( const std::size_t  level_index)
inlineinherited

Access hierarchy level.

Parameters
[in]level_indexindex of the level
Returns
reference to a hierarchy level.

Definition at line 269 of file hierarchy.h.

◆ processActiveSet()

void humoto::OptimizationProblem::processActiveSet ( const humoto::ActiveSet active_set)
inlineinherited

Process actual active set: extract active sets of individual tasks.

Parameters
[in]active_set

Definition at line 181 of file hierarchy.h.

◆ pushTask() [1/2]

void humoto::ConfigurableOptimizationProblem::pushTask ( TaskSharedPointer  task_pointer,
const std::size_t  level_index,
const std::string &  task_class_name 
)
inline

Push task to the hierarchy.

Parameters
[in,out]task_pointertask
[in]level_indexlevel index
[in]task_class_namename of the task class (not necessarily the same as task description!)

Definition at line 44 of file configurable_optimization_problem.h.

◆ pushTask() [2/2]

void humoto::OptimizationProblem::pushTask ( TaskSharedPointer  task_pointer,
const std::size_t  level_index 
)
inlineinherited

Add task to the optimization problem.

Parameters
[in,out]task_pointerpointer to a task
[in]level_indexlevel in the hierarchy
Todo:
It might be a good idea to check for collisions of task ids.

Definition at line 91 of file hierarchy.h.

◆ readConfig() [1/6]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readConfig ( t_Reader &  reader,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read configuration (assuming the configuration node to be in the root).

Parameters
[in]readerconfiguration reader
[in]crash_on_missing_entry

Definition at line 167 of file config.h.

◆ readConfig() [2/6]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readConfig ( t_Reader &  reader,
const std::string &  node_name,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read configuration (assuming the configuration node to be in the root).

Parameters
[in]readerconfiguration reader
[in]crash_on_missing_entry
[in]node_namenode name, the default is used if empty

Definition at line 183 of file config.h.

◆ readConfig() [3/6]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readConfig ( t_Reader &  reader,
const char *  node_name,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read configuration (assuming the configuration node to be in the root).

Parameters
[in]readerconfiguration reader
[in]crash_on_missing_entry
[in]node_namenode name, the default is used if empty
Note
Intercept implicit conversion of a pointer to bool.

Definition at line 202 of file config.h.

◆ readConfig() [4/6]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readConfig ( const std::string &  file_name,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read configuration (assuming the configuration node to be in the root).

Parameters
[in]file_namefile name
[in]crash_on_missing_entry

Definition at line 218 of file config.h.

◆ readConfig() [5/6]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readConfig ( const std::string &  file_name,
const std::string &  node_name,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read configuration (assuming the configuration node to be in the root).

Parameters
[in]file_namefile name
[in]node_namenode name, the default is used if empty
[in]crash_on_missing_entry

Definition at line 235 of file config.h.

◆ readConfig() [6/6]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readConfig ( const std::string &  file_name,
const char *  node_name,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read configuration (assuming the configuration node to be in the root).

Parameters
[in]file_namefile name
[in]crash_on_missing_entry
[in]node_namenode name, the default is used if empty
Note
Intercept implicit conversion of a pointer to bool.

Definition at line 255 of file config.h.

◆ readConfigEntriesTemplate()

template<class t_Reader >
void humoto::ConfigurableOptimizationProblem::readConfigEntriesTemplate ( t_Reader &  reader,
const bool  crash_on_missing_entry = true 
)
inlineprivate

Read config entries.

Parameters
[in]reader
[in]crash_on_missing_entry

Definition at line 122 of file configurable_optimization_problem.h.

◆ readNestedConfig()

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::readNestedConfig ( t_Reader &  reader,
const std::string &  node_name,
const bool  crash_on_missing_entry = default_crash_on_missing_entry_ 
)
inlineinherited

Read nested configuration node.

Parameters
[in]reader
[in]crash_on_missing_entry
[in]node_namenode name, the default is used if empty

Definition at line 132 of file config.h.

◆ reset()

void humoto::ConfigurableOptimizationProblem::reset ( const std::size_t  number_of_levels)
inline

Reset the optimization problem.

Parameters
[in]number_of_levelsnew number of levels

Definition at line 60 of file configurable_optimization_problem.h.

◆ setDefaults()

void humoto::ConfigurableOptimizationProblem::setDefaults ( )
inlineprotectedvirtual

Initialize to default values.

Implements humoto::config::CommonConfigurableBase< true >.

Definition at line 84 of file configurable_optimization_problem.h.

◆ writeConfig() [1/4]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::writeConfig ( t_Writer &  writer) const
inlineinherited

Write configuration.

Parameters
[in,out]writerconfiguration writer

Definition at line 300 of file config.h.

◆ writeConfig() [2/4]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::writeConfig ( t_Writer &  writer,
const std::string &  node_name 
) const
inlineinherited

Write configuration.

Parameters
[in,out]writerconfiguration writer
[in]node_namenode name, the default is used if empty

Definition at line 313 of file config.h.

◆ writeConfig() [3/4]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::writeConfig ( const std::string &  file_name) const
inlineinherited

Write configuration.

Parameters
[in]file_namefile name

Definition at line 328 of file config.h.

◆ writeConfig() [4/4]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::writeConfig ( const std::string &  file_name,
const std::string &  node_name 
) const
inlineinherited

Write configuration.

Parameters
[in]file_namefile name
[in]node_namenode name, the default is used if empty

Definition at line 342 of file config.h.

◆ writeConfigEntriesTemplate()

template<class t_Writer >
void humoto::ConfigurableOptimizationProblem::writeConfigEntriesTemplate ( t_Writer &  writer) const
inlineprivate

Write config entries.

Parameters
[in]writer

Definition at line 178 of file configurable_optimization_problem.h.

◆ writeNestedConfig() [1/2]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::writeNestedConfig ( t_Writer &  writer) const
inlineinherited

Write nested configuration node.

Parameters
[in,out]writerconfiguration writer

Definition at line 272 of file config.h.

◆ writeNestedConfig() [2/2]

void humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::writeNestedConfig ( t_Writer &  writer,
const std::string &  node_name 
) const
inlineinherited

Write nested configuration node.

Parameters
[in,out]writerconfiguration writer
[in]node_namenode name, the default is used if empty

Definition at line 285 of file config.h.

Member Data Documentation

◆ default_crash_on_missing_entry_

const bool humoto::config::CommonConfigurableBase< t_crash_on_missing_entry >::default_crash_on_missing_entry_
staticprotectedinherited

Definition at line 67 of file config.h.

◆ hierarchy_

std::vector< humoto::HierarchyLevel > humoto::OptimizationProblem::hierarchy_
protectedinherited

Definition at line 25 of file hierarchy.h.

◆ number_of_constraints_

std::vector< std::size_t > humoto::OptimizationProblem::number_of_constraints_
protectedinherited

Definition at line 26 of file hierarchy.h.

◆ number_of_levels_

std::size_t humoto::OptimizationProblem::number_of_levels_
protectedinherited

Definition at line 23 of file hierarchy.h.

◆ task_class_names_

std::vector<std::vector<std::string> > humoto::ConfigurableOptimizationProblem::task_class_names_
protected

Definition at line 73 of file configurable_optimization_problem.h.

◆ task_ids_

std::vector<std::vector<std::string> > humoto::ConfigurableOptimizationProblem::task_ids_
protected

Definition at line 74 of file configurable_optimization_problem.h.


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