Skip to content

tucoopy.io.analysis

High-level analysis builder for cooperative game artifacts.

This module builds the analysis section used by the JSON/animation contracts:

  • computes selected point solutions (e.g. Shapley, Banzhaf),
  • computes selected set-valued objects (e.g. imputation set, core),
  • attaches diagnostics summaries (e.g. core membership of solutions),
  • and applies limits (max players, max points, truncation) to keep outputs stable.

The resulting object is intended to be JSON-serializable and suitable for renderers (e.g. the JS demo) and static reports.

Examples:

>>> from tucoopy import Game
>>> from tucoopy.io.analysis import build_analysis
>>> g = Game.from_coalitions(
...     n_players=2,
...     values={(): 0.0, (0,): 0.0, (1,): 0.0, (0, 1): 1.0},
... )
>>> report = build_analysis(g, include_blocking_regions=False, include_bundle=False)
>>> "solutions" in report and "sets" in report
True