36 .CMultiObjectiveMotionOptimizerBase::TParamsBase::loadFromConfigFile(
37 c,
"CMultiObjectiveMotionOptimizerBase");
46 .CMultiObjectiveMotionOptimizerBase::TParamsBase::saveToConfigFile(
47 c,
"CMultiObjectiveMotionOptimizerBase");
53 const std::vector<mrpt::nav::TCandidateMovementPTG>& movs,
57 final_evaluation.clear();
67 for (
const auto& score : c)
82 catch (std::exception&)
91 final_evaluation.assign(N, .0);
94 for (
size_t i = 0; i < N; i++)
107 "Error: found unexpected (unregistered) score named `%s`.",
108 score.first.c_str());
110 double& var = it->second;
116 if (
val > 0 && (best_idx == -1 ||
val > best_val))
139 scalar_score_formula,
140 "A formula that takes all/a subset of scores and generates a scalar " void loadConfigFile(const mrpt::config::CConfigFileBase &c) override
std::vector< double > final_evaluation
The final evaluation score for each candidate.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
A wrapper of exprtk runtime expression compiler: it takes a string representing an expression (from a...
virtual void clear()
Resets the object state; use if the parameters change, so they are re-read and applied.
void saveToConfigFile(mrpt::config::CConfigFileBase &cfg, const std::string §ion) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
IMPLEMENTS_MRPT_OBJECT(CMultiObjMotionOpt_Scalarization, CMultiObjectiveMotionOptimizerBase, mrpt::nav) CMultiObjMotionOpt_Scalarization
int impl_decide(const std::vector< mrpt::nav::TCandidateMovementPTG > &movs, TResultInfo &extra_info) override
std::vector< std::map< std::string, double > > score_values
For each candidate (vector indices), the numerical evaluation of all scores defined in TParamsBase::f...
This class allows loading and storing values and vectors of different types from a configuration text...
CMultiObjMotionOpt_Scalarization()
std::map< std::string, double > m_expr_scalar_vars
Implementation of multi-objective motion chooser using scalarization: a user-given formula is used to...
mrpt::expr::CRuntimeCompiledExpression m_expr_scalar_formula
void compile(const std::string &expression, const std::map< std::string, double > &variables=std::map< std::string, double >(), const std::string &expr_name_for_error_reporting=std::string())
Initializes the object by compiling an expression.
Virtual base class for multi-objective motion choosers, as used for reactive navigation engines...
double eval() const
Evaluates the current value of the precompiled formula.
#define MRPT_LOAD_CONFIG_VAR_REQUIRED_CS(variableName, variableType)
Shortcut for MRPT_LOAD_CONFIG_VAR_NO_DEFAULT() for REQUIRED variables config file object named c and ...
std::string scalar_score_formula
A formula that takes all/a subset of scores and generates a scalar global score.
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
void saveConfigFile(mrpt::config::CConfigFileBase &c) const override
void clear()
Clear the contents of this container.