egttools.numerical.structure.NetworkCoEvolutionaryPC¶
- class NetworkCoEvolutionaryPC(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, game: egttools.numerical.numerical_.games.AbstractSpatialGame, topology: collections.abc.Mapping[SupportsInt | SupportsIndex, collections.abc.Sequence[SupportsInt | SupportsIndex]], nb_strategies: SupportsInt | SupportsIndex, beta: SupportsFloat | SupportsIndex, mu: SupportsFloat | SupportsIndex, rewiring_probability: SupportsFloat | SupportsIndex, cache_size: SupportsInt | SupportsIndex = 100000)¶
Bases:
pybind11_objectCo-evolutionary network estimator: Pairwise Comparison updates + Random rewiring.
Each time step either rewires an edge (with probability
rewiring_probability) or performs a pairwise-comparison strategy update. This is the Santos & Pacheco (2006) model.Construct a NetworkCoEvolutionary estimator.
- Parameters:
Methods
Estimate the fixation probability of a single invader in an otherwise resident population.
Estimate time-averaged strategy frequencies and edge homophily after the transitory period.
Run a single co-evolutionary trajectory and return aggregate strategy counts per generation.
Run a co-evolutionary trajectory, calling callbacks at each snapshot.
- __init__(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, game: egttools.numerical.numerical_.games.AbstractSpatialGame, topology: collections.abc.Mapping[SupportsInt | SupportsIndex, collections.abc.Sequence[SupportsInt | SupportsIndex]], nb_strategies: SupportsInt | SupportsIndex, beta: SupportsFloat | SupportsIndex, mu: SupportsFloat | SupportsIndex, rewiring_probability: SupportsFloat | SupportsIndex, cache_size: SupportsInt | SupportsIndex = 100000) None¶
Construct a NetworkCoEvolutionary estimator.
- __new__(**kwargs)¶
- estimate_fixation_probability(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, invader: SupportsInt | SupportsIndex, resident: SupportsInt | SupportsIndex, nb_runs: SupportsInt | SupportsIndex, nb_generations: SupportsInt | SupportsIndex) float¶
Estimate the fixation probability of a single invader in an otherwise resident population.
- estimate_strategy_distribution(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, nb_runs: SupportsInt | SupportsIndex, nb_generations: SupportsInt | SupportsIndex, transitory: SupportsInt | SupportsIndex, tolerance: SupportsFloat | SupportsIndex = 0.0, check_every: SupportsInt | SupportsIndex = 0) tuple[Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]'], Annotated[numpy.typing.NDArray[numpy.float64], '[m, 1]'], float, float]¶
Estimate time-averaged strategy frequencies and edge homophily after the transitory period.
- Returns:
(mean_frequencies, se_frequencies, mean_homophily, se_homophily)
- Return type:
- initial_topology(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC) list[list[int]]¶
- nb_strategies(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC) int¶
- population_size(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC) int¶
- rewiring_probability(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC) float¶
- run(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, nb_generations: SupportsInt | SupportsIndex, transitory: SupportsInt | SupportsIndex, init_state: Annotated[numpy.typing.ArrayLike, numpy.uint64, '[m, 1]']) Annotated[numpy.typing.NDArray[numpy.uint64], '[m, n]']¶
Run a single co-evolutionary trajectory and return aggregate strategy counts per generation.
- run_snapshots(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, nb_generations: SupportsInt | SupportsIndex, transitory: SupportsInt | SupportsIndex, snapshot_interval: SupportsInt | SupportsIndex, init_state: Annotated[numpy.typing.ArrayLike, numpy.uint64, '[m, 1]'], strategy_callback: object, topology_interval: SupportsInt | SupportsIndex = 0, topology_callback: object = None) None¶
Run a co-evolutionary trajectory, calling callbacks at each snapshot.
- Parameters:
strategy_callback (callable) – Called as
strategy_callback(generation, population)everysnapshot_intervalgens.topology_interval (int, optional) – Call topology_callback every this many generations (0 = never).
topology_callback (callable, optional) – Called as
topology_callback(generation, adjacency_list).
- set_beta(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, beta: SupportsFloat | SupportsIndex) None¶
- set_mu(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, mu: SupportsFloat | SupportsIndex) None¶
- set_rewiring_probability(self: egttools.numerical.numerical_.structure.NetworkCoEvolutionaryPC, p: SupportsFloat | SupportsIndex) None¶
- __annotations__ = {}¶