egttools.numerical.GeneralPopulationEvolver¶
- class GeneralPopulationEvolver¶
Bases:
pybind11_object
Evolves a general population structure.
This class simulates evolutionary dynamics based on a user-defined structure (e.g., spatial, group, or network-based interaction).
- Parameters:
structure (egttools.numerical.structure.AbstractStructure) – The structure that defines how individuals interact and update their strategies.
See also
egttools.numerical.structure.AbstractStructure
,egttools.numerical.PairwiseComparisonNumerical
Example
>>> from egttools.numerical.structure import SomeConcreteStructure >>> struct = SomeConcreteStructure(...) >>> evolver = GeneralPopulationEvolver(struct)
Methods
Evolves the population and returns the final state.
Simulates the population and returns the final state after discarding transitory steps.
Returns the structure used by the evolver.
- __init__()¶
Evolves a general population structure.
This class simulates evolutionary dynamics based on a user-defined structure (e.g., spatial, group, or network-based interaction).
- Parameters:
structure (egttools.numerical.structure.AbstractStructure) – The structure that defines how individuals interact and update their strategies.
See also
egttools.numerical.structure.AbstractStructure
,egttools.numerical.PairwiseComparisonNumerical
Example
>>> from egttools.numerical.structure import SomeConcreteStructure >>> struct = SomeConcreteStructure(...) >>> evolver = GeneralPopulationEvolver(struct)
- __new__(**kwargs)¶
- evolve()¶
Evolves the population and returns the final state.
Runs the simulation for a fixed number of generations and returns the final counts of each strategy in the population.
- Parameters:
nb_generations (int) – Number of generations to simulate.
- Returns:
Final counts of each strategy in the population.
- Return type:
NDArray[np.int64]
Example
>>> final = evolver.evolve(1000)
- run()¶
Simulates the population and returns the final state after discarding transitory steps.
This method evolves the population for nb_generations generations but returns the final state after discarding the first transitory generations.
- Parameters:
- Returns:
Final counts of each strategy after the transitory phase.
- Return type:
NDArray[np.int64]
Example
>>> final = evolver.run(2000, 500)
- structure()¶
Returns the structure used by the evolver.
- Returns:
The structure defining interaction and update rules.
- Return type:
Example
>>> structure = evolver.structure()
- __annotations__ = {}¶