5 #ifndef BPP_NUMERIC_FUNCTION_METAOPTIMIZER_H 6 #define BPP_NUMERIC_FUNCTION_METAOPTIMIZER_H 28 std::vector< std::shared_ptr<OptimizerInterface>>
optimizers_;
37 optimizers_(infos.optimizers_),
38 parameterNames_(infos.parameterNames_),
39 derivatives_(infos.derivatives_),
40 itTypes_(infos.itTypes_)
42 for (
size_t i = 0; i < optimizers_.size(); ++i)
44 optimizers_[i] = std::shared_ptr<OptimizerInterface>(infos.
optimizers_[i]->clone());
55 for (
size_t i = 0; i < optimizers_.size(); ++i)
57 optimizers_[i] = std::shared_ptr<OptimizerInterface>(infos.
optimizers_[i]->clone());
77 virtual void addOptimizer(
const std::string& name, std::shared_ptr<OptimizerInterface>
optimizer,
const std::vector<std::string>& params,
unsigned short derivatives = 0,
const std::string& type = IT_TYPE_STEP)
79 names_.push_back(name);
80 optimizers_.push_back(optimizer);
81 parameterNames_.push_back(params);
82 derivatives_.push_back(derivatives);
83 itTypes_.push_back(type);
89 virtual const std::string&
getName(
size_t i)
const {
return names_[i]; }
104 virtual std::shared_ptr<OptimizerInterface>
getOptimizer(
size_t i) {
return optimizers_[i]; }
109 virtual std::shared_ptr<const OptimizerInterface>
getOptimizer(
size_t i)
const {
return optimizers_[i]; }
118 virtual const std::vector<std::string>&
getParameterNames(
size_t i)
const {
return parameterNames_[i]; }
181 MetaOptimizer(std::shared_ptr<FunctionInterface>
function, std::unique_ptr<MetaOptimizerInfos> desc,
unsigned int n = 1);
192 void setFunction(std::shared_ptr<FunctionInterface>
function)
override 195 for (
unsigned int i = 0; i < optDesc_->getNumberOfOptimizers(); ++i)
197 optDesc_->getOptimizer(i)->setFunction(
function);
203 double doStep()
override;
216 #endif // BPP_NUMERIC_FUNCTION_METAOPTIMIZER_H
The parameter list object.
void setFunction(std::shared_ptr< FunctionInterface > function) override
Set the function to optimize.
The Clonable interface (allow an object to be cloned).
This is the basal interface for all optimization methods.
Partial implementation of the Optimizer interface.