Source:
Local role: Abstract base class defining how joint payoffs are derived from a strategy profile.
Big-picture role: The relationship between strategies and outcomes is not fixed — it depends on how actors interact, whether their decisions influence each other’s conditions, and what theory of interference is assumed. PayoffFunction is the expression of that theory: it answers the question “given that everyone plays these strategies, what does each player end up with?”
Inheritance:
- ABC
Abstract methods:
evaluate(profile, players, context) -> dict[str, UtilityFrame]profile: StrategyProfile— actor_id → Strategy for every playerplayers: list[PlayerProfile]— all participating playerscontext: JsonMap— forwarded fromGameState.context- returns a
UtilityFrameper player
Example:
from ometeotl_core.game.normal_form import PayoffFunction
from ometeotl_core.game.utility import StrategyRanker
class MyPayoffFunction(PayoffFunction):
"""Evaluate each player independently using their own utility function."""
def evaluate(self, profile, players, context):
results = {}
for pp in players:
ranker = StrategyRanker(pp.utility_function)
ranked = ranker.evaluate_strategy(profile[pp.actor.id], pp.actor, context)
results[pp.actor.id] = ranked.utility_frame
return results
game = NormalFormGame.from_game_state(game_state, MyPayoffFunction())
See also:
