neuralmpcx 3.1.4__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 (200) hide show
  1. neuralmpcx-3.1.4/.github/dependabot.yml +19 -0
  2. neuralmpcx-3.1.4/.github/workflows/lint.yml +44 -0
  3. neuralmpcx-3.1.4/.github/workflows/metadata.yml +44 -0
  4. neuralmpcx-3.1.4/.github/workflows/release.yml +78 -0
  5. neuralmpcx-3.1.4/.github/workflows/test.yml +59 -0
  6. neuralmpcx-3.1.4/.gitignore +231 -0
  7. neuralmpcx-3.1.4/.pre-commit-config.yaml +37 -0
  8. neuralmpcx-3.1.4/.rodare.json +20 -0
  9. neuralmpcx-3.1.4/CHANGELOG.md +400 -0
  10. neuralmpcx-3.1.4/CITATION.cff +46 -0
  11. neuralmpcx-3.1.4/CONTRIBUTING.md +101 -0
  12. neuralmpcx-3.1.4/LICENSE +194 -0
  13. neuralmpcx-3.1.4/LICENSE-MIT +21 -0
  14. neuralmpcx-3.1.4/NOTICE +18 -0
  15. neuralmpcx-3.1.4/PKG-INFO +513 -0
  16. neuralmpcx-3.1.4/README.md +462 -0
  17. neuralmpcx-3.1.4/codemeta.json +67 -0
  18. neuralmpcx-3.1.4/examples/Benchmarks/README.md +215 -0
  19. neuralmpcx-3.1.4/examples/Benchmarks/bench/__init__.py +38 -0
  20. neuralmpcx-3.1.4/examples/Benchmarks/bench/adapters.py +322 -0
  21. neuralmpcx-3.1.4/examples/Benchmarks/bench/config.py +501 -0
  22. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/__init__.py +28 -0
  23. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/combined.py +244 -0
  24. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/exp1.py +282 -0
  25. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/exp2.py +177 -0
  26. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/exp3.py +488 -0
  27. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/exp4.py +98 -0
  28. neuralmpcx-3.1.4/examples/Benchmarks/bench/figures/exp5.py +176 -0
  29. neuralmpcx-3.1.4/examples/Benchmarks/bench/metrics.py +407 -0
  30. neuralmpcx-3.1.4/examples/Benchmarks/bench/plotstyle.py +305 -0
  31. neuralmpcx-3.1.4/examples/Benchmarks/bench/runner.py +312 -0
  32. neuralmpcx-3.1.4/examples/Benchmarks/bench/seeds.py +163 -0
  33. neuralmpcx-3.1.4/examples/Benchmarks/bench/store.py +549 -0
  34. neuralmpcx-3.1.4/examples/Benchmarks/bench/tables/__init__.py +27 -0
  35. neuralmpcx-3.1.4/examples/Benchmarks/bench/tables/builders.py +641 -0
  36. neuralmpcx-3.1.4/examples/Benchmarks/configs/exp1_noise.json +30 -0
  37. neuralmpcx-3.1.4/examples/Benchmarks/configs/exp2_initial_conditions.json +18 -0
  38. neuralmpcx-3.1.4/examples/Benchmarks/configs/exp3_mismatch.json +184 -0
  39. neuralmpcx-3.1.4/examples/Benchmarks/configs/exp4_realtime.json +70 -0
  40. neuralmpcx-3.1.4/examples/Benchmarks/configs/exp5_closed_loop.json +16 -0
  41. neuralmpcx-3.1.4/examples/Benchmarks/configs_smoke/exp1_noise.json +34 -0
  42. neuralmpcx-3.1.4/examples/Benchmarks/configs_smoke/exp2_initial_conditions.json +29 -0
  43. neuralmpcx-3.1.4/examples/Benchmarks/configs_smoke/exp3_mismatch.json +179 -0
  44. neuralmpcx-3.1.4/examples/Benchmarks/configs_smoke/exp4_realtime.json +68 -0
  45. neuralmpcx-3.1.4/examples/Benchmarks/configs_smoke/exp5_closed_loop.json +24 -0
  46. neuralmpcx-3.1.4/examples/Benchmarks/figures/combined_envelope.pdf +0 -0
  47. neuralmpcx-3.1.4/examples/Benchmarks/figures/combined_envelope.svg +10828 -0
  48. neuralmpcx-3.1.4/examples/Benchmarks/figures/combined_fan_cstr.pdf +0 -0
  49. neuralmpcx-3.1.4/examples/Benchmarks/figures/combined_fan_cstr.svg +40291 -0
  50. neuralmpcx-3.1.4/examples/Benchmarks/figures/combined_fan_cts.pdf +0 -0
  51. neuralmpcx-3.1.4/examples/Benchmarks/figures/combined_fan_cts.svg +101464 -0
  52. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_fan_cstr.pdf +0 -0
  53. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_fan_cstr.svg +20538 -0
  54. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_fan_cts.pdf +0 -0
  55. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_fan_cts.svg +67280 -0
  56. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_offset_dots_cstr.pdf +0 -0
  57. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_offset_dots_cstr.svg +3341 -0
  58. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_offset_dots_cts.pdf +0 -0
  59. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp1_offset_dots_cts.svg +3194 -0
  60. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp2_fan_cstr.pdf +0 -0
  61. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp2_fan_cstr.svg +10618 -0
  62. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp2_fan_cts.pdf +0 -0
  63. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp2_fan_cts.svg +19148 -0
  64. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_disturbance_CA0_cstr.pdf +0 -0
  65. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_disturbance_CA0_cstr.svg +4095 -0
  66. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_disturbance_Tin_cstr.pdf +0 -0
  67. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_disturbance_Tin_cstr.svg +4288 -0
  68. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_disturbance_leak2_cts.pdf +0 -0
  69. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_disturbance_leak2_cts.svg +4954 -0
  70. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_iae_cstr.pdf +0 -0
  71. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_iae_cstr.svg +3798 -0
  72. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_iae_cts.pdf +0 -0
  73. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_iae_cts.svg +3809 -0
  74. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_offset_cstr.pdf +0 -0
  75. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_offset_cstr.svg +3381 -0
  76. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_offset_cts.pdf +0 -0
  77. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_envelope_offset_cts.svg +3373 -0
  78. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_fan_cstr.pdf +0 -0
  79. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_fan_cstr.svg +9245 -0
  80. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_fan_cts.pdf +0 -0
  81. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_fan_cts.svg +15846 -0
  82. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_neural_vs_nmpc_cstr.pdf +0 -0
  83. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_neural_vs_nmpc_cstr.svg +3320 -0
  84. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_offset_dots_cstr.pdf +0 -0
  85. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_offset_dots_cstr.svg +4226 -0
  86. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_offset_dots_cts.pdf +0 -0
  87. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp3_offset_dots_cts.svg +3967 -0
  88. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp4_rtf_wcet_cstr.pdf +0 -0
  89. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp4_rtf_wcet_cstr.svg +2508 -0
  90. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp4_rtf_wcet_cts.pdf +0 -0
  91. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp4_rtf_wcet_cts.svg +2272 -0
  92. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp5_closed_loop_cstr.pdf +0 -0
  93. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp5_closed_loop_cstr.svg +8826 -0
  94. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp5_closed_loop_cts.pdf +0 -0
  95. neuralmpcx-3.1.4/examples/Benchmarks/figures/exp5_closed_loop_cts.svg +5697 -0
  96. neuralmpcx-3.1.4/examples/Benchmarks/reproduce_all.py +299 -0
  97. neuralmpcx-3.1.4/examples/Benchmarks/results/RUNINFO.json +72 -0
  98. neuralmpcx-3.1.4/examples/Benchmarks/results/manifest.parquet +0 -0
  99. neuralmpcx-3.1.4/examples/Benchmarks/results/metrics.parquet +0 -0
  100. neuralmpcx-3.1.4/examples/Benchmarks/results/metrics.parquet.bak +0 -0
  101. neuralmpcx-3.1.4/examples/Benchmarks/results/normalizers.json +14 -0
  102. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp1_cstr.parquet +0 -0
  103. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp1_cts.parquet +0 -0
  104. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp2_cstr.parquet +0 -0
  105. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp2_cts.parquet +0 -0
  106. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp3_cstr.parquet +0 -0
  107. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp3_cts.parquet +0 -0
  108. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp4_cstr.parquet +0 -0
  109. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp4_cts.parquet +0 -0
  110. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp5_cstr.parquet +0 -0
  111. neuralmpcx-3.1.4/examples/Benchmarks/results/timeseries/exp5_cts.parquet +0 -0
  112. neuralmpcx-3.1.4/examples/Benchmarks/run_experiments.py +281 -0
  113. neuralmpcx-3.1.4/examples/Benchmarks/tables/T0_robustness_at_a_glance.csv +11 -0
  114. neuralmpcx-3.1.4/examples/Benchmarks/tables/T0_robustness_at_a_glance.tex +20 -0
  115. neuralmpcx-3.1.4/examples/Benchmarks/tables/T1_measurement_noise.csv +13 -0
  116. neuralmpcx-3.1.4/examples/Benchmarks/tables/T1_measurement_noise.tex +22 -0
  117. neuralmpcx-3.1.4/examples/Benchmarks/tables/T2_initial_condition_summary.csv +3 -0
  118. neuralmpcx-3.1.4/examples/Benchmarks/tables/T2_initial_condition_summary.tex +12 -0
  119. neuralmpcx-3.1.4/examples/Benchmarks/tables/T2_worst_initial_conditions.csv +11 -0
  120. neuralmpcx-3.1.4/examples/Benchmarks/tables/T2_worst_initial_conditions.tex +20 -0
  121. neuralmpcx-3.1.4/examples/Benchmarks/tables/T3_mismatch_and_disturbance_cases.csv +11 -0
  122. neuralmpcx-3.1.4/examples/Benchmarks/tables/T3_mismatch_and_disturbance_cases.tex +20 -0
  123. neuralmpcx-3.1.4/examples/Benchmarks/tables/T3_tolerance_summary.csv +5 -0
  124. neuralmpcx-3.1.4/examples/Benchmarks/tables/T3_tolerance_summary.tex +14 -0
  125. neuralmpcx-3.1.4/examples/Benchmarks/tables/T4_real_time_feasibility.csv +37 -0
  126. neuralmpcx-3.1.4/examples/Benchmarks/tables/T4_real_time_feasibility.tex +46 -0
  127. neuralmpcx-3.1.4/examples/Benchmarks/tables/T4_rtf_wcet_grid.csv +7 -0
  128. neuralmpcx-3.1.4/examples/Benchmarks/tables/T4_rtf_wcet_grid.tex +16 -0
  129. neuralmpcx-3.1.4/examples/Benchmarks/tables/T5_normalizers.csv +3 -0
  130. neuralmpcx-3.1.4/examples/Benchmarks/tables/T5_normalizers.tex +12 -0
  131. neuralmpcx-3.1.4/examples/Benchmarks/tables/T6_solver_failures.csv +3 -0
  132. neuralmpcx-3.1.4/examples/Benchmarks/tables/T6_solver_failures.tex +12 -0
  133. neuralmpcx-3.1.4/examples/CSTR/models/cstr-lstm-batched-128.pt +0 -0
  134. neuralmpcx-3.1.4/examples/CSTR/models/cstr-lstm-batched-16.pt +0 -0
  135. neuralmpcx-3.1.4/examples/CSTR/models/cstr-lstm-batched-32.pt +0 -0
  136. neuralmpcx-3.1.4/examples/CSTR/models/cstr-lstm-batched-64.pt +0 -0
  137. neuralmpcx-3.1.4/examples/CSTR/models/cstr-lstm-batched-8.pt +0 -0
  138. neuralmpcx-3.1.4/examples/CSTR/neural_mpc_cstr.py +1198 -0
  139. neuralmpcx-3.1.4/examples/CSTR/neural_mpc_cstr_disturbance.py +1013 -0
  140. neuralmpcx-3.1.4/examples/CSTR/nmpc_cstr.py +1262 -0
  141. neuralmpcx-3.1.4/examples/CSTR/nmpc_cstr_disturbance.py +1158 -0
  142. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/data/dataBenchmark.csv +1025 -0
  143. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/data/u_test.npy +0 -0
  144. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/data/u_train.npy +0 -0
  145. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/data/y_test.npy +0 -0
  146. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/data/y_train.npy +0 -0
  147. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/lstm_training.ipynb +707 -0
  148. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/lstm_training.py +762 -0
  149. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/models/cts-lstm-batched-128.pt +0 -0
  150. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/models/cts-lstm-batched-16.pt +0 -0
  151. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/models/cts-lstm-batched-32.pt +0 -0
  152. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/models/cts-lstm-batched-64.pt +0 -0
  153. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/models/cts-lstm-batched-8.pt +0 -0
  154. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/neural_mpc_cts.py +983 -0
  155. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/torch_wrapper/__init__.py +1 -0
  156. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/torch_wrapper/lstm_pytorch.py +206 -0
  157. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/torchid/__init__.py +0 -0
  158. neuralmpcx-3.1.4/examples/Cascaded_Two_Tank_System/torchid/metrics.py +197 -0
  159. neuralmpcx-3.1.4/examples/MPC_Grinding_Circuit/README.md +109 -0
  160. neuralmpcx-3.1.4/examples/MPC_Grinding_Circuit/models/grinding_ss_Ts30s_pade2.npz +0 -0
  161. neuralmpcx-3.1.4/examples/MPC_Grinding_Circuit/mpc_grinding_circuit.py +524 -0
  162. neuralmpcx-3.1.4/fig/NeuralMPCX_LOGO_banner.png +0 -0
  163. neuralmpcx-3.1.4/pyproject.toml +152 -0
  164. neuralmpcx-3.1.4/spec.md +241 -0
  165. neuralmpcx-3.1.4/src/neuralmpcx/__init__.py +18 -0
  166. neuralmpcx-3.1.4/src/neuralmpcx/core/__init__.py +33 -0
  167. neuralmpcx-3.1.4/src/neuralmpcx/core/cache.py +143 -0
  168. neuralmpcx-3.1.4/src/neuralmpcx/core/data.py +120 -0
  169. neuralmpcx-3.1.4/src/neuralmpcx/core/debug.py +220 -0
  170. neuralmpcx-3.1.4/src/neuralmpcx/core/solutions.py +214 -0
  171. neuralmpcx-3.1.4/src/neuralmpcx/core/warmstart.py +126 -0
  172. neuralmpcx-3.1.4/src/neuralmpcx/multistart/__init__.py +29 -0
  173. neuralmpcx-3.1.4/src/neuralmpcx/multistart/multistart_nlp.py +102 -0
  174. neuralmpcx-3.1.4/src/neuralmpcx/multistart/startpoints.py +125 -0
  175. neuralmpcx-3.1.4/src/neuralmpcx/neural/__init__.py +49 -0
  176. neuralmpcx-3.1.4/src/neuralmpcx/neural/casadi_lstm.py +633 -0
  177. neuralmpcx-3.1.4/src/neuralmpcx/nlps/__init__.py +23 -0
  178. neuralmpcx-3.1.4/src/neuralmpcx/nlps/constraints.py +471 -0
  179. neuralmpcx-3.1.4/src/neuralmpcx/nlps/nlp.py +243 -0
  180. neuralmpcx-3.1.4/src/neuralmpcx/nlps/objective.py +281 -0
  181. neuralmpcx-3.1.4/src/neuralmpcx/nlps/parameters.py +63 -0
  182. neuralmpcx-3.1.4/src/neuralmpcx/nlps/variables.py +65 -0
  183. neuralmpcx-3.1.4/src/neuralmpcx/util/__init__.py +34 -0
  184. neuralmpcx-3.1.4/src/neuralmpcx/util/control.py +653 -0
  185. neuralmpcx-3.1.4/src/neuralmpcx/util/estimators.py +3384 -0
  186. neuralmpcx-3.1.4/src/neuralmpcx/util/io.py +357 -0
  187. neuralmpcx-3.1.4/src/neuralmpcx/util/math.py +152 -0
  188. neuralmpcx-3.1.4/src/neuralmpcx/wrappers/__init__.py +33 -0
  189. neuralmpcx-3.1.4/src/neuralmpcx/wrappers/mpc/__init__.py +0 -0
  190. neuralmpcx-3.1.4/src/neuralmpcx/wrappers/mpc/mpc.py +1410 -0
  191. neuralmpcx-3.1.4/src/neuralmpcx/wrappers/wrapper.py +123 -0
  192. neuralmpcx-3.1.4/tests/conftest.py +102 -0
  193. neuralmpcx-3.1.4/tests/test_basic.py +58 -0
  194. neuralmpcx-3.1.4/tests/test_benchmarks.py +267 -0
  195. neuralmpcx-3.1.4/tests/test_control.py +463 -0
  196. neuralmpcx-3.1.4/tests/test_estimators.py +2274 -0
  197. neuralmpcx-3.1.4/tests/test_mpc.py +1455 -0
  198. neuralmpcx-3.1.4/tests/test_neural.py +410 -0
  199. neuralmpcx-3.1.4/tests/test_nlp.py +134 -0
  200. neuralmpcx-3.1.4/tests/test_readme_spec.py +244 -0
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ updates:
3
+ # Maintain GitHub Actions dependencies
4
+ - package-ecosystem: "github-actions"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ labels:
9
+ - "dependencies"
10
+ - "ci"
11
+
12
+ # Maintain Python package dependencies
13
+ - package-ecosystem: "pip"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
17
+ labels:
18
+ - "dependencies"
19
+ - "python"
@@ -0,0 +1,44 @@
1
+ name: Lint & Style
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint:
11
+ name: Lint, Typing & Spec Checks
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Python 3.11
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.11"
21
+ cache: "pip"
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install -e ".[dev]"
27
+ pip install black
28
+
29
+ - name: Ruff Lint Check
30
+ run: |
31
+ ruff check src tests
32
+
33
+ - name: Type Checking with Mypy
34
+ run: |
35
+ mypy src
36
+
37
+ - name: Check Standard Readme Specification
38
+ run: |
39
+ python tests/test_readme_spec.py
40
+
41
+ - name: Code Formatting Check (Black)
42
+ run: |
43
+ black --check src tests
44
+ continue-on-error: true
@@ -0,0 +1,44 @@
1
+ name: Metadata & Packaging
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ validate-citation:
11
+ name: Validate CITATION.cff
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Validate Citation Metadata
18
+ uses: citation-file-format/cffconvert-github-action@2.0.0
19
+ with:
20
+ args: "--validate"
21
+
22
+ check-packaging:
23
+ name: Verify Package Build
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - name: Checkout repository
27
+ uses: actions/checkout@v4
28
+
29
+ - name: Set up Python 3.11
30
+ uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.11"
33
+ cache: "pip"
34
+
35
+ - name: Install build and twine
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install build twine
39
+
40
+ - name: Build distributions
41
+ run: python -m build
42
+
43
+ - name: Check package metadata
44
+ run: twine check dist/*
@@ -0,0 +1,78 @@
1
+ name: Release & Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build:
11
+ name: Build distribution packages
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Set up Python 3.11
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.11"
21
+
22
+ - name: Install build and twine
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install build twine
26
+
27
+ - name: Build sdist and wheel
28
+ run: python -m build
29
+
30
+ - name: Check package metadata
31
+ run: twine check dist/*
32
+
33
+ - name: Upload distribution artifacts
34
+ uses: actions/upload-artifact@v4
35
+ with:
36
+ name: python-package-distributions
37
+ path: dist/
38
+
39
+ publish-pypi:
40
+ name: Publish to PyPI
41
+ needs: [build]
42
+ runs-on: ubuntu-latest
43
+ environment:
44
+ name: pypi
45
+ url: https://pypi.org/p/neuralmpcx
46
+ permissions:
47
+ id-token: write # Required for PyPI OIDC Trusted Publishing
48
+ steps:
49
+ - name: Download distribution artifacts
50
+ uses: actions/download-artifact@v4
51
+ with:
52
+ name: python-package-distributions
53
+ path: dist/
54
+
55
+ - name: Publish package to PyPI
56
+ uses: pypa/gh-action-pypi-publish@release/v1
57
+
58
+ github-release:
59
+ name: Create GitHub Release
60
+ needs: [publish-pypi]
61
+ runs-on: ubuntu-latest
62
+ permissions:
63
+ contents: write
64
+ steps:
65
+ - name: Checkout repository
66
+ uses: actions/checkout@v4
67
+
68
+ - name: Download distribution artifacts
69
+ uses: actions/download-artifact@v4
70
+ with:
71
+ name: python-package-distributions
72
+ path: dist/
73
+
74
+ - name: Create GitHub Release
75
+ uses: softprops/action-gh-release@v2
76
+ with:
77
+ files: dist/*
78
+ generate_release_notes: true
@@ -0,0 +1,59 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ name: ${{ matrix.os }} - Py ${{ matrix.python-version }} (${{ matrix.variant }})
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest]
17
+ python-version: ["3.9", "3.10", "3.11", "3.12"]
18
+ variant: [core, full]
19
+ include:
20
+ - os: windows-latest
21
+ python-version: "3.10"
22
+ variant: full
23
+ - os: windows-latest
24
+ python-version: "3.12"
25
+ variant: full
26
+
27
+ steps:
28
+ - name: Checkout repository
29
+ uses: actions/checkout@v4
30
+
31
+ - name: Set up Python ${{ matrix.python-version }}
32
+ uses: actions/setup-python@v5
33
+ with:
34
+ python-version: ${{ matrix.python-version }}
35
+ cache: "pip"
36
+
37
+ - name: Install dependencies (Core)
38
+ if: matrix.variant == 'core'
39
+ run: |
40
+ python -m pip install --upgrade pip
41
+ pip install -e ".[dev]"
42
+
43
+ - name: Install dependencies (Full with Torch)
44
+ if: matrix.variant == 'full'
45
+ run: |
46
+ python -m pip install --upgrade pip
47
+ pip install -e ".[dev,torch]"
48
+
49
+ - name: Run Pytest with Coverage
50
+ run: |
51
+ pytest -v --cov=neuralmpcx --cov-report=xml --cov-report=term
52
+
53
+ - name: Upload coverage artifact
54
+ uses: actions/upload-artifact@v4
55
+ if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' && matrix.variant == 'full'
56
+ with:
57
+ name: coverage-report
58
+ path: coverage.xml
59
+ if-no-files-found: ignore
@@ -0,0 +1,231 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+ old/
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+ .venv/
147
+ venv/
148
+ env/
149
+ .env/
150
+ *-venv/
151
+ *-venv-*/
152
+ *_venv/
153
+ .*env
154
+ .vscode
155
+ *-env/
156
+ *-env-*/
157
+ *_env/
158
+ .machine_id
159
+ resultado_*.log
160
+
161
+ # Spyder project settings
162
+ .spyderproject
163
+ .spyproject
164
+
165
+ # Rope project settings
166
+ .ropeproject
167
+
168
+ # mkdocs documentation
169
+ /site
170
+
171
+ # mypy
172
+ .mypy_cache/
173
+ .dmypy.json
174
+ dmypy.json
175
+
176
+ # Pyre type checker
177
+ .pyre/
178
+
179
+ # pytype static type analyzer
180
+ .pytype/
181
+
182
+ # Cython debug symbols
183
+ cython_debug/
184
+
185
+ # PyCharm
186
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
187
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
188
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
189
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
190
+ #.idea/
191
+
192
+ # Abstra
193
+ # Abstra is an AI-powered process automation framework.
194
+ # Ignore directories containing user credentials, local state, and settings.
195
+ # Learn more at https://abstra.io/docs
196
+ .abstra/
197
+
198
+ # Visual Studio Code
199
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
200
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
201
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
202
+ # you could uncomment the following to ignore the entire vscode folder
203
+ # .vscode/
204
+
205
+ # Ruff stuff:
206
+ .ruff_cache/
207
+
208
+ # PyPI configuration file
209
+ .pypirc
210
+
211
+ # Cursor
212
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
213
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
214
+ # refer to https://docs.cursor.com/context/ignore-files
215
+ .cursorignore
216
+ .cursorindexingignore
217
+
218
+ # Marimo
219
+ marimo/_static/
220
+ marimo/_lsp/
221
+ __marimo__/
222
+
223
+ # Benchmark suite: crash-safe intermediates, folded into results/ on completion
224
+ examples/Benchmarks/results/_shards/
225
+ examples/Benchmarks/results_smoke/
226
+ examples/Benchmarks/figures_smoke/
227
+ examples/Benchmarks/tables_smoke/
228
+
229
+ examples/Running_In_Cluster_README.md
230
+ examples/Benchmarks/rescore.py
231
+ examples/Benchmarks/run_exp.sh
@@ -0,0 +1,37 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.1.14
4
+ hooks:
5
+ - id: ruff
6
+ args: [--fix, --exit-non-zero-on-fix]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/psf/black
10
+ rev: 24.1.0
11
+ hooks:
12
+ - id: black
13
+ language_version: python3.9
14
+
15
+ - repo: https://github.com/pre-commit/mirrors-mypy
16
+ rev: v1.8.0
17
+ hooks:
18
+ - id: mypy
19
+ additional_dependencies: [types-all]
20
+ args: [--ignore-missing-imports]
21
+
22
+ - repo: https://github.com/pre-commit/pre-commit-hooks
23
+ rev: v4.5.0
24
+ hooks:
25
+ - id: trailing-whitespace
26
+ - id: end-of-file-fixer
27
+ - id: check-yaml
28
+ - id: check-added-large-files
29
+
30
+ - repo: local
31
+ hooks:
32
+ - id: lint-readme-spec
33
+ name: check standard-readme spec
34
+ entry: python tests/test_readme_spec.py
35
+ language: system
36
+ files: ^(README\.md|pyproject\.toml|tests/test_readme_spec\.py)$
37
+ pass_filenames: false
@@ -0,0 +1,20 @@
1
+ {
2
+ "creators": [
3
+ {
4
+ "name": "Lopes-Júnior, Ênio",
5
+ "affiliation": "Helmholtz-Zentrum Dresden-Rossendorf (HZDR)",
6
+ "orcid": "0000-0002-7604-3205"
7
+ },
8
+ {
9
+ "name": "Reinecke, Sebastian Felix",
10
+ "affiliation": "Helmholtz-Zentrum Dresden-Rossendorf (HZDR)",
11
+ "orcid": "0000-0003-2705-0692"
12
+ }
13
+ ],
14
+ "title": "NeuralMPCX: A Model Predictive Control library that supports classic MPC and neural MPC with CasADi",
15
+ "access_right": "open",
16
+ "upload_type": "software",
17
+ "license": "Apache-2.0",
18
+ "pub_id": "43156",
19
+ "description": "NeuralMPCX is a Python library for building and deploying Model Predictive Controllers with classic and neural dynamical models. You write constrained MPC with RNN/LSTM models in a CasADi/IPOPT workflow. The library handles CasADi RNN integration, warm-starting, constraint management, real-time feasibility, and both LTI state-space and neural dynamics in one framework. You can run neural and classical MPC controllers side by side."
20
+ }