egttools.numerical.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.

Example

>>> from egttools.numerical.structure import SomeConcreteStructure
>>> struct = SomeConcreteStructure(...)
>>> evolver = GeneralPopulationEvolver(struct)

Methods

evolve

Evolves the population and returns the final state.

run

Simulates the population and returns the final state after discarding transitory steps.

structure

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.

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:
  • nb_generations (int) – Total number of generations to simulate.

  • transitory (int) – Number of initial generations to discard (burn-in period).

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:

egttools.numerical.structure.AbstractStructure

Example

>>> structure = evolver.structure()
__annotations__ = {}