Evolife
Evolife has been developed to study Genetic algorithms, Natural evolution and behavioural ecology.
|
All functions defined here can be overloaded in specific scenarii (see module doc) More...
Public Member Functions | |
def | __init__ (self, Name='Default scenario', CfgFile='') |
Loads parameters, sets gene map and calls local initialization. More... | |
def | initialization (self) |
local initialization, to be overloaded More... | |
def | genemap (self) |
Defines the name of genes and their position on the DNA. More... | |
def | phenemap (self) |
Defines the set of non inheritable characteristics. More... | |
def | behaviour (self, best_individual, avg_individual) |
returns information about the phenotype of a given individual (best individual or fictitious individual with average genome) for display purposes (e.g. More... | |
def | prepare (self, indiv) |
The following functions are used # internally, called from 'life_game' #. More... | |
def | start_game (self, members) |
defines what is to be done at the group level each year before interactions occur - Used in 'life_game' More... | |
def | evaluation (self, indiv) |
Implements the computation of individuals' scores - - Used in 'life_game'. More... | |
def | partner (self, indiv, members) |
Decides whom to interact with - Used in 'life_game'. More... | |
def | interaction (self, indiv, partner) |
Nothing by default - Used in 'life_game'. More... | |
def | end_game (self, members) |
defines what to do at the group level once all interactions have occurred - Used in 'life_game' More... | |
def | life_game (self, members) |
Life games (or their components) are defined in specific scenarii life_games calls: More... | |
def | lives (self, members) |
converts scores into life points More... | |
def | season (self, year, members) |
This function is called at the beginning of each year. More... | |
def | parenthood (self, RankedCandidates, Def_Nb_Children) |
Determines the number of children that would-be parents may have depending on their rank. More... | |
def | parents (self, candidates) |
Selects one couple from candidates. More... | |
def | couples (self, members, nb_children=-1) |
Returns a set of couples that will beget newborns. More... | |
def | new_agent (self, child, parents) |
initializes newborns - parents==None when the population is created More... | |
def | remove_agent (self, agent) |
action to be performed when an agent dies More... | |
def | update_positions (self, members, groupLocation) |
Allows to define spatial coordinates for individuals. More... | |
def | default_view (self) |
Defines which windows should be open when the program starts Example: ['Genomes', 'Field', ('Trajectories', 320), ('Network', 500, 200)] optional numbers provide width and height. More... | |
def | legends (self) |
The returned string will be displayed at the bottom ot the Legend window. More... | |
def | display_ (self) |
Defines what is to be displayed. More... | |
def | wallpaper (self, Window) |
Displays background image or colour when the window is created. More... | |
def | Field_grid (self) |
returns a list of graphic orders for initial display on the Field window More... | |
def | Trajectory_grid (self) |
returns a list of graphic orders for initial display on the Trajectory window More... | |
Public Member Functions inherited from Evolife.Genetics.Genetic_map.Genetic_map | |
def | __init__ (self, GeneMap) |
just calls init_genes More... | |
def | init_genes (self, gene_list) |
creates genes and puts them into 'GeneMap' Accepted syntax: ['genename1', 'genename2',...]: lengths and coding are retrieved from configuration. More... | |
def | get_gene (self, locus) |
returns GeneMap[locus] More... | |
def | get_locus (self, gene_name) |
returns the gene's locus More... | |
def | get_gene_name (self, locus) |
finds the name of the gene at locus More... | |
def | get_gene_names (self) |
returns genes' names as a list More... | |
def | get_gene_boundaries (self, locus) |
finds the gene's boundaries on the DNA More... | |
def | get_coding (self, locus) |
returns the gene's coding type (weighted, unweighted, ...) More... | |
def | gene_boundaries (self, gene_name) |
finds the gene's boundaries on the DNA More... | |
def | geneMap_length (self) |
location of the end of the last gene on Genemap More... | |
def | locus_range (self, Locus) |
returns the maximal amplitude of the gene at Locus More... | |
def | gene_range (self, gene_name) |
returns the maximal amplitude of the gene More... | |
def | gene_pattern (self) |
returns a binary mask showing gene alternation on DNA More... | |
Public Attributes | |
Name | |
ALocalQuantity | |
Public Attributes inherited from Evolife.Genetics.Genetic_map.Genetic_map | |
GeneMap | |
All functions defined here can be overloaded in specific scenarii (see module doc)
Definition at line 63 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.__init__ | ( | self, | |
Name = 'Default scenario' , |
|||
CfgFile = '' |
|||
) |
Loads parameters, sets gene map and calls local initialization.
Reimplemented from Evolife.Genetics.Genetic_map.Genetic_map.
Reimplemented in Evolife.Scenarii.CustomScenario.Scenario.
Definition at line 67 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.behaviour | ( | self, | |
best_individual, | |||
avg_individual | |||
) |
returns information about the phenotype of a given individual (best individual or fictitious individual with average genome) for display purposes (e.g.
a trajectory in a maze)
Definition at line 108 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.couples | ( | self, | |
members, | |||
nb_children = -1 |
|||
) |
Returns a set of couples that will beget newborns.
Note that a given individual may appear several times. By default, the probability for an individual to be in a couple (and thus to have a child) decreases with its rank in 'members'
Definition at line 235 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.default_view | ( | self | ) |
Defines which windows should be open when the program starts Example: ['Genomes', 'Field', ('Trajectories', 320), ('Network', 500, 200)] optional numbers provide width and height.
Definition at line 281 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.display_ | ( | self | ) |
Defines what is to be displayed.
It offers the possibility of plotting the evolution through time of the best score, the average score, any locally defined value, and the average value of the various genes and phenes. It should return a list of pairs (C, X) or triples (C, X, L) where C is the curve colour (colour name or number) and X can be 'best', 'average', 'ALocalQuantity' (where ALocalQuantity is a local variable) or any gene name defined in genemap or any phene defined in phenemap. L (optional) is a legend string
Reimplemented in Evolife.Scenarii.CustomScenario.Scenario.
Definition at line 297 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.end_game | ( | self, | |
members | |||
) |
defines what to do at the group level once all interactions have occurred - Used in 'life_game'
Definition at line 154 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.evaluation | ( | self, | |
indiv | |||
) |
Implements the computation of individuals' scores - - Used in 'life_game'.
Definition at line 131 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.Field_grid | ( | self | ) |
returns a list of graphic orders for initial display on the Field window
Definition at line 329 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.genemap | ( | self | ) |
Defines the name of genes and their position on the DNA.
Accepted syntax:
Reimplemented in Evolife.Scenarii.CustomScenario.Scenario.
Definition at line 92 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.initialization | ( | self | ) |
local initialization, to be overloaded
Definition at line 87 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.interaction | ( | self, | |
indiv, | |||
partner | |||
) |
Nothing by default - Used in 'life_game'.
Definition at line 149 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.legends | ( | self | ) |
The returned string will be displayed at the bottom ot the Legend window.
Useful to describe what is to be seen in the various windows.
Definition at line 288 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.life_game | ( | self, | |
members | |||
) |
Life games (or their components) are defined in specific scenarii life_games calls:
Definition at line 161 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.lives | ( | self, | |
members | |||
) |
converts scores into life points
Definition at line 189 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.new_agent | ( | self, | |
child, | |||
parents | |||
) |
initializes newborns - parents==None when the population is created
Definition at line 261 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.parenthood | ( | self, | |
RankedCandidates, | |||
Def_Nb_Children | |||
) |
Determines the number of children that would-be parents may have depending on their rank.
Definition at line 211 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.parents | ( | self, | |
candidates | |||
) |
Selects one couple from candidates.
Candidates are (indiv, NbChildren) pairs, where NbChildren indicates the number of children that indiv can still have
Definition at line 226 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.partner | ( | self, | |
indiv, | |||
members | |||
) |
Decides whom to interact with - Used in 'life_game'.
Definition at line 138 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.phenemap | ( | self | ) |
Defines the set of non inheritable characteristics.
Definition at line 102 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.prepare | ( | self, | |
indiv | |||
) |
The following functions are used # internally, called from 'life_game' #.
defines what is to be done at the individual level before interactions occur - Used in 'start_game'
Definition at line 119 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.remove_agent | ( | self, | |
agent | |||
) |
action to be performed when an agent dies
Definition at line 267 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.season | ( | self, | |
year, | |||
members | |||
) |
This function is called at the beginning of each year.
Definition at line 206 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.start_game | ( | self, | |
members | |||
) |
defines what is to be done at the group level each year before interactions occur - Used in 'life_game'
Definition at line 125 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.Trajectory_grid | ( | self | ) |
returns a list of graphic orders for initial display on the Trajectory window
Definition at line 334 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.update_positions | ( | self, | |
members, | |||
groupLocation | |||
) |
Allows to define spatial coordinates for individuals.
These positions are displayed in the Field window. Coordinates are typically (x,y,c) where c (optional) is the colour representing the agent
Definition at line 272 of file Default_Scenario.py.
def Evolife.Scenarii.Default_Scenario.Default_Scenario.wallpaper | ( | self, | |
Window | |||
) |
Displays background image or colour when the window is created.
Definition at line 322 of file Default_Scenario.py.
Evolife.Scenarii.Default_Scenario.Default_Scenario.ALocalQuantity |
Definition at line 90 of file Default_Scenario.py.
Evolife.Scenarii.Default_Scenario.Default_Scenario.Name |
Definition at line 70 of file Default_Scenario.py.