Ejemplo n.º 1
0
void PerPointStopCriterion<TFunction>::update(const Population& population) {
  for (Population::Iterator it = population.begin();
       it != population.end();
       ++it) {
    typename OnePointStopCriterion<TFunction>::Ptr one_point_stop_criterion =
      stop_criterion_info_->getInfoById(it.point_id());
    one_point_stop_criterion->update(it.point());
  }
}
Ejemplo n.º 2
0
void PerPointUpdater<TFunction>::update(Population* population) {
  for (Population::Iterator it = population->begin();
       it != population->end();
       ++it) {
     Point updated_point;
     (one_point_updaters_info_->getInfoById(it.point_id()))->update(it.point(),
                                                         &updated_point);
     population->updatePoint(it.point_id(), updated_point);
  }
}
Ejemplo n.º 3
0
PopulationInfo<TInfo>::PopulationInfo(Population* population,
                                      typename TInfo::Ptr sample_info)
    : BasePopulationInfo(population),
      sample_info_(sample_info) {
  for (Population::Iterator individual = population->begin();
       individual != population->end();
       ++individual) {
    typename TInfo::Ptr info = sample_info_->clone();
    info->init(individual.point(),
               sample_info_->function(),
               sample_info_->set());
    infomap_[individual.point_id()] = info;
  }
}
Ejemplo n.º 4
0
void
APG::ConstraintSolver::select_population( APG::ConstraintSolver::Population& population, Meta::TrackList* best )
{
    Population::Iterator it = population.begin();
    while ( it != population.end() ) {
        if ( it.key() == best ) {
            ++it;// Always keep the best solution, no matter how bad it is
            if ( it == population.end() )
                break;
        }
        
        if ( select( it.value() ) ) {
            ++it;
        } else {
            delete it.key();
            it = population.erase( it );
        }
    }
}