pydgens 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. pydgens-0.6.1/LICENSE.txt +8 -0
  2. pydgens-0.6.1/PKG-INFO +141 -0
  3. pydgens-0.6.1/README.md +104 -0
  4. pydgens-0.6.1/pyproject.toml +74 -0
  5. pydgens-0.6.1/setup.cfg +4 -0
  6. pydgens-0.6.1/src/pydgens/__init__.py +46 -0
  7. pydgens-0.6.1/src/pydgens/examples/__init__.py +3 -0
  8. pydgens-0.6.1/src/pydgens/examples/aeriallbg1.py +1184 -0
  9. pydgens-0.6.1/src/pydgens/examples/aeriallbg1_cfg.json +41 -0
  10. pydgens-0.6.1/src/pydgens/examples/al_solve_example_1.py +276 -0
  11. pydgens-0.6.1/src/pydgens/examples/al_solve_example_xxx.py +335 -0
  12. pydgens-0.6.1/src/pydgens/examples/constrained_integrators.py +311 -0
  13. pydgens-0.6.1/src/pydgens/examples/doubleint.py +1004 -0
  14. pydgens-0.6.1/src/pydgens/examples/doubleint_lqlbg.json +77 -0
  15. pydgens-0.6.1/src/pydgens/examples/run_aeriallbg1.py +251 -0
  16. pydgens-0.6.1/src/pydgens/examples/run_doubleint_lqlbg.py +223 -0
  17. pydgens-0.6.1/src/pydgens/examples/run_unicycle1.py +41 -0
  18. pydgens-0.6.1/src/pydgens/examples/tug_o_war.py +293 -0
  19. pydgens-0.6.1/src/pydgens/examples/unicycle.py +275 -0
  20. pydgens-0.6.1/src/pydgens/examples/unicycle1.py +76 -0
  21. pydgens-0.6.1/src/pydgens/frontend/__init__.py +0 -0
  22. pydgens-0.6.1/src/pydgens/frontend/constraints.py +606 -0
  23. pydgens-0.6.1/src/pydgens/frontend/costs.py +756 -0
  24. pydgens-0.6.1/src/pydgens/frontend/dynamics.py +552 -0
  25. pydgens-0.6.1/src/pydgens/frontend/games.py +611 -0
  26. pydgens-0.6.1/src/pydgens/frontend/players.py +281 -0
  27. pydgens-0.6.1/src/pydgens/frontend/solvers.py +442 -0
  28. pydgens-0.6.1/src/pydgens/ir/__init__.py +0 -0
  29. pydgens-0.6.1/src/pydgens/ir/altypes.py +515 -0
  30. pydgens-0.6.1/src/pydgens/ir/constrainttypes.py +731 -0
  31. pydgens-0.6.1/src/pydgens/ir/costtypes.py +683 -0
  32. pydgens-0.6.1/src/pydgens/ir/gametypes.py +504 -0
  33. pydgens-0.6.1/src/pydgens/ir/strategytypes.py +99 -0
  34. pydgens-0.6.1/src/pydgens/ir/systemtypes.py +866 -0
  35. pydgens-0.6.1/src/pydgens/ir/timetypes.py +195 -0
  36. pydgens-0.6.1/src/pydgens/ir/trajectorytypes.py +316 -0
  37. pydgens-0.6.1/src/pydgens/solvers/__init__.py +0 -0
  38. pydgens-0.6.1/src/pydgens/solvers/alsolver.py +2796 -0
  39. pydgens-0.6.1/src/pydgens/solvers/ilqsolver.py +293 -0
  40. pydgens-0.6.1/src/pydgens/solvers/lqsolver.py +384 -0
  41. pydgens-0.6.1/src/pydgens/utils/__init__.py +3 -0
  42. pydgens-0.6.1/src/pydgens/utils/generators.py +159 -0
  43. pydgens-0.6.1/src/pydgens/utils/utils.py +235 -0
  44. pydgens-0.6.1/src/pydgens.egg-info/PKG-INFO +141 -0
  45. pydgens-0.6.1/src/pydgens.egg-info/SOURCES.txt +57 -0
  46. pydgens-0.6.1/src/pydgens.egg-info/dependency_links.txt +1 -0
  47. pydgens-0.6.1/src/pydgens.egg-info/requires.txt +16 -0
  48. pydgens-0.6.1/src/pydgens.egg-info/top_level.txt +1 -0
  49. pydgens-0.6.1/tests/test_alsolver.py +5424 -0
  50. pydgens-0.6.1/tests/test_constrainttypes.py +781 -0
  51. pydgens-0.6.1/tests/test_costtypes.py +942 -0
  52. pydgens-0.6.1/tests/test_gametypes.py +507 -0
  53. pydgens-0.6.1/tests/test_ilqsolver.py +931 -0
  54. pydgens-0.6.1/tests/test_lqsolver.py +923 -0
  55. pydgens-0.6.1/tests/test_strategytypes.py +126 -0
  56. pydgens-0.6.1/tests/test_systemtypes.py +1724 -0
  57. pydgens-0.6.1/tests/test_timetypes.py +286 -0
  58. pydgens-0.6.1/tests/test_trajectorytypes.py +421 -0
  59. pydgens-0.6.1/tests/test_utils.py +201 -0
@@ -0,0 +1,8 @@
1
+ MIT License
2
+ Copyright (c) 2026 Massachusetts Institute of Technology
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+
6
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
+
8
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pydgens-0.6.1/PKG-INFO ADDED
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: pydgens
3
+ Version: 0.6.1
4
+ Summary: Python/JAX-based numerical solvers for dynamic/differential game equilibria
5
+ Author: R. Allen, W. Li
6
+ License-Expression: MIT
7
+ Project-URL: Changelog, https://github.com/mit-ll/pydgens/blob/main/CHANGELOG.md
8
+ Project-URL: Documentation, https://mit-ll.github.io/pydgens/
9
+ Project-URL: Issues, https://github.com/mit-ll/pydgens/issues
10
+ Project-URL: Source, https://github.com/mit-ll/pydgens
11
+ Keywords: differential games,dynamic games,feedback Nash equilibrium,jax,optimal control
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE.txt
22
+ Requires-Dist: flax
23
+ Requires-Dist: jax
24
+ Requires-Dist: numpy
25
+ Provides-Extra: dev
26
+ Requires-Dist: line_profiler; extra == "dev"
27
+ Requires-Dist: pyinstrument; extra == "dev"
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Requires-Dist: pytest-rich; extra == "dev"
30
+ Requires-Dist: pytest-benchmark; extra == "dev"
31
+ Requires-Dist: scalene; extra == "dev"
32
+ Requires-Dist: tensorboard; extra == "dev"
33
+ Requires-Dist: zensical; extra == "dev"
34
+ Provides-Extra: full
35
+ Requires-Dist: pydgens[dev]; extra == "full"
36
+ Dynamic: license-file
37
+
38
+ # PYDGENS: Python/JAX Differential Game Equilibria Numerical Solvers
39
+
40
+ <p align="center">
41
+ <img src="docs/assets/pydgens-logo.png" alt="PYDGENS logo" width="300">
42
+ </p>
43
+
44
+ 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.
45
+
46
+ PYDGENS is a pre-`1.0` release. The package is ready for early adopters, but the public API may continue to evolve as the modeling frontend, examples, and solver interfaces mature.
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install pydgens
52
+ ```
53
+
54
+ PYDGENS requires Python `3.12` or newer.
55
+
56
+ ## Solvers
57
+
58
+ PYDGENS currently supports three main solver paths:
59
+
60
+ - LQ: linear-quadratic, unconstrained games solved for feedback Nash strategies
61
+ - iLQ: nonlinear, unconstrained games solved for local feedback Nash strategies
62
+ - AL: constrained nonlinear games solved with an augmented-Lagrangian workflow for local open-loop trajectories
63
+
64
+ ## Examples
65
+
66
+ Run a minimal linear-quadratic tug-of-war game solved with the LQ solver:
67
+
68
+ ```bash
69
+ python src/pydgens/examples/tug_o_war.py
70
+ ```
71
+
72
+ Run a nonlinear two-player unicycle game solved with the iterative LQ solver:
73
+
74
+ ```bash
75
+ python src/pydgens/examples/unicycle.py
76
+ ```
77
+
78
+ Run a constrained two-player integrator game solved with the augmented-Lagrangian solver:
79
+
80
+ ```bash
81
+ python src/pydgens/examples/constrained_integrators.py
82
+ ```
83
+
84
+ More examples live in [`src/pydgens/examples/`](src/pydgens/examples/).
85
+
86
+ ## Documentation
87
+
88
+ Documentation is available at <https://mit-ll.github.io/pydgens/>.
89
+
90
+ ## Development
91
+
92
+ For development from a local clone:
93
+
94
+ ```bash
95
+ pip install -e .[full]
96
+ ```
97
+
98
+ Contributors can also use `uv` for a reproducible environment:
99
+
100
+ ```bash
101
+ uv sync --extra dev
102
+ source .venv/bin/activate
103
+ ```
104
+
105
+ ## Testing
106
+
107
+ Quick tests:
108
+
109
+ ```bash
110
+ pytest tests/ -v -s -m "not slow"
111
+ ```
112
+
113
+ Slow and benchmark-oriented tests:
114
+
115
+ ```bash
116
+ pytest tests/ -v -m "slow" --benchmark-columns='mean, min, max, stddev, rounds'
117
+ ```
118
+
119
+ ## Disclaimer
120
+
121
+ DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited.
122
+
123
+ This material is based upon work supported by the Under Secretary of War for Research and
124
+ Engineering under Air Force Contract No. FA8702-15-D-0001 or FA8702-25-D-B002. Any
125
+ opinions, findings, conclusions or recommendations expressed in this material are those of
126
+ the author(s) and do not necessarily reflect the views of the Under Secretary of War for
127
+ Research and Engineering.
128
+
129
+ © 2026 Massachusetts Institute of Technology.
130
+
131
+ Subject to FAR52.227-11 Patent Rights - Ownership by the contractor (May 2014)
132
+
133
+ SPDX-License-Identifier: MIT
134
+
135
+ The software/firmware is provided to you on an As-Is basis.
136
+
137
+ Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part
138
+ 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government
139
+ rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed
140
+ above. Use of this work other than as specifically authorized by the U.S. Government may
141
+ violate any copyrights that exist in this work.
@@ -0,0 +1,104 @@
1
+ # PYDGENS: Python/JAX Differential Game Equilibria Numerical Solvers
2
+
3
+ <p align="center">
4
+ <img src="docs/assets/pydgens-logo.png" alt="PYDGENS logo" width="300">
5
+ </p>
6
+
7
+ 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.
8
+
9
+ PYDGENS is a pre-`1.0` release. The package is ready for early adopters, but the public API may continue to evolve as the modeling frontend, examples, and solver interfaces mature.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pip install pydgens
15
+ ```
16
+
17
+ PYDGENS requires Python `3.12` or newer.
18
+
19
+ ## Solvers
20
+
21
+ PYDGENS currently supports three main solver paths:
22
+
23
+ - LQ: linear-quadratic, unconstrained games solved for feedback Nash strategies
24
+ - iLQ: nonlinear, unconstrained games solved for local feedback Nash strategies
25
+ - AL: constrained nonlinear games solved with an augmented-Lagrangian workflow for local open-loop trajectories
26
+
27
+ ## Examples
28
+
29
+ Run a minimal linear-quadratic tug-of-war game solved with the LQ solver:
30
+
31
+ ```bash
32
+ python src/pydgens/examples/tug_o_war.py
33
+ ```
34
+
35
+ Run a nonlinear two-player unicycle game solved with the iterative LQ solver:
36
+
37
+ ```bash
38
+ python src/pydgens/examples/unicycle.py
39
+ ```
40
+
41
+ Run a constrained two-player integrator game solved with the augmented-Lagrangian solver:
42
+
43
+ ```bash
44
+ python src/pydgens/examples/constrained_integrators.py
45
+ ```
46
+
47
+ More examples live in [`src/pydgens/examples/`](src/pydgens/examples/).
48
+
49
+ ## Documentation
50
+
51
+ Documentation is available at <https://mit-ll.github.io/pydgens/>.
52
+
53
+ ## Development
54
+
55
+ For development from a local clone:
56
+
57
+ ```bash
58
+ pip install -e .[full]
59
+ ```
60
+
61
+ Contributors can also use `uv` for a reproducible environment:
62
+
63
+ ```bash
64
+ uv sync --extra dev
65
+ source .venv/bin/activate
66
+ ```
67
+
68
+ ## Testing
69
+
70
+ Quick tests:
71
+
72
+ ```bash
73
+ pytest tests/ -v -s -m "not slow"
74
+ ```
75
+
76
+ Slow and benchmark-oriented tests:
77
+
78
+ ```bash
79
+ pytest tests/ -v -m "slow" --benchmark-columns='mean, min, max, stddev, rounds'
80
+ ```
81
+
82
+ ## Disclaimer
83
+
84
+ DISTRIBUTION STATEMENT A. Approved for public release. Distribution is unlimited.
85
+
86
+ This material is based upon work supported by the Under Secretary of War for Research and
87
+ Engineering under Air Force Contract No. FA8702-15-D-0001 or FA8702-25-D-B002. Any
88
+ opinions, findings, conclusions or recommendations expressed in this material are those of
89
+ the author(s) and do not necessarily reflect the views of the Under Secretary of War for
90
+ Research and Engineering.
91
+
92
+ © 2026 Massachusetts Institute of Technology.
93
+
94
+ Subject to FAR52.227-11 Patent Rights - Ownership by the contractor (May 2014)
95
+
96
+ SPDX-License-Identifier: MIT
97
+
98
+ The software/firmware is provided to you on an As-Is basis.
99
+
100
+ Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS Part
101
+ 252.227-7013 or 7014 (Feb 2014). Notwithstanding any copyright notice, U.S. Government
102
+ rights in this work are defined by DFARS 252.227-7013 or DFARS 252.227-7014 as detailed
103
+ above. Use of this work other than as specifically authorized by the U.S. Government may
104
+ violate any copyrights that exist in this work.
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools >= 61.0",
4
+ ]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "pydgens"
9
+ description = "Python/JAX-based numerical solvers for dynamic/differential game equilibria"
10
+ readme = "README.md"
11
+ requires-python = ">=3.12"
12
+ license = "MIT"
13
+ license-files = ["LICENSE.txt"]
14
+ authors = [
15
+ { name = "R. Allen" },
16
+ { name = "W. Li" },
17
+ ]
18
+ keywords = [
19
+ "differential games",
20
+ "dynamic games",
21
+ "feedback Nash equilibrium",
22
+ "jax",
23
+ "optimal control",
24
+ ]
25
+ classifiers = [
26
+ "Development Status :: 3 - Alpha",
27
+ "Intended Audience :: Science/Research",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Topic :: Scientific/Engineering",
33
+ ]
34
+
35
+ dependencies = [
36
+ "flax",
37
+ "jax",
38
+ "numpy",
39
+ ]
40
+ dynamic = ["version"]
41
+
42
+ [project.urls]
43
+ Changelog = "https://github.com/mit-ll/pydgens/blob/main/CHANGELOG.md"
44
+ Documentation = "https://mit-ll.github.io/pydgens/"
45
+ Issues = "https://github.com/mit-ll/pydgens/issues"
46
+ Source = "https://github.com/mit-ll/pydgens"
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"]
50
+
51
+ [tool.setuptools.package-data]
52
+ "pydgens.examples" = ["*.json"]
53
+
54
+ [tool.setuptools.dynamic]
55
+ version = { attr = "pydgens.__version__" }
56
+
57
+ [project.optional-dependencies]
58
+ dev = [
59
+ "line_profiler",
60
+ "pyinstrument",
61
+ "pytest",
62
+ "pytest-rich",
63
+ "pytest-benchmark",
64
+ "scalene",
65
+ "tensorboard",
66
+ "zensical",
67
+ ]
68
+ full = ["pydgens[dev]"]
69
+
70
+ [tool.pytest.ini_options]
71
+ markers = [
72
+ "regression: approved-output and/or performance regression tests",
73
+ "slow: may include JIT compile or long-running steps",
74
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,46 @@
1
+ # Copyright 2026 MIT Lincoln Laboratory
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ # Single-sourcing package version
5
+ # https://packaging.python.org/guides/single-sourcing-package-version/
6
+
7
+ __version__ = "0.6.1"
8
+
9
+ # User-facing semantic modeling APIs
10
+ from pydgens.frontend import dynamics
11
+ from pydgens.frontend import costs
12
+ from pydgens.frontend import players
13
+ from pydgens.frontend import games
14
+ from pydgens.frontend import constraints
15
+
16
+ # Convenience constructors for common workflows
17
+ from pydgens.ir.timetypes import time_grid
18
+ from pydgens.frontend.dynamics import linear_dynamics
19
+ from pydgens.frontend.dynamics import nonlinear_dynamics
20
+ from pydgens.frontend.costs import player_cost
21
+ from pydgens.frontend.costs import quadratic_cost
22
+ from pydgens.frontend.constraints import control_bounds
23
+ from pydgens.frontend.constraints import state_bounds
24
+ from pydgens.frontend.constraints import constraint_set
25
+ from pydgens.frontend.players import player
26
+ from pydgens.frontend.games import game
27
+ from pydgens.frontend.solvers import solve
28
+
29
+ __all__ = [
30
+ "dynamics",
31
+ "costs",
32
+ "players",
33
+ "games",
34
+ "constraints",
35
+ "time_grid",
36
+ "linear_dynamics",
37
+ "nonlinear_dynamics",
38
+ "player_cost",
39
+ "quadratic_cost",
40
+ "control_bounds",
41
+ "state_bounds",
42
+ "constraint_set",
43
+ "player",
44
+ "game",
45
+ "solve",
46
+ ]
@@ -0,0 +1,3 @@
1
+ # Copyright 2026 MIT Lincoln Laboratory
2
+ # SPDX-License-Identifier: MIT
3
+