Package org.evoludo.simulator.modules
Class Map2Fitness
Object
Map2Fitness
Map scores/payoffs to fitness and vice versa. Enum on steroids. Currently
available maps are:
- none
- no mapping, scores/payoffs equal fitness
- static
- static baseline fitness,
b+w*score
- convex
- convex combination of baseline fitness and scores,
b(1-w)+w*scores
- exponential
- exponential mapping,
b*exp(w*score)
- \(F(u)\geq 0\) for every \(u\in\mathbb{R}\)
- \(F(u)\) is non-decreasing
- \(F(u)\) is continuous
- Selection strength \(w\) scales payoffs, i.e. the fitness associated with payoff \(u\) at selection strength \(w\geq 0\) is \(F(w u)\)
- The probability that an individual is chosen for reproduction is invariant under adding a constant \(K\) to the payoffs of all competing individuals. That is, if \(u_i\) and \(F_i(u_i)\) are the payoff and fecundity of individual \(i\), then \[\frac{F_i(u_i)}{\dsum_j F_j(u_j)} = \frac{F_i(u_i+K)}{\dsum_j F_j(u_j+K)}\]
static
mapping
then immediately follows as an approximation for weak selection.- Author:
- Christoph Hauert
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum representing the different types of payoff/score to fitness maps -
Field Summary
FieldsModifier and TypeFieldDescription(package private) double
Baseline fitness for map.final CLOption
Command line option to set the payoff/score to fitness map.(package private) Map2Fitness.Map
Map type.(package private) Module
The module that is using this fitness mapping.(package private) double
Selection strength for map. -
Constructor Summary
ConstructorsConstructorDescriptionMap2Fitness
(Module module, Map2Fitness.Map map) Instantiate new map of typemap
formodule
. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Gets the baseline fitness of the map.getName()
Gets the name/key of the current map.double
Gets the selection strength of the map.getTitle()
Gets the brief description of the current map.double
invmap
(double fitness) Mapfitness
to payoff/score, based on currently selected typemap
.boolean
isMap
(Map2Fitness.Map aMap) Checks if this map is of typeaMap
.double
map
(double score) Mapscore
to fitness, based on currently selected typemap
.void
setBaseline
(double baseline) Sets the baseline fitness of the map.void
setMap
(Map2Fitness.Map map) Sets type of map tomap
.void
setSelection
(double selection) Sets the selection strength of the map.
-
Field Details
-
module
Module moduleThe module that is using this fitness mapping. -
baseline
double baselineBaseline fitness for map. -
selection
double selectionSelection strength for map. -
map
Map2Fitness.Map mapMap type. Defaults toMap2Fitness.Map.NONE
. -
clo
Command line option to set the payoff/score to fitness map.
-
-
Constructor Details
-
Map2Fitness
Instantiate new map of typemap
formodule
.- Parameters:
module
- the module using this mappingmap
- the map to use as template
-
-
Method Details
-
map
public double map(double score) Mapscore
to fitness, based on currently selected typemap
.- Parameters:
score
- the payoff/score to convert to fitness- Returns:
- the corresponding fitness
- See Also:
-
invmap
public double invmap(double fitness) Mapfitness
to payoff/score, based on currently selected typemap
.- Parameters:
fitness
- the fitness to convert to payoff/score- Returns:
- the corresponding payoff/score
-
isMap
Checks if this map is of typeaMap
.- Parameters:
aMap
- the map to compare to- Returns:
true
if map is of typeaMap
.
-
setMap
Sets type of map tomap
.- Parameters:
map
- the type of the map
-
setBaseline
public void setBaseline(double baseline) Sets the baseline fitness of the map.- Parameters:
baseline
- the baseline fitness of the map
-
getBaseline
public double getBaseline()Gets the baseline fitness of the map.- Returns:
- the baseline fitness of the map
-
setSelection
public void setSelection(double selection) Sets the selection strength of the map. Must be positive, ignored otherwise.- Parameters:
selection
- the strength of selection of the map
-
getSelection
public double getSelection()Gets the selection strength of the map.- Returns:
- the selection strength of the map
-
getName
Gets the name/key of the current map.- Returns:
- the map key
-
getTitle
Gets the brief description of the current map.- Returns:
- the map summary
-