Rust bindings for the entity-gym library
Project description
EntityGym for Rust
EntityGym is a Python library that defines a novel entity-based abstraction for reinforcement learning environments which enables highly ergonomic and efficient training of deep reinforcement learning agents. This crate provides bindings that allows Rust programs to be used as EntityGym training environments, and to load and run neural networks agents trained with Entity Neural Network Trainer inside Rust.
Overview
The entity-gym-rs crate provides a high-level API that allows neural network agents to interact directly with Rust data structures.
use entity_gym_rs::agent::{Agent, AgentOps, Obs, Action, Featurizable};
// We can derive an `Action` trait on enums with only unit variants to allow it to be used as a categorical action.
#[derive(Action, Debug)]
enum Move { Up, Down, Left, Right }
// The `Featurizable` trait converts data structures into a format that can be processed by neural networks.
// It can be automatically derived for any struct that contains, only primitive number types, booleans, or
// other `Featurizable` types.
#[derive(Featurizable)]
struct Player { x: i32, y: i32 }
#[derive(Featurizable)]
struct Cake {
x: i32,
y: i32,
size: u32,
}
fn main() {
// Creates an agent that acts completely randomly.
let mut agent = Agent::random();
// Alternatively, load a trained neural network agent from a checkpoint.
// let mut agent = Agent::load("agent");
// The neural network agents supported by entity-gym can process observations consisting
// of any number of `Featurizable` objects.
let obs = Obs::new(0.0)
.entities([Player { x: 0, y: 0 }])
.entities([
Cake { x: 4, y: 0, size: 4 },
Cake { x: 10, y: 42, size: 12 },
]);
// To get an action from an agent, we simple call the `act` method with the observation we constructed.
let action = agent.act::<Move>(obs);
println!("{:?}", action);
}
Docs
- bevy_snake: Example of how to use entity-gym-rs in a Bevy game.
- bevy-snake-ai: More complex Bevy application with adversarial training of multiple agents.
- EntityGym Rust API Docs: Rust API reference.
- If you have any questions, you can also get help on our discord server
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file entity_gym_rs-0.4.1.tar.gz.
File metadata
- Download URL: entity_gym_rs-0.4.1.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e235b57f47127c1da528b6eda9604e700a7a28c80ab03e407ac80d91c8dea3c
|
|
| MD5 |
90e6c31c5f11936eb54fe5cc5fc2ab1a
|
|
| BLAKE2b-256 |
2fd1f5b5c04f91f38504b686854828f316d53928249406bb9b625b17443d93ed
|
File details
Details for the file entity_gym_rs-0.4.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 446.0 kB
- Tags: PyPy, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eddb01173bfa7d142d1c15736a599a4ceb1168dbb8eb2f219913e68d36b12ab
|
|
| MD5 |
d79fbcdbadd20b4272abf1ceee5b36d5
|
|
| BLAKE2b-256 |
a098b85543725ced246a6587cd02659a918d239eac02b9b541633814cb2f0133
|
File details
Details for the file entity_gym_rs-0.4.1-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 453.8 kB
- Tags: PyPy, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92c3c3515647d399de39a642d6c6ee3287d784a2a0d149b421697f60dc3bf386
|
|
| MD5 |
33dbb15d62a8dbd442fc737b481ec532
|
|
| BLAKE2b-256 |
e477e75c4403044cc24404a05d3272c31b5327f085309a04233172adafc32f74
|
File details
Details for the file entity_gym_rs-0.4.1-cp310-none-win_amd64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp310-none-win_amd64.whl
- Upload date:
- Size: 374.0 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd281ac75a5d5b9820245376291f22f349f94e2194ff77267ac83c3494b0a1f0
|
|
| MD5 |
42b0f3eb125828724a545dd1524ab2bf
|
|
| BLAKE2b-256 |
57686dbcec5e661aed4186a8821f4ee9c1036b11c9b67b72631d101751eae073
|
File details
Details for the file entity_gym_rs-0.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 447.5 kB
- Tags: CPython 3.10, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
568c528bb8e2a5d2d6ddf91b6a61e2872593488cfd31d8cf7c02faba1f60b513
|
|
| MD5 |
a174a3d396451cdfef18480a12a89c16
|
|
| BLAKE2b-256 |
45e26a98fbd9ff7c5b039e77e067b1f1c9fb2648115b5c94530fb3818ecf01df
|
File details
Details for the file entity_gym_rs-0.4.1-cp39-none-win_amd64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp39-none-win_amd64.whl
- Upload date:
- Size: 374.0 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef9263a2fab150735889616d108ba379b67ec176b461ff7627654bb2f9e2c30d
|
|
| MD5 |
4a2523a8eb77bc565eff9075167b09ea
|
|
| BLAKE2b-256 |
3bc27e57d61d1aa588d96c26ea747a221eacc66f96fc10d80b425a092bab6e45
|
File details
Details for the file entity_gym_rs-0.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 447.7 kB
- Tags: CPython 3.9, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4b6e6daa46db41f4faf614fca8621f02700d17a09d9c52cae545c5a51fa84a
|
|
| MD5 |
90c4eb226a308c010d859e1addb6672f
|
|
| BLAKE2b-256 |
94929cb25737eb9b830ca40adff071fea54888b3ac45c36c423e43f7347298d7
|
File details
Details for the file entity_gym_rs-0.4.1-cp39-cp39-macosx_10_7_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp39-cp39-macosx_10_7_x86_64.whl
- Upload date:
- Size: 408.8 kB
- Tags: CPython 3.9, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc553ab79f942e95bf833b7612679c9c30277e7b5e0f7ce8d49ca5df8b5b2d4f
|
|
| MD5 |
b333012cc3f86e974f4186dcc9b976bd
|
|
| BLAKE2b-256 |
f2434e495d8002e9a140eb390e5bf073d4007228ac780ae65e43b0d0fc51bb0e
|
File details
Details for the file entity_gym_rs-0.4.1-cp38-none-win_amd64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp38-none-win_amd64.whl
- Upload date:
- Size: 373.6 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fbe3a74be1feb7575bd6b57daeca5307c64cc30750eccabc76afc61d7f7b0ae
|
|
| MD5 |
8465125eacdf918f2b3c6adcb2461d72
|
|
| BLAKE2b-256 |
605c1f57f489d4db59b84379cc44f7c703d05f6da31d51b9d60bd22e2acb3d24
|
File details
Details for the file entity_gym_rs-0.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 447.4 kB
- Tags: CPython 3.8, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee576078907476bde3766f9643bd0355c5ecdc30efd318e68009a48fe54e1cf5
|
|
| MD5 |
605e25e6c8c84a01753a5a331d39a23c
|
|
| BLAKE2b-256 |
bc1eaef20533273bf86b15f6c8ebe4b0864d881b61c332a3fa92523f6d9d53c0
|
File details
Details for the file entity_gym_rs-0.4.1-cp38-cp38-macosx_10_7_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp38-cp38-macosx_10_7_x86_64.whl
- Upload date:
- Size: 408.6 kB
- Tags: CPython 3.8, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70e59864edeb25917a9a2e60920085b5d61591bb46d6b240e00e720ecf2a5be4
|
|
| MD5 |
129219787d2eee96a196b14f23e55cd3
|
|
| BLAKE2b-256 |
ce351460228696cab1e37abadd84c9b38fdd870b4c9a2299d184b6bc684475ab
|
File details
Details for the file entity_gym_rs-0.4.1-cp37-none-win_amd64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp37-none-win_amd64.whl
- Upload date:
- Size: 373.6 kB
- Tags: CPython 3.7, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55b3d39b8efd9918aa627f1339e42ac6346f9f401386009ebdf72eb25e518711
|
|
| MD5 |
310d927a3cbb45b32e54c015435b7d1a
|
|
| BLAKE2b-256 |
a03e804978b8d8fd819e2061b62f36ac79b59bd0291294f51525957bc17b9946
|
File details
Details for the file entity_gym_rs-0.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
- Upload date:
- Size: 447.3 kB
- Tags: CPython 3.7m, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7964482ae492f2d143824c24e7d86be60f735c9703f8a1577f492c420312e9b
|
|
| MD5 |
10a0ee38e908bf8b3b198bb3b9c0deea
|
|
| BLAKE2b-256 |
3652eb220ab662a7414a0738e8064d6bfb41f566620bb0baf85200559c5d1db8
|
File details
Details for the file entity_gym_rs-0.4.1-cp37-cp37m-macosx_10_7_x86_64.whl.
File metadata
- Download URL: entity_gym_rs-0.4.1-cp37-cp37m-macosx_10_7_x86_64.whl
- Upload date:
- Size: 408.4 kB
- Tags: CPython 3.7m, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7321ef698d331d944491193de13486f75567e7072bc4e73a4672ad5e867e8a2f
|
|
| MD5 |
dfe6eed8e2a6f25ceb5f2c84fb040406
|
|
| BLAKE2b-256 |
e5d1c2ea9724bf3f3b83777490d770b07e37ccb8607b149a688987b04dfde01d
|