Skip to content

feat(gds-games): integrate Nashpy/pygambit for equilibrium computation #77

@rororowyourboat

Description

@rororowyourboat

Summary

GDS-games specifies game structure (players, actions, payoffs, composition) but doesn't compute equilibria. The TerminalCondition metadata in the PD DSL example already declares outcomes (including "Mutual Defection" as Nash equilibrium) but this is hand-annotated, not computed. Adding Nashpy/pygambit integration would bridge the gap from structural specification to computational game theory — making GDS-games actionable.

Motivation

The existing PatternIR already contains the data needed for solver input:

  • action_spaces → player action sets
  • terminal_conditions → outcome annotations (currently manual)
  • Game composition structure → information sets

With a solver backend, we could:

  1. Compute Nash equilibria from the structural specification
  2. Verify hand-annotated terminal conditions against computed results
  3. Analyze dominance, Pareto optimality, and equilibrium characterization

Proposed Approach

Phase 1: Nashpy integration (2-player normal-form games)

  • Add nashpy as optional dependency to gds-games or gds-examples
  • Build payoff matrices from PatternIR metadata (action_spaces + terminal_conditions)
  • Support enumeration algorithm for Nash equilibrium computation
  • Cross-reference computed equilibria against declared TerminalConditions

Phase 2: pygambit integration (n-player extensive-form games)

  • Add pygambit as optional dependency for richer game representations
  • Map OGS composition trees to extensive-form game trees
  • Support mixed-strategy equilibria and refinements
  • Leverage HierarchyNodeIR for information set construction

Phase 3: Solver-backed verification

  • New OGS verification check: "declared equilibria match computed equilibria"
  • Automated Pareto optimality classification of terminal conditions
  • Dominance analysis as a verification finding

Key Files

  • ogs/dsl/pattern.pyTerminalCondition, ActionSpace models (solver inputs)
  • ogs/ir/models.pyPatternIR with action_spaces and terminal_conditions
  • packages/gds-examples/games/prisoners_dilemma_nash/ — Phase 1 proof-of-concept

Prior Art

  • Nashpy — 2-player game solver (support enumeration, vertex enumeration, Lemke-Howson)
  • pygambit — n-player game solver (extensive + strategic form)

Labels

enhancement, gds-games

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions