PayoffFunction

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 player
    • players: list[PlayerProfile] — all participating players
    • context: JsonMap — forwarded from GameState.context
    • returns a UtilityFrame per 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:

Ometeotl

A Python library to build complex multi-agent simulations, wargames, and AI-driven strategies