Physics-rl
Physics-rl allows users to easily train tensorflow agents using reinforcement learning in environments simulated using FENiCSx.
This library provides the following functionalities:
- Tools to handle a mix of distributed computation and single-node computation (Coordinator and Coordinated classes and
@paralleldecorator). - Ready to use simulation of two physical environments governed by the heat diffusion equation (HeatEnvironment class) and by a monodomain Mitchell-Schaeffer model (MonodomainMitchellSchaeffer class).
- A class that handles data collection and training using user-provided agents and environments with reasonable opinionated defaults (Dojo class).
Coordination system
Any class that needs to run distributed FENiCSx computation should inherit from Coordinated and the methods that need to be run on all processes should be marked with the @parallel decorator. The result is a class that can be used in the leader process as if it was running in a single process (thus allowing compatibility with tf-agent's ecosystem), while still running on all processes the necessary computations.
All processes should have a Coordinator instance; in most cases there should be exactly one per process. All instances inheriting from Coordinated must be registered in the Coordinator, the corresponding instances of the same class in different processes are registered in a common namespace (the namespace can be manually set, but in most cases it is inferred automatically). This allows a function call in an instance in the leader process to be replicated on the correct instances in the follower processes.
The typical usage of the library is as follows
coordinator = Coordinator()
env = System(coordinator) # System inherits from Coordinated and PyEnvironment
with coordinator:
if coordinator.is_leader():
env = tf_py_environment.TFPyEnvironment(env)
q_net = QNetwork(env.observation_spec(), env.action_spec())
dojo = Dojo(q_net, env)
dojo.train(100)
Check out the file example_dojo_fenics.py for a complete example of how the library can be used.
Setup
- Uninstall MPI if you have already installed it (in some cases it conflicts with conda's MPI installation)
- Create environment
conda create --name physicsrl python==3.10
conda activate physicsrl
- install dolfinx following the official instructions
conda install -c conda-forge fenics-dolfinx mpich pyvista
- install the other dependencies
pip install -r requirements.txt
Compatibility
Python 3.9 or more recent is required.
Metadata
Release files for physicsrl 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| physicsrl-1.0.0.tar.gz | 2.6 kB | Without provenance | Details for physicsrl-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| physicsrl-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for physicsrl-1.0.0-py3-none-any.whl |
Total release size: 12.6 kB
Release files / physicsrl-1.0.0.tar.gz
| Download URL | physicsrl-1.0.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5f232aea20272f89a902941aa8d38fbc3a2548c0a4093a73c348fcb4f437308f
|
|
BLAKE2b-256 checksum How to use checksums |
3dc85479e4664c804b15cf002d5d2eeb6463008f92cf87c3fd2098e046552b52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Release files / physicsrl-1.0.0-py3-none-any.whl
| Download URL | physicsrl-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ad26d203dee989aab73a79f3d797fe36273007570b09a1d587b691fa3cf67ed
|
|
BLAKE2b-256 checksum How to use checksums |
578081375bf1f99f7709c1b75384d10a71ec8fa8c01c2634aa620641b58625e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Security for physicsrl 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.