PaGMO  1.1.5
Public Types | Public Member Functions
pagmo::util::racing::race_pop Class Reference

Racing mechanism for a population. More...

#include <race_pop.h>

Public Types

enum  termination_condition { MAX_BUDGET, MAX_DATA_COUNT }
 Method to stop the race. More...
 

Public Member Functions

 race_pop (const population &, unsigned int seed=0)
 Constructor. More...
 
 race_pop (unsigned int seed=0)
 Constructor. More...
 
std::pair< std::vector< population::size_type >, unsigned int > run (const population::size_type n_final, const unsigned int min_trials, const unsigned int max_count, double delta, const std::vector< population::size_type > &, termination_condition term_cond, const bool race_best, const bool screen_output)
 Races some individuals in a population. More...
 
population::size_type size () const
 Get the number of individuals in the registered population.
 
void reset_cache ()
 Clear all the cache.
 
void register_population (const population &)
 Update the population on which the race will run. More...
 
void inherit_memory (const race_pop &)
 Inherits the memory of another race_pop object. More...
 
std::vector< fitness_vectorget_mean_fitness (const std::vector< population::size_type > &active_set=std::vector< population::size_type >()) const
 Returns mean fitness of the individuals based on past evaluation data. More...
 
void set_seed (unsigned int)
 Set a new racing seed. More...
 

Detailed Description

Racing mechanism for a population.

This class implements the racing routines that can be invoked to race all or some of the individuals in a population.

It contains a caching mechanism which allows the reuse of previously evaluated fitness and constraint vectors, in case an identical individual is raced more than once, for example each time with different sets of other individuals. The caching mechanism ensures that all the data points that are compared during the race correspond to the same seed.

Currently the racing is implemented based on F-Race, which invokes Friedman test iteratively during each race.

Definition at line 60 of file race_pop.h.

Member Enumeration Documentation

Method to stop the race.

Enumerator
MAX_BUDGET 

Fixed number of function evaluations.

MAX_DATA_COUNT 

Fixed number of iterations.

Definition at line 68 of file race_pop.h.

Constructor & Destructor Documentation

pagmo::util::racing::race_pop::race_pop ( const population pop,
unsigned int  seed = 0 
)

Constructor.

Construct a race_pop object from an external population and a seed. The seed will determine all racing conditions.

Parameters
[in]poppopulation containing the individuals to race
[in]seedseed of the race

Definition at line 18 of file race_pop.cpp.

pagmo::util::racing::race_pop::race_pop ( unsigned int  seed = 0)

Constructor.

Construct a race_pop object from a seed. The seed will determine all racing conditions. The exact population on which race will run can be (and must be) supplied later via register_population().

Parameters
[in]seedseed of the race

Definition at line 31 of file race_pop.cpp.

Member Function Documentation

std::vector< fitness_vector > pagmo::util::racing::race_pop::get_mean_fitness ( const std::vector< population::size_type > &  ind_list = std::vector<population::size_type>()) const

Returns mean fitness of the individuals based on past evaluation data.

Parameters
[in]ind_listThe indices of the individuals whose mean fitness vectors are to be extracted. If this is empty, mean data of all the individuals will be returned.
Exceptions
value_errorif any of the requested individuals has not been raced before.
Returns
Mean fitness vectors of the individuals in ind_list

Definition at line 532 of file race_pop.cpp.

void pagmo::util::racing::race_pop::inherit_memory ( const race_pop src)

Inherits the memory of another race_pop object.

If compatible, inherits past evaluation data from another race_pop object. Useful in scenarios when racing individuals in a cross generation setting.

Definition at line 653 of file race_pop.cpp.

void pagmo::util::racing::race_pop::register_population ( const population pop)

Update the population on which the race will run.

This also re-allocate the spaces required to the cache entries.

Parameters
[in]popThe new population

Definition at line 41 of file race_pop.cpp.

std::pair< std::vector< population::size_type >, unsigned int > pagmo::util::racing::race_pop::run ( const population::size_type  n_final,
const unsigned int  min_trials,
const unsigned int  max_f_evals,
double  delta,
const std::vector< population::size_type > &  active_set,
termination_condition  term_cond,
const bool  race_best,
const bool  screen_output 
)

Races some individuals in a population.

Performs an F-Race among certain individuals in a population. F-Races are based on the Friedman test, thus a routine to determine the ranking of individuals w.r.t. any given rng seed is needed. Here, population::get_best_idx() is used extending the whole racing concept to multi-objective and constrained optimization.

Specifically, racing contains the following steps:

(1) Re-evaluate the active individuals with the newest random seed (2) Assign ranks to the active individuals and append to the observation data (3) Perform statistical test based on Friedman test (thus obtain pair-wise comparison result with statistical significance) (4) Update three individual index lists: decided, discarded, in_race

  • decided: No need to be further evaluated, clearly superior
  • discarded: No need to be further evaluated, clearly inferior
  • in_race: Undecided, more evaluations needed on them (a.k.a active) (5) Repeat (1) until termination condidtion met (6) Return decided. If too few individuals are in decided, append it with individuals from in_race based on their rank sum (smaller the better).
Parameters
[in]n_finalDesired number of winners.
[in]min_trialsMinimum number of trials to be executed before dropping individuals.
[in]max_f_evalsMaximum number of objective function evaluation before the race ends.
[in]deltaConfidence level for statistical testing.
[in]active_setIndices of individuals that should participate in the race. If empty, race on the whole population.
[in]term_condTermination condition (MAX_BUDGET, MAX_DATA_COUNT)
[in]race_bestWhen true races for the best individuals
[in]screen_outputWhether to log racing status on the console output.
Returns
std::pair first: the indices of the individuals that remain in the race in the end, a.k.a the winners, second: the function evaluations actually needed
Exceptions
type_errorif the underlying problem is not stochastic
index_errorif active_set is invalid (out of bound / repeated indices)
value_errorif other specified racing parameters are not sensible
See also
Birattari, M., Stützle, T., Paquete, L., & Varrentrapp, K. (2002). A Racing Algorithm for Configuring Metaheuristics. GECCO ’02 Proceedings of the Genetic and Evolutionary Computation Conference (pp. 11–18). Morgan Kaufmann Publishers Inc.
Heidrich-Meisner, Verena, & Christian Igel (2009). Hoeffding and Bernstein Races for Selecting Policies in Evolutionary Direct Policy Search. Proceedings of the 26th Annual International Conference on Machine Learning, pp. 401-408. ACM Press.

Definition at line 303 of file race_pop.cpp.

void pagmo::util::racing::race_pop::set_seed ( unsigned int  seed)

Set a new racing seed.

Internally, the list of seed is cleared, all cache entry get invalidated, and a new list of seeds will of be generated as required when racing starts subsequently.

Parameters
[in]seedNew seed to be set

Definition at line 695 of file race_pop.cpp.


The documentation for this class was generated from the following files: