39 #include "geneva/GConstrainedDoubleObject.hpp" 40 #include "geneva/GDoubleGaussAdaptor.hpp" 42 BOOST_CLASS_EXPORT_IMPLEMENT(Gem::Geneva::GFMinIndividual)
47 GFMinIndividual::GFMinIndividual(
50 : Estimator(&estimator) {
56 for (
auto const &p : parlist) {
58 FreeParameterIndices.push_back(varcounter);
60 double min = GConstrainedValueLimitT<double>::lowest();
61 double max = GConstrainedValueLimitT<double>::highest();
65 max = p.Bounds.second;
67 std::shared_ptr<GConstrainedDoubleObject> gbd_ptr(
68 new GConstrainedDoubleObject(val, min, max));
70 std::shared_ptr<GDoubleGaussAdaptor> gdga_ptr(
71 new GDoubleGaussAdaptor(GFI_DEF_SIGMA, GFI_DEF_SIGMASIGMA,
72 GFI_DEF_MINSIGMA, GFI_DEF_MAXSIGMA));
73 gdga_ptr->setAdaptionThreshold(
75 gdga_ptr->setAdaptionProbability(
79 gbd_ptr->addAdaptor(gdga_ptr);
80 this->push_back(gbd_ptr);
82 AllParameters.push_back(p.Value);
85 LOG(INFO) <<
"GStartIndividual::GStartIndividual() | " 86 << FreeParameterIndices.size()
87 <<
" Parameters were added for minimization!";
90 GFMinIndividual::GFMinIndividual(
const GFMinIndividual &cp)
91 : GParameterSet(cp), Estimator(cp.Estimator),
92 AllParameters(cp.AllParameters),
93 FreeParameterIndices(cp.FreeParameterIndices) {}
95 const GFMinIndividual &GFMinIndividual::operator=(
const GFMinIndividual &cp) {
96 GFMinIndividual::load_(&cp);
100 void GFMinIndividual::load_(
const GObject *cp) {
103 const GFMinIndividual *p_load =
104 Gem::Common::g_convert_and_compare<GObject, GFMinIndividual>(cp,
this);
107 GParameterSet::load_(cp);
110 Estimator = p_load->Estimator;
111 AllParameters = p_load->AllParameters;
112 FreeParameterIndices = p_load->FreeParameterIndices;
115 GObject *GFMinIndividual::clone_()
const {
return new GFMinIndividual(*
this); }
117 double GFMinIndividual::fitnessCalculation() {
119 std::vector<double> NewFreeParameters;
120 this->streamline(NewFreeParameters);
122 auto NewParameters = AllParameters;
123 for (
unsigned int i = 0; i < NewFreeParameters.size(); ++i) {
124 NewParameters[FreeParameterIndices[i]] = NewFreeParameters[i];
127 Estimator->updateParametersFrom(NewParameters);
128 return Estimator->evaluate();
std::vector< FitParameter< double > > FitParameterList
virtual std::vector< Parameter > getParameters() const =0