Payoff Mechanism¶
This module defines the core class used to specify and integrate payoff mechanisms in population games.
A payoff mechanism is defined through a payoff dynamics model (PDM), which governs how payoffs evolve over time based on the current state of the system.
Numerical integration is performed using scipy
.
—
Payoff Mechanism
- class popgames.payoff_mechanism.PayoffMechanism(h_map, n, w_map=None, d=0)[source]¶
Bases:
object
Payoff mechanism implemented as a payoff dynamics model (PDM).
Initialize the payoff mechanism instance.
- Parameters:
h_map (Union[Callable[[np.ndarray], np.ndarray], Callable[[np.ndarray, np.ndarray], np.ndarray]]) – Output function of the PDM.
n (int) – Dimensionality of the expected input vector x.
w_map (Callable[[np.ndarray, np.ndarray], np.ndarray], optional) – Right-hand side of the PDM dynamics.
None (Defaults to)
PDM. (corresponding to a memory-less)
d (int, optional) – Dimensionality of the PDM state vector x. Defaults to 0 (in the memoryless case).
- integrate(q0, x0, t_span, method='Radau', output_trajectory=True)[source]¶
Numerically integrate the PDM.
This method relies on
scipy.integrate.solve_ivp
.- Parameters:
q0 (np.ndarray) – Initial PDM state vector of shape (d, 1).
x0 (np.ndarray) – Initial PDM input vector of shape (n, 1).
t_span (tuple) – Time span of integration.
method (str, optional) – Integration method. Defaults to ‘Radau’.
output_trajectory (bool, optional) – Whether to output the trajectory or just the final state-output pair. Defaults to True.
- Returns:
Contains results of the integration as a SimpleNameSpace with keys
t
,q
, andp
, for the time, state, and output vectors, respectively.- Return type:
SimpleNamespace