23 #define HUMOTO_CONFIG_SECTION_ID "OptimizationProblem" 24 #include HUMOTO_CONFIG_DEFINE_ACCESSORS 45 const std::size_t level_index,
46 const std::string &task_class_name)
50 task_class_names_[level_index].push_back(task_class_name);
51 task_ids_[level_index].push_back(task_pointer->getDescription());
60 void reset(
const std::size_t number_of_levels)
64 task_class_names_.clear();
67 task_class_names_.resize(number_of_levels);
68 task_ids_.resize(number_of_levels);
86 task_class_names_.clear();
95 if (string_id ==
"TaskInfeasibleInequality")
99 if (string_id ==
"TaskZeroVariables")
103 if (string_id ==
"TaskZeroSelectedVariables")
121 template <
class t_Reader>
123 const bool crash_on_missing_entry =
true)
129 if(task_class_names_.empty())
134 if (task_class_names_.size() != task_ids_.size())
143 for(std::size_t i = 0; i < task_class_names_.size(); ++i)
145 if (task_class_names_[i].size() != task_ids_[i].size())
150 for(std::size_t j = 0; j < task_class_names_[i].size(); ++j)
153 task->setDescription(task_ids_[i][j]);
158 task->readConfig(reader, task_ids_[i][j], crash_on_missing_entry);
164 HUMOTO_THROW_MSG(std::string(
"Unknown task name '") + task_class_names_[i][j] +
"'.");
177 template <
class t_Writer>
183 if(task_class_names_.empty())
188 for(std::size_t i = 0; i < getNumberOfLevels(); ++i)
190 for ( std::list<humoto::HierarchyLevel::TaskInfo>::const_iterator it
191 = hierarchy_[i].tasks_.begin();
192 it != hierarchy_[i].tasks_.end();
195 it->ptr_->writeNestedConfig(writer);
208 std::size_t num_entries = 2;
210 for(std::size_t i = 0; i < getNumberOfLevels(); ++i)
212 num_entries += hierarchy_[i].tasks_.size();
215 return (num_entries);
std::vector< std::vector< std::string > > task_ids_
ConfigurableOptimizationProblem()
Default constructor.
std::size_t getNumberOfEntries() const
Count entries.
void setDefaults()
Initialize to default values.
#define HUMOTO_CONFIG_READ_COMPOUND_(entry)
void reset(const std::size_t number_of_levels)
Reset the optimization problem.
#define HUMOTO_THROW_MSG(s)
HUMOTO_THROW_MSG throws an error message concatenated with the name of the function (if supported)...
virtual humoto::TaskSharedPointer getTask(const std::string &string_id) const
Fill map with all pointers to all tasks for given module.
Eigen::Matrix< unsigned int, Eigen::Dynamic, 1 > IndexVector
An optimization problem [initialize_stack.m, simulation_loop.m].
void readConfigEntriesTemplate(t_Reader &reader, const bool crash_on_missing_entry=true)
Read config entries.
Same as humoto::TaskZeroVariables, but the variables need not to be continuous.
Infeasible inequality task for testing purposes.
boost::shared_ptr< humoto::TaskBase > TaskSharedPointer
void writeConfigEntriesTemplate(t_Writer &writer) const
Write config entries.
[task_zerovars.m] Set given variables to zero, i.e. minimize these variables.
The root namespace of HuMoTo.
void reset(const std::size_t number_of_levels)
Reset the optimization problem.
void pushTask(TaskSharedPointer task_pointer, const std::size_t level_index, const std::string &task_class_name)
Push task to the hierarchy.
Class representing the hierarchy of the problem.
std::vector< std::vector< std::string > > task_class_names_
#define HUMOTO_CONFIG_WRITE_COMPOUND_(entry)
void pushTask(TaskSharedPointer task_pointer, const std::size_t level_index)
Add task to the optimization problem.