Vita
Classes | Public Member Functions | Public Attributes | List of all members
vita::environment Class Reference

Context object aggregating multiple related parameters into one structure. More...

#include <environment.h>

Classes

struct  de_parameters
 
struct  mep_parameters
 
struct  misc_parameters
 
struct  statistics
 
struct  team_parameters
 

Public Member Functions

 environment ()
 Class constructor. More...
 
environmentinit ()
 Initialises the undefined parameters with "common" values. More...
 
bool is_valid (bool) const
 
void xml (tinyxml2::XMLDocument *) const
 Saves the environment in XML format. More...
 

Public Attributes

alps::parameters alps
 
unsigned brood_recombination = 0
 This parameter controls the brood recombination/selection level (1 to turn it off). More...
 
unsigned cache_size = 16
 2^cache_size is the number of elements of the cache. More...
 
struct vita::environment::de_parameters de
 
facultative< unsigned > dss = {}
 Enables Dynamic Subset Selection every dss generations. More...
 
trilean elitism = trilean::unknown
 An elitist algorithm is one that ALWAYS retains in the population the best individual found so far. More...
 
unsigned generations = 0
 Maximun number of generations allowed before terminate a run. More...
 
unsigned individuals = 0
 Number of individuals in a layer of the population. More...
 
unsigned layers = 0
 Number of layers for the population. More...
 
unsigned mate_zone = 0
 This is used for the trivial geography scheme. More...
 
facultative< unsigned, 0 > max_stuck_time = {}
 Used by some evolution strategies to stop a run when there aren't improvements within max_stuck_time generations. More...
 
struct vita::environment::mep_parameters mep
 
unsigned min_individuals = 0
 Minimum number of individuals in a layer of the population. More...
 
struct vita::environment::misc_parameters misc
 
double p_cross = -1.0
 Crossover probability. More...
 
double p_mutation = -1.0
 Mutation rate probability. More...
 
struct vita::environment::statistics stat
 
struct vita::environment::team_parameters team
 
model_measurements threshold = model_measurements()
 Used to identify successfully learned (matched, classified, resolved...) examples. More...
 
unsigned tournament_size = 0
 Size of the tournament to choose the parents from. More...
 
facultative< unsigned > validation_percentage = {}
 How much data should be reserved for the validation set? validation_percentage is the fraction of the original data that goes into the validation set. More...
 

Detailed Description

Context object aggregating multiple related parameters into one structure.

A context object (as defined in the Context Object Pattern) aggregates multiple related parameters into one structure, so there needs to be only one common parameter passed amongst functions and classes.

Included values are used as parameters for object initializations and runtime execution control.

Definition at line 56 of file environment.h.

Constructor & Destructor Documentation

◆ environment()

vita::environment::environment ( )
explicit

Class constructor.

See also
environment::init

Definition at line 22 of file environment.cc.

Member Function Documentation

◆ init()

environment & vita::environment::init ( )

Initialises the undefined parameters with "common" values.

Returns
a reference to the "filled" environment

Usually:

  • the undefined parameters are tuned before the start of the search (search::run calls search::tune_parameters) when there are enough data at hand;
  • the user doesn't have to fiddle with them (except after careful consideration).

This function is mainly convenient for debugging purpose. The chosen values are reasonable but most likely far from ideal.

See also
search::tune_parameters

Definition at line 43 of file environment.cc.

◆ is_valid()

bool vita::environment::is_valid ( bool  force_defined) const
Parameters
[in]force_definedall the undefined / auto-tuned parameters have to be in a "well defined" state for the function to pass the test
Returns
true if the object passes the internal consistency check

Definition at line 127 of file environment.cc.

◆ xml()

void vita::environment::xml ( tinyxml2::XMLDocument *  d) const

Saves the environment in XML format.

Parameters
[out]doutput document for saving the environment

Definition at line 69 of file environment.cc.

Member Data Documentation

◆ alps

alps::parameters vita::environment::alps

Definition at line 268 of file environment.h.

◆ brood_recombination

unsigned vita::environment::brood_recombination = 0

This parameter controls the brood recombination/selection level (1 to turn it off).

In nature it's common for organisms to produce many offspring and then neglect, abort, resorb, eat some of them or allow them to eat each other. There are various reasons for this behavior (e.g. progeny choice hypothesis by "Kozlowski & Stearns, 1989"). The phenomenon is known variously as soft selection, brood selection, spontaneous abortion. The "bottom line" of this behaviour in nature is the reduction of parental resource investment in offspring who are potentially less fit than others.

See also
https://github.com/morinim/vita/wiki/bibliography#4 and https://github.com/morinim/vita/wiki/bibliography#17
Note
  • 0 means undefined (auto-tune);

Definition at line 160 of file environment.h.

◆ cache_size

unsigned vita::environment::cache_size = 16

2^cache_size is the number of elements of the cache.

Definition at line 220 of file environment.h.

◆ dss

facultative<unsigned> vita::environment::dss = {}

Enables Dynamic Subset Selection every dss generations.

This parameter is used by the dss validation strategy.

See also

Definition at line 182 of file environment.h.

◆ elitism

trilean vita::environment::elitism = trilean::unknown

An elitist algorithm is one that ALWAYS retains in the population the best individual found so far.

With higher elitism the population will converge quicker but losing diversity.

Definition at line 116 of file environment.h.

◆ generations

unsigned vita::environment::generations = 0

Maximun number of generations allowed before terminate a run.

Note
A value of 0 means undefined (auto-tune).

Definition at line 202 of file environment.h.

◆ individuals

unsigned vita::environment::individuals = 0

Number of individuals in a layer of the population.

Note
A value of 0 means undefined (auto-tune).
Examples
rastrigin.cc.

Definition at line 103 of file environment.h.

◆ layers

unsigned vita::environment::layers = 0

Number of layers for the population.

Warning
When the evolution strategy is vita::basic_std_es, setting layers > 1 is like running n evolutions "in parallel" (the sub-populations of each layer don't interact). A value greater than one is usually choosen for vita::basic_alps_es or with other strategies that allow migrants.
Note
A value of 0 means undefined (auto-tune).

Definition at line 98 of file environment.h.

◆ mate_zone

unsigned vita::environment::mate_zone = 0

This is used for the trivial geography scheme.

The population is viewed as having a 1-dimensional spatial structure - actually a circle, as we consider the first and last locations to be adiacent. The production of an individual from location i is permitted to involve only parents from i's local neightborhood, where the neightborhood is defined as all individuals within distance mate_zone/2 of i.

Note
  • 0 means auto-tune.
  • std::numeric_limits<unsigned>::max() disables the scheme.
See also
https://github.com/morinim/vita/wiki/bibliography#5

Definition at line 197 of file environment.h.

◆ max_stuck_time

facultative<unsigned, 0> vita::environment::max_stuck_time = {}

Used by some evolution strategies to stop a run when there aren't improvements within max_stuck_time generations.

Default status is uninitialized (auto-tune).

Definition at line 208 of file environment.h.

◆ min_individuals

unsigned vita::environment::min_individuals = 0

Minimum number of individuals in a layer of the population.

Some evolution strategies dynamically change the number of individuals of the population. This parameter avoids to drop below a predefined limit

Note
A value of 0 means undefined (auto-tune)

Definition at line 111 of file environment.h.

◆ p_cross

double vita::environment::p_cross = -1.0

Crossover probability.

Note
A negative value means means undefined (auto-tune).

Definition at line 137 of file environment.h.

◆ p_mutation

double vita::environment::p_mutation = -1.0

Mutation rate probability.

Mutation is one of the principal "search operators" used to transform programs in the Genetic Programming algorithm. It causes random changes in individuals.

Warning
p_cross + p_mutation != 1.0: p_mutation is the probability to mutate a gene; it's not the probability of choosing the mutation operator (which depends depends on the recombination algorithm).
Note
A negative value means undefined (auto-tune).
See also
individual::mutation

Definition at line 132 of file environment.h.

◆ threshold

model_measurements vita::environment::threshold = model_measurements()

Used to identify successfully learned (matched, classified, resolved...) examples.

By default only fitness is considered.

Definition at line 266 of file environment.h.

◆ tournament_size

unsigned vita::environment::tournament_size = 0

Size of the tournament to choose the parents from.

Tournament sizes tend to be small relative to the population size. The ratio of tournament size to population size can be used as a measure of selective pressure.

Note
  • A tournament size of 1 would be equivalent to selecting individuals at random.
  • A length of 0 means undefined (auto-tune).

Definition at line 172 of file environment.h.

◆ validation_percentage

facultative<unsigned> vita::environment::validation_percentage = {}

How much data should be reserved for the validation set? validation_percentage is the fraction of the original data that goes into the validation set.

This parameter is used by the holdout_validation strategy.

See also
https://github.com/morinim/vita/wiki/validation

Definition at line 217 of file environment.h.


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