Skip to main content

PYDGENS: Python/JAX Differential Game Equilibria Numerical Solvers

PYDGENS logo

Documentation · Examples · API · Solvers · GitHub

PYDGENS provides numerical solvers for approximating equilibrium solutions in multi-player, general-sum dynamic and differential games. The package currently focuses on linear-quadratic feedback Nash games, iterative linear-quadratic methods for nonlinear games, and augmented-Lagrangian workflows for constrained games.

Multi-car intersection game solved with PYDGENS Multi-car intersection

Naive collisions compared to an iLQ feedback solution.

Source · Docs
Eight-player terminal-cost robot arm game solved with PYDGENS Eight-player terminal-cost robot arm

Cooperative joint players form a task-space terminal shape using midpoint and end-effector goals.

Source · Docs
Satellite Lady-Bandit-Guard game solved with PYDGENS Satellite Lady-Bandit-Guard

One LQ feedback Nash strategy rolled out from many initial states.

Source · Docs · spacegym-kspdg

Installation

pip install pydgens

PYDGENS requires Python 3.12 or newer.

Solvers

PYDGENS currently supports three main solver paths. See the solver notes for a sparse theory map and references.

Solver Use case Equilibrium style
LQ Linear dynamics with quadratic costs feedback Nash
iLQ Nonlinear unconstrained games local feedback Nash
AL Constrained nonlinear games local open-loop Nash (pre-release, beta)

Usage Example

Define and solve for the local Nash equilibrium of a nonlinear game by combining a time grid, dynamics, player costs, and player-owned control slices:

import jax.numpy as jnp
import pydgens as pdg

x0 = jnp.array([4.0, 4.0, 0.0, 0.0])  # px, py, heading, speed

game = pdg.game(
    tg=pdg.time_grid(nt=34, dt=0.1),
    dynamics=pdg.nonlinear_dynamics(
        nx=4,
        nu=2,
        dynamics=lambda t, x, u: jnp.array([
            x[3] * jnp.cos(x[2]),
            x[3] * jnp.sin(x[2]),
            u[0],
            u[1],
        ]),
    ),
    players=[
        pdg.player(
            name="turn",
            joint_ctrl_slice=slice(0, 1),
            cost=pdg.player_cost(
                running=lambda t, x, u: x[0] ** 2 + x[1] ** 2 + u[0] ** 2,
            ),
        ),
        pdg.player(
            name="speed",
            joint_ctrl_slice=slice(1, 2),
            cost=pdg.player_cost(
                running=lambda t, x, u: (x[3] - 1.0) ** 2 + u[1] ** 2,
            ),
        ),
    ],
)

solution = pdg.solve(game, x0=x0, method="ilq")
print(solution)

Further examples of solving for equilibria in differential games can be run directly with:

python -m pydgens.examples.tug_o_war  # minimal linear-quadratic (LQ) game
python -m pydgens.examples.unicycle   # nonlinear game solved with iterative method
python -m pydgens.examples.robot_arm  # eight-player nonlinear terminal-cost game
python -m pydgens.examples.constrained_integrators  # constrained game solved Lagrangian method

A comprehensive list of examples is included in the examples documentation.

Disclaimer

DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited.

This material is based upon work supported by the Under Secretary of War for Research and Engineering under Air Force Contract No. FA8702-15-D-0001 or FA8702-25-D-B002. Any opinions, findings, conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the Under Secretary of War for Research and Engineering.

© 2026 Massachusetts Institute of Technology.

Subject to FAR52.227-11 Patent Rights - Ownership by the contractor (May 2014)

SPDX-License-Identifier: MIT

The software/firmware is provided to you on an As-Is basis.

Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed above. Use of this work other than as specifically authorized by the U.S. Government may violate any copyrights that exist in this work.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydgens-1.3.0.tar.gz (235.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydgens-1.3.0-py3-none-any.whl (169.2 kB view details)

Uploaded Python 3

File details

Details for the file pydgens-1.3.0.tar.gz.

File metadata

  • Download URL: pydgens-1.3.0.tar.gz
  • Upload date:
  • Size: 235.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pydgens-1.3.0.tar.gz
Algorithm Hash digest
SHA256 6d0d99710191af1c535d97f174f92a251621c2e8eeb29deff2714b8dc47a3b83
MD5 4e572e11a1ba40caea3d32042e8372b1
BLAKE2b-256 898ce4acb2999ffac46e36de9d1dbf14ce74c6f6fd43fcd0ce5a380faa3420fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydgens-1.3.0.tar.gz:

Publisher: publish.yml on mit-ll/pydgens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydgens-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: pydgens-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 169.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pydgens-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adcf0fe24061d2ada9eb32378e49dd024214814608b139bbb2043d71a95ed7c1
MD5 a97e496c3967568abc3bdd16be37cd5f
BLAKE2b-256 b02cc3aad6ec6655b2440231da5586f2d15e8ae5edfb2bd2ade5e1dfe42f3ab5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydgens-1.3.0-py3-none-any.whl:

Publisher: publish.yml on mit-ll/pydgens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.3.1

2 files

This release

1.3.0 This release

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

0.6.2

2 files

0.6.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page