regelum 0.1.0__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 (89) hide show
  1. regelum-0.1.0/LICENSE +21 -0
  2. regelum-0.1.0/PKG-INFO +222 -0
  3. regelum-0.1.0/README.md +178 -0
  4. regelum-0.1.0/pyproject.toml +103 -0
  5. regelum-0.1.0/regelum/__init__.py +82 -0
  6. regelum-0.1.0/regelum/node/__init__.py +61 -0
  7. regelum-0.1.0/regelum/node/base.py +556 -0
  8. regelum-0.1.0/regelum/node/classic_control/__init__.py +102 -0
  9. regelum-0.1.0/regelum/node/classic_control/controllers/__init__.py +1 -0
  10. regelum-0.1.0/regelum/node/classic_control/controllers/backstepping.py +160 -0
  11. regelum-0.1.0/regelum/node/classic_control/controllers/energy_based.py +135 -0
  12. regelum-0.1.0/regelum/node/classic_control/controllers/lqr.py +143 -0
  13. regelum-0.1.0/regelum/node/classic_control/controllers/mpc.py +163 -0
  14. regelum-0.1.0/regelum/node/classic_control/controllers/pid.py +87 -0
  15. regelum-0.1.0/regelum/node/classic_control/controllers/scipy_mpc.py +168 -0
  16. regelum-0.1.0/regelum/node/classic_control/envs/__init__.py +6 -0
  17. regelum-0.1.0/regelum/node/classic_control/envs/continuous/__init__.py +25 -0
  18. regelum-0.1.0/regelum/node/classic_control/envs/continuous/cartpole.py +127 -0
  19. regelum-0.1.0/regelum/node/classic_control/envs/continuous/dc_motor.py +115 -0
  20. regelum-0.1.0/regelum/node/classic_control/envs/continuous/double_pendulum.py +156 -0
  21. regelum-0.1.0/regelum/node/classic_control/envs/continuous/kin_point.py +60 -0
  22. regelum-0.1.0/regelum/node/classic_control/envs/continuous/mass_spring_damper.py +106 -0
  23. regelum-0.1.0/regelum/node/classic_control/envs/continuous/pendulum.py +70 -0
  24. regelum-0.1.0/regelum/node/classic_control/envs/continuous/pendulum_friction.py +78 -0
  25. regelum-0.1.0/regelum/node/classic_control/envs/continuous/pendulum_motor.py +111 -0
  26. regelum-0.1.0/regelum/node/classic_control/envs/continuous/three_wheeled_robot.py +67 -0
  27. regelum-0.1.0/regelum/node/classic_control/envs/continuous/three_wheeled_robot_dyn.py +75 -0
  28. regelum-0.1.0/regelum/node/classic_control/envs/discrete/__init__.py +17 -0
  29. regelum-0.1.0/regelum/node/classic_control/envs/discrete/chain.py +88 -0
  30. regelum-0.1.0/regelum/node/classic_control/envs/discrete/discrete_pendulum.py +133 -0
  31. regelum-0.1.0/regelum/node/classic_control/envs/discrete/grid_world.py +114 -0
  32. regelum-0.1.0/regelum/node/classic_control/observers/__init__.py +7 -0
  33. regelum-0.1.0/regelum/node/classic_control/observers/unscented_kalman_filter.py +246 -0
  34. regelum-0.1.0/regelum/node/core/__init__.py +1 -0
  35. regelum-0.1.0/regelum/node/core/globals.py +6 -0
  36. regelum-0.1.0/regelum/node/core/inputs.py +138 -0
  37. regelum-0.1.0/regelum/node/core/types.py +49 -0
  38. regelum-0.1.0/regelum/node/core/variable.py +172 -0
  39. regelum-0.1.0/regelum/node/graph.py +1044 -0
  40. regelum-0.1.0/regelum/node/interfaces/__init__.py +1 -0
  41. regelum-0.1.0/regelum/node/interfaces/base.py +197 -0
  42. regelum-0.1.0/regelum/node/interfaces/graph.py +122 -0
  43. regelum-0.1.0/regelum/node/interfaces/modifiers.py +115 -0
  44. regelum-0.1.0/regelum/node/interfaces/node.py +306 -0
  45. regelum-0.1.0/regelum/node/logging.py +116 -0
  46. regelum-0.1.0/regelum/node/memory/__init__.py +1 -0
  47. regelum-0.1.0/regelum/node/memory/buffer.py +95 -0
  48. regelum-0.1.0/regelum/node/memory/lag.py +68 -0
  49. regelum-0.1.0/regelum/node/misc/__init__.py +1 -0
  50. regelum-0.1.0/regelum/node/misc/output.py +180 -0
  51. regelum-0.1.0/regelum/node/misc/reward.py +44 -0
  52. regelum-0.1.0/regelum/node/modifiers/__init__.py +1 -0
  53. regelum-0.1.0/regelum/node/modifiers/base.py +57 -0
  54. regelum-0.1.0/regelum/node/modifiers/reset.py +40 -0
  55. regelum-0.1.0/regelum/node/modifiers/zero_order_hold.py +61 -0
  56. regelum-0.1.0/regelum/node/parallel.py +380 -0
  57. regelum-0.1.0/regelum/node/reset.py +45 -0
  58. regelum-0.1.0/regelum/node/rl/__init__.py +1 -0
  59. regelum-0.1.0/regelum/node/rl/offline/__init__.py +1 -0
  60. regelum-0.1.0/regelum/node/rl/offline/agents/__init__.py +1 -0
  61. regelum-0.1.0/regelum/node/rl/offline/agents/combo.py +5 -0
  62. regelum-0.1.0/regelum/node/rl/online/__init__.py +5 -0
  63. regelum-0.1.0/regelum/node/rl/online/monte_carlo/__init__.py +5 -0
  64. regelum-0.1.0/regelum/node/rl/online/monte_carlo/agents/__init__.py +6 -0
  65. regelum-0.1.0/regelum/node/rl/online/monte_carlo/agents/ddpg.py +6 -0
  66. regelum-0.1.0/regelum/node/rl/online/monte_carlo/agents/ppo.py +6 -0
  67. regelum-0.1.0/regelum/node/rl/online/monte_carlo/agents/reinforce.py +7 -0
  68. regelum-0.1.0/regelum/node/rl/online/monte_carlo/agents/td3.py +5 -0
  69. regelum-0.1.0/regelum/node/rl/online/monte_carlo/agents/trpo.py +7 -0
  70. regelum-0.1.0/regelum/node/rl/online/pure_online/__init__.py +5 -0
  71. regelum-0.1.0/regelum/node/rl/online/pure_online/agents/__init__.py +6 -0
  72. regelum-0.1.0/regelum/node/rl/online/pure_online/agents/ddqn.py +5 -0
  73. regelum-0.1.0/regelum/node/rl/online/pure_online/agents/dqn.py +5 -0
  74. regelum-0.1.0/regelum/node/rl/online/pure_online/agents/sac.py +7 -0
  75. regelum-0.1.0/regelum/node/rl/online/pure_online/agents/sarsa.py +11 -0
  76. regelum-0.1.0/regelum/node/visualization/__init__.py +51 -0
  77. regelum-0.1.0/regelum/node/visualization/pygame_renderer/__init__.py +25 -0
  78. regelum-0.1.0/regelum/node/visualization/pygame_renderer/base.py +525 -0
  79. regelum-0.1.0/regelum/node/visualization/pygame_renderer/cartpole.py +110 -0
  80. regelum-0.1.0/regelum/node/visualization/pygame_renderer/chain.py +95 -0
  81. regelum-0.1.0/regelum/node/visualization/pygame_renderer/dc_motor.py +310 -0
  82. regelum-0.1.0/regelum/node/visualization/pygame_renderer/discrete_pendulum.py +128 -0
  83. regelum-0.1.0/regelum/node/visualization/pygame_renderer/double_pendulum.py +145 -0
  84. regelum-0.1.0/regelum/node/visualization/pygame_renderer/grid_world.py +118 -0
  85. regelum-0.1.0/regelum/node/visualization/pygame_renderer/kinematic_point.py +71 -0
  86. regelum-0.1.0/regelum/node/visualization/pygame_renderer/pendulum.py +73 -0
  87. regelum-0.1.0/regelum/node/visualization/pygame_renderer/three_wheeled_robot.py +103 -0
  88. regelum-0.1.0/regelum/utils/__init__.py +832 -0
  89. regelum-0.1.0/regelum/utils/logger.py +21 -0
regelum-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2015 Pavel Osinenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
regelum-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.3
2
+ Name: regelum
3
+ Version: 0.1.0
4
+ Summary: Regelum is a flexibly configurable framework for computational graph construction and execution.
5
+ License: MIT
6
+ Author: Georgiy Malaniya
7
+ Author-email: pwlsd.gm@gmail.com
8
+ Requires-Python: >=3.12
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Provides-Extra: dev
14
+ Requires-Dist: black (>=24.3.0) ; extra == "dev"
15
+ Requires-Dist: casadi (>=3.6.7)
16
+ Requires-Dist: dask[complete] (>=2024.12.1)
17
+ Requires-Dist: graphviz (>=0.20.3)
18
+ Requires-Dist: loguru (>=0.7.3)
19
+ Requires-Dist: matplotlib (>=3.9.2)
20
+ Requires-Dist: mkdocs-autorefs (>=1.2.0) ; extra == "dev"
21
+ Requires-Dist: mkdocs-gen-files (>=0.5.0) ; extra == "dev"
22
+ Requires-Dist: mkdocs-jupyter (>=0.25.1) ; extra == "dev"
23
+ Requires-Dist: mkdocs-literate-nav (>=0.6.1) ; extra == "dev"
24
+ Requires-Dist: mkdocs-macros-plugin (>=1.0.5) ; extra == "dev"
25
+ Requires-Dist: mkdocs-material (>=9.5.47) ; extra == "dev"
26
+ Requires-Dist: mkdocs-section-index (>=0.3.8) ; extra == "dev"
27
+ Requires-Dist: mypy (>=1.8.0) ; extra == "dev"
28
+ Requires-Dist: omegaconf (>=2.3.0)
29
+ Requires-Dist: opencv-python (>=4.11.0.86)
30
+ Requires-Dist: pandas (>=2.2.3)
31
+ Requires-Dist: pre-commit (>=3.6.0) ; extra == "dev"
32
+ Requires-Dist: pygame (>=2.6.1)
33
+ Requires-Dist: pylint (>=3.0.3) ; extra == "dev"
34
+ Requires-Dist: pytest (>=8.3.4) ; extra == "dev"
35
+ Requires-Dist: pytest-cov (>=4.1.0) ; extra == "dev"
36
+ Requires-Dist: ruff (>=0.3.0) ; extra == "dev"
37
+ Requires-Dist: scipy (>=1.14.1)
38
+ Requires-Dist: torch (>=2.4.1)
39
+ Requires-Dist: types-PyYAML (>=6.0.12) ; extra == "dev"
40
+ Requires-Dist: types-requests (>=2.32.0.20241016) ; extra == "dev"
41
+ Requires-Dist: types-setuptools (>=75.6.0.20241223) ; extra == "dev"
42
+ Description-Content-Type: text/markdown
43
+
44
+ # Regelum
45
+
46
+ ![Pylint](https://img.shields.io/badge/pylint-9.59%2F10-brightgreen)
47
+ ![Coverage](https://img.shields.io/badge/coverage-0%25-red)
48
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
49
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
50
+ ![Black](https://img.shields.io/badge/Black-failing-red)
51
+
52
+ Regelum (German: "to control") is a powerful framework for reinforcement learning, simulation, and control systems. It provides a modular, node-based architecture for building dynamic simulation pipelines with minimal overhead.
53
+
54
+ ## Key Features
55
+
56
+ - **🔌 Modular Node Architecture**
57
+ - Build complex systems using independent, composable nodes
58
+ - Easy to extend and modify without affecting other components
59
+ - Shared global variable scope for seamless data flow
60
+
61
+ - **🔄 Synchronous Loop Design**
62
+ - Optimized for reinforcement learning tasks
63
+ - Predictable execution flow
64
+ - Built-in state management
65
+
66
+ - **📊 Integrated Tools**
67
+ - Real-time logging and visualization
68
+ - MathJax-powered documentation
69
+ - Jupyter notebook integration
70
+ - Automatic code quality checks
71
+
72
+ - **🚀 Production Ready**
73
+ - Type-checked with MyPy
74
+ - Comprehensive linting (Pylint score: 9.5+/10)
75
+ - Pre-commit hooks for code quality
76
+ - Extensive documentation
77
+
78
+ ## Installation
79
+
80
+ ### For Users
81
+ ```bash
82
+ pip install regelum
83
+ ```
84
+
85
+ ### For Developers
86
+ ```bash
87
+ pip install -e ".[dev]"
88
+ ```
89
+
90
+ ## Quick Start
91
+
92
+ Here's a practical example of controlling a pendulum using LQR with visualization:
93
+
94
+ ```python
95
+ from regelum.node.classic_control.envs.continuous import Pendulum
96
+ from regelum.node.classic_control.controllers.lqr import LQRController
97
+ from regelum.node.visualization.pygame_renderer import PendulumRenderer
98
+ from regelum.node.graph import Graph
99
+ from regelum.node.reset import ResetEachNSteps
100
+
101
+ # Create pendulum system
102
+ pendulum = Pendulum(
103
+ control_signal_name="lqr_1.action",
104
+ initial_state=np.array([np.pi, 0.0])
105
+ )
106
+
107
+ # Configure LQR controller
108
+ A = np.array([[0, 1], [-3 * pendulum.gravity_acceleration / (2 * pendulum.length), 0]])
109
+ B = np.array([[0], [1 / pendulum.mass]])
110
+ Q = np.diag([10.0, 1.0]) # State cost matrix
111
+ R = np.array([[0.1]]) # Control cost matrix
112
+
113
+ lqr = LQRController(
114
+ controlled_state=pendulum.state,
115
+ system_matrices=(A, B),
116
+ cost_matrices=(Q, R),
117
+ control_limits=(-10.0, 10.0),
118
+ step_size=0.01
119
+ )
120
+
121
+ # Add visualization
122
+ viz = PendulumRenderer(
123
+ state_variable=pendulum.state,
124
+ fps=60.0,
125
+ window_size=(1200, 400),
126
+ visible_history=1000
127
+ )
128
+
129
+ # Reset pendulum periodically
130
+ reset_node = ResetEachNSteps(
131
+ node_name_to_reset=pendulum.external_name,
132
+ n_steps=1000
133
+ )
134
+
135
+ # Create and run computation graph
136
+ graph = Graph(
137
+ [pendulum, lqr, viz, reset_node],
138
+ initialize_inner_time=True,
139
+ states_to_log=[pendulum.state.full_name, lqr.action.full_name]
140
+ )
141
+ graph.resolve(graph.variables)
142
+
143
+ # Run simulation
144
+ for _ in range(5000):
145
+ graph.step()
146
+ ```
147
+
148
+ This example demonstrates key features of Regelum:
149
+ - Modular node-based architecture
150
+ - Built-in controllers (LQR, PID, MPC)
151
+ - Real-time visualization
152
+ - Automatic state management
153
+ - Easy system composition
154
+
155
+ For more advanced examples, check out:
156
+ - State estimation with UKF
157
+ - Model predictive control
158
+ - Custom reward functions
159
+ - Advanced visualization
160
+
161
+ ## Documentation
162
+
163
+ Visit our [documentation](https://aidagroup.github.io/regelum/) for:
164
+ - Detailed tutorials and examples
165
+ - API reference
166
+ - Mathematical foundations
167
+ - Best practices
168
+
169
+ ## Development
170
+
171
+ We use several tools to maintain code quality:
172
+
173
+ - **Type Checking**: MyPy with strict settings
174
+ - **Linting**: Ruff and Pylint
175
+ - **Formatting**: Black
176
+ - **Testing**: Pytest
177
+ - **Pre-commit**: Automated checks before commits
178
+
179
+ ## Contributing
180
+
181
+ 1. Fork the repository
182
+ 2. Create a feature branch
183
+ 3. Make your changes
184
+ 4. Run tests and ensure code quality:
185
+ ```bash
186
+ pre-commit run --all-files
187
+ pytest
188
+ ```
189
+ 5. Submit a pull request
190
+
191
+ ## License
192
+
193
+ MIT License - see [LICENSE](LICENSE) for details.
194
+
195
+ ## Authors
196
+
197
+ - Georgiy Malaniya
198
+ - Pavel Osinenko
199
+ - Anton Bolychev
200
+ - Grigory Yaremenko
201
+
202
+ ## Origin
203
+
204
+ Created by Pavel Osinenko, 2015-2016
205
+ Dresden/Chemnitz, Germany
206
+
207
+ ## Citation
208
+
209
+ If you use Regelum in your research, please cite:
210
+
211
+ ```bibtex
212
+ @software{regelum2024,
213
+ author = {Malaniya, Georgiy and Osinenko, Pavel and Bolychev, Anton and Yaremenko, Grigory},
214
+ title = {Regelum: A Framework for Reinforcement Learning and Control},
215
+ year = {2024},
216
+ publisher = {GitHub},
217
+ url = {https://github.com/aidagroup/regelum}
218
+ }
219
+ ```
220
+
221
+
222
+
@@ -0,0 +1,178 @@
1
+ # Regelum
2
+
3
+ ![Pylint](https://img.shields.io/badge/pylint-9.59%2F10-brightgreen)
4
+ ![Coverage](https://img.shields.io/badge/coverage-0%25-red)
5
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ ![Black](https://img.shields.io/badge/Black-failing-red)
8
+
9
+ Regelum (German: "to control") is a powerful framework for reinforcement learning, simulation, and control systems. It provides a modular, node-based architecture for building dynamic simulation pipelines with minimal overhead.
10
+
11
+ ## Key Features
12
+
13
+ - **🔌 Modular Node Architecture**
14
+ - Build complex systems using independent, composable nodes
15
+ - Easy to extend and modify without affecting other components
16
+ - Shared global variable scope for seamless data flow
17
+
18
+ - **🔄 Synchronous Loop Design**
19
+ - Optimized for reinforcement learning tasks
20
+ - Predictable execution flow
21
+ - Built-in state management
22
+
23
+ - **📊 Integrated Tools**
24
+ - Real-time logging and visualization
25
+ - MathJax-powered documentation
26
+ - Jupyter notebook integration
27
+ - Automatic code quality checks
28
+
29
+ - **🚀 Production Ready**
30
+ - Type-checked with MyPy
31
+ - Comprehensive linting (Pylint score: 9.5+/10)
32
+ - Pre-commit hooks for code quality
33
+ - Extensive documentation
34
+
35
+ ## Installation
36
+
37
+ ### For Users
38
+ ```bash
39
+ pip install regelum
40
+ ```
41
+
42
+ ### For Developers
43
+ ```bash
44
+ pip install -e ".[dev]"
45
+ ```
46
+
47
+ ## Quick Start
48
+
49
+ Here's a practical example of controlling a pendulum using LQR with visualization:
50
+
51
+ ```python
52
+ from regelum.node.classic_control.envs.continuous import Pendulum
53
+ from regelum.node.classic_control.controllers.lqr import LQRController
54
+ from regelum.node.visualization.pygame_renderer import PendulumRenderer
55
+ from regelum.node.graph import Graph
56
+ from regelum.node.reset import ResetEachNSteps
57
+
58
+ # Create pendulum system
59
+ pendulum = Pendulum(
60
+ control_signal_name="lqr_1.action",
61
+ initial_state=np.array([np.pi, 0.0])
62
+ )
63
+
64
+ # Configure LQR controller
65
+ A = np.array([[0, 1], [-3 * pendulum.gravity_acceleration / (2 * pendulum.length), 0]])
66
+ B = np.array([[0], [1 / pendulum.mass]])
67
+ Q = np.diag([10.0, 1.0]) # State cost matrix
68
+ R = np.array([[0.1]]) # Control cost matrix
69
+
70
+ lqr = LQRController(
71
+ controlled_state=pendulum.state,
72
+ system_matrices=(A, B),
73
+ cost_matrices=(Q, R),
74
+ control_limits=(-10.0, 10.0),
75
+ step_size=0.01
76
+ )
77
+
78
+ # Add visualization
79
+ viz = PendulumRenderer(
80
+ state_variable=pendulum.state,
81
+ fps=60.0,
82
+ window_size=(1200, 400),
83
+ visible_history=1000
84
+ )
85
+
86
+ # Reset pendulum periodically
87
+ reset_node = ResetEachNSteps(
88
+ node_name_to_reset=pendulum.external_name,
89
+ n_steps=1000
90
+ )
91
+
92
+ # Create and run computation graph
93
+ graph = Graph(
94
+ [pendulum, lqr, viz, reset_node],
95
+ initialize_inner_time=True,
96
+ states_to_log=[pendulum.state.full_name, lqr.action.full_name]
97
+ )
98
+ graph.resolve(graph.variables)
99
+
100
+ # Run simulation
101
+ for _ in range(5000):
102
+ graph.step()
103
+ ```
104
+
105
+ This example demonstrates key features of Regelum:
106
+ - Modular node-based architecture
107
+ - Built-in controllers (LQR, PID, MPC)
108
+ - Real-time visualization
109
+ - Automatic state management
110
+ - Easy system composition
111
+
112
+ For more advanced examples, check out:
113
+ - State estimation with UKF
114
+ - Model predictive control
115
+ - Custom reward functions
116
+ - Advanced visualization
117
+
118
+ ## Documentation
119
+
120
+ Visit our [documentation](https://aidagroup.github.io/regelum/) for:
121
+ - Detailed tutorials and examples
122
+ - API reference
123
+ - Mathematical foundations
124
+ - Best practices
125
+
126
+ ## Development
127
+
128
+ We use several tools to maintain code quality:
129
+
130
+ - **Type Checking**: MyPy with strict settings
131
+ - **Linting**: Ruff and Pylint
132
+ - **Formatting**: Black
133
+ - **Testing**: Pytest
134
+ - **Pre-commit**: Automated checks before commits
135
+
136
+ ## Contributing
137
+
138
+ 1. Fork the repository
139
+ 2. Create a feature branch
140
+ 3. Make your changes
141
+ 4. Run tests and ensure code quality:
142
+ ```bash
143
+ pre-commit run --all-files
144
+ pytest
145
+ ```
146
+ 5. Submit a pull request
147
+
148
+ ## License
149
+
150
+ MIT License - see [LICENSE](LICENSE) for details.
151
+
152
+ ## Authors
153
+
154
+ - Georgiy Malaniya
155
+ - Pavel Osinenko
156
+ - Anton Bolychev
157
+ - Grigory Yaremenko
158
+
159
+ ## Origin
160
+
161
+ Created by Pavel Osinenko, 2015-2016
162
+ Dresden/Chemnitz, Germany
163
+
164
+ ## Citation
165
+
166
+ If you use Regelum in your research, please cite:
167
+
168
+ ```bibtex
169
+ @software{regelum2024,
170
+ author = {Malaniya, Georgiy and Osinenko, Pavel and Bolychev, Anton and Yaremenko, Grigory},
171
+ title = {Regelum: A Framework for Reinforcement Learning and Control},
172
+ year = {2024},
173
+ publisher = {GitHub},
174
+ url = {https://github.com/aidagroup/regelum}
175
+ }
176
+ ```
177
+
178
+
@@ -0,0 +1,103 @@
1
+ [project]
2
+ name = "regelum"
3
+ version = "0.1.0"
4
+ description = "Regelum is a flexibly configurable framework for computational graph construction and execution."
5
+ authors = [
6
+ {name = "Georgiy Malaniya", email = "pwlsd.gm@gmail.com"},
7
+ {name = "Anton Bolychev", email = "bolychev.anton@gmail.com"},
8
+ {name = "Grigoriy Yaremenko", email = "yaremenko8@gmail.com"},
9
+ {name = "Pavel Osinenko", email = "p.osinenko@yandex.ru"}
10
+ ]
11
+ requires-python = ">=3.12"
12
+ readme = "README.md"
13
+ license = {text = "MIT"}
14
+ dependencies = [
15
+ "opencv-python>=4.11.0.86",
16
+ "pygame>=2.6.1",
17
+ "casadi>=3.6.7",
18
+ "torch>=2.4.1",
19
+ "pandas>=2.2.3",
20
+ "omegaconf>=2.3.0",
21
+ "scipy>=1.14.1",
22
+ "matplotlib>=3.9.2",
23
+ "loguru>=0.7.3",
24
+ "dask[complete]>=2024.12.1",
25
+ "graphviz>=0.20.3",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = [
30
+ "pytest>=8.3.4",
31
+ "pytest-cov>=4.1.0",
32
+ "pre-commit>=3.6.0",
33
+ "mkdocs-material>=9.5.47",
34
+ "mkdocs-autorefs>=1.2.0",
35
+ "mkdocs-macros-plugin>=1.0.5",
36
+ "mkdocs-gen-files>=0.5.0",
37
+ "mkdocs-literate-nav>=0.6.1",
38
+ "mkdocs-section-index>=0.3.8",
39
+ "mkdocs-jupyter>=0.25.1",
40
+ "black>=24.3.0",
41
+ "ruff>=0.3.0",
42
+ "mypy>=1.8.0",
43
+ "pylint>=3.0.3",
44
+ "types-PyYAML>=6.0.12",
45
+ "types-setuptools>=75.6.0.20241223",
46
+ "types-requests>=2.32.0.20241016",
47
+ ]
48
+
49
+
50
+ [tool.poetry.extras]
51
+ dev = [
52
+ "pytest",
53
+ "pytest-cov",
54
+ "pre-commit",
55
+ "mkdocs-material",
56
+ "black",
57
+ "ruff",
58
+ "mypy",
59
+ "pylint",
60
+ "types-PyYAML",
61
+ "types-setuptools",
62
+ "types-requests",
63
+ "mkdocs-autorefs",
64
+ "mkdocs-macros-plugin",
65
+ "mkdocs-gen-files",
66
+ "mkdocs-literate-nav",
67
+ "mkdocs-section-index",
68
+ "mkdocs-jupyter"
69
+ ]
70
+
71
+ [build-system]
72
+ requires = ["poetry-core"]
73
+ build-backend = "poetry.core.masonry.api"
74
+
75
+ [dependency-groups]
76
+ dev = [
77
+ "mkdocstrings>=0.29.0",
78
+ "mkdocstrings-python>=1.16.8",
79
+ ]
80
+
81
+ [tool.pytest.ini_options]
82
+ addopts = "--cov=regelum --cov-report=term-missing"
83
+ testpaths = ["tests"]
84
+
85
+ [tool.coverage.run]
86
+ source = ["regelum"]
87
+ omit = [
88
+ "regelum/utils/*",
89
+ "regelum/node/visualization/*",
90
+ "regelum/node/classic_control/*",
91
+ "tests/*",
92
+ "examples/*",
93
+ ]
94
+
95
+ [tool.coverage.report]
96
+ exclude_lines = [
97
+ "pragma: no cover",
98
+ "def __repr__",
99
+ "raise NotImplementedError",
100
+ "if __name__ == .__main__.:",
101
+ "pass",
102
+ "raise ImportError",
103
+ ]
@@ -0,0 +1,82 @@
1
+ """Regelum: A High-Performance Node-Based Computation Framework.
2
+
3
+ Regelum is a powerful framework for building and executing computational graphs,
4
+ with support for parallel execution, symbolic computation, and automatic dependency resolution.
5
+
6
+ Key Features:
7
+ - Node-based computation with automatic dependency tracking
8
+ - Parallel execution using Dask
9
+ - Symbolic computation support via CasADi
10
+ - Flexible graph composition and manipulation
11
+ - Built-in logging and debugging tools
12
+ """
13
+
14
+ from contextlib import contextmanager
15
+ from typing import Dict, Any, Iterator
16
+
17
+ from regelum.node.core.globals import _SYMBOLIC_INFERENCE_ACTIVE
18
+ from regelum.node.core.variable import Variable
19
+ from regelum.node.core.inputs import Inputs
20
+
21
+ __version__ = "1.0.0"
22
+ __author__ = "Regelum Team"
23
+ __license__ = "MIT"
24
+
25
+ # Core components
26
+ from regelum.node.base import Node
27
+ from regelum.node.core.types import ResolveStatus
28
+ from regelum.node.graph import Graph
29
+ from regelum.node.logging import Clock, StepCounter, Logger
30
+ from regelum.node.parallel import ParallelGraph
31
+
32
+
33
+ @contextmanager
34
+ def symbolic_mode() -> Iterator[None]:
35
+ """Context manager for symbolic mode."""
36
+ _SYMBOLIC_INFERENCE_ACTIVE.value = True
37
+ try:
38
+ yield
39
+ finally:
40
+ _SYMBOLIC_INFERENCE_ACTIVE.value = False
41
+
42
+
43
+ def get_version() -> str:
44
+ """Get the version of Regelum."""
45
+ return __version__
46
+
47
+
48
+ # Package metadata
49
+ metadata: Dict[str, Any] = {
50
+ "name": "regelum",
51
+ "version": __version__,
52
+ "author": __author__,
53
+ "license": __license__,
54
+ "description": "High-Performance Node-Based Computation Framework",
55
+ "requires": [
56
+ "numpy",
57
+ "casadi",
58
+ "torch",
59
+ "dask",
60
+ "dask.distributed",
61
+ ],
62
+ }
63
+
64
+ __all__ = [
65
+ # Core classes
66
+ "Node",
67
+ "Graph",
68
+ "ParallelGraph",
69
+ "Variable",
70
+ "Inputs",
71
+ # Utility nodes
72
+ "Clock",
73
+ "StepCounter",
74
+ "Logger",
75
+ # Enums and status
76
+ "ResolveStatus",
77
+ # Context managers
78
+ "symbolic_mode",
79
+ # Version and metadata
80
+ "get_version",
81
+ "metadata",
82
+ ]
@@ -0,0 +1,61 @@
1
+ """Node system for building computational graphs.
2
+
3
+ This package provides a flexible framework for building and executing computational
4
+ graphs with a focus on control systems and simulation. It supports:
5
+
6
+ Core Components:
7
+ - Nodes: Self-contained computational units with state
8
+ - Variables: Type-safe data containers with reset capabilities
9
+ - Graphs: Containers that manage node execution and dependencies
10
+ - Parallel Execution: Task-based parallelism using Dask
11
+
12
+ Key Features:
13
+ 1. Dependency Management:
14
+ - Automatic resolution of node dependencies
15
+ - Full variable name qualification (node_name.variable_name)
16
+ - Circular dependency detection
17
+
18
+ 2. Execution Control:
19
+ - Mixed continuous/discrete time dynamics
20
+ - Coordinated reset behavior
21
+ - Parallel execution with dependency preservation
22
+
23
+ 3. State Management:
24
+ - Automatic variable tracking
25
+ - Configurable reset behavior
26
+ - Monte Carlo simulation support
27
+
28
+ Example:
29
+ ```python
30
+ from regelum.node import Node, Graph
31
+
32
+ # Define a node
33
+ class Controller(Node):
34
+ def __init__(self):
35
+ super().__init__(
36
+ inputs=["plant_1.state"],
37
+ step_size=0.01
38
+ )
39
+ self.action = self.define_variable("action", value=0.0)
40
+
41
+ def step(self):
42
+ # Implement control logic
43
+ pass
44
+
45
+ # Create and run a graph
46
+ plant = Plant()
47
+ controller = Controller()
48
+ graph = Graph(
49
+ [plant, controller],
50
+ initialize_inner_time=True
51
+ )
52
+ graph.resolve(graph.variables)
53
+ graph.step()
54
+ ```
55
+
56
+ The package is designed for:
57
+ - Control system simulation
58
+ - Reinforcement learning environments
59
+ - Real-time data processing
60
+ - Distributed computation
61
+ """