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_multisnake: Example of more advanced Bevy integration and adversarial training with multiple agents.
- EntityGym Rust API Docs: Rust API reference.
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
entity_gym_rs-0.3.5.tar.gz
(26.5 kB
view hashes)
Built Distributions
Close
Hashes for entity_gym_rs-0.3.5-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 967ef43b9ad64017b5ee491c7486e9410b9350b7f2d4c4e0f4392b731c477cd9 |
|
MD5 | 4bbe999a4d7df68e0eeda56b551f7233 |
|
BLAKE2b-256 | bc250e1eb014d9086b1bd93567bf9c0f29ddb6096a17e0051b2653d6c1b5a417 |
Close
Hashes for entity_gym_rs-0.3.5-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2af47bfa0e8535fd87d6c5ff5bd8840ae9b4420b007cefbfe783c5642aa8c89c |
|
MD5 | 8328bce53c7fe7a59b9de5df58122f2a |
|
BLAKE2b-256 | c9f01aa06f3e53b0c24288c1595d78100b781bcc6fbd8d063b361d2c9a5f03a9 |
Close
Hashes for entity_gym_rs-0.3.5-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6dd149f83051542484ef9d6bf3741627fcc17f9cb5b475a9659a8bfaf183d8c |
|
MD5 | 299c780f10cd1700e402d1add389d340 |
|
BLAKE2b-256 | 6b044b7b2be0b88c83a086db643a18d2419ef16b57f4e44da4a7885f14270bdf |
Close
Hashes for entity_gym_rs-0.3.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 845176293d0699cd4bb4e05ba67fbe0349dd27d750758a300d967674c7a8c095 |
|
MD5 | 1e5079d8df179c6f4f0558fd2068386a |
|
BLAKE2b-256 | 24eb5dae49d7ee7d7d1d10927707d128ea29155a80206f3303cedbb271b2d3ef |
Close
Hashes for entity_gym_rs-0.3.5-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2b2c2615ba43a7ea46170da603c3e2e6fcaf5ee109d3e35241925c78e8137a0 |
|
MD5 | c63c2b0ab0f9c7007b56de4a4a5e14b6 |
|
BLAKE2b-256 | e9fe31b13190b7d6d35ebd7a06cfce99489407802da124b1209893d2a4d0c9b3 |
Close
Hashes for entity_gym_rs-0.3.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3084a04115a43fac3b13f0effc2dd79ed7c434015f9db0bbbfc1aef9c862c54d |
|
MD5 | 622b91cf222c821bc461e0aa10f298cf |
|
BLAKE2b-256 | dca8e383b371ac5b5ae48abdf166d25600c5a7e0884723d1c8a11fb2f041c6cc |
Close
Hashes for entity_gym_rs-0.3.5-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a48d74f1b03bb2622c99df2e6131c07633a2f62944e7a0e3ba4f938d7341a9ea |
|
MD5 | dbcec50d78b9c4b33f12c55b083b7a1c |
|
BLAKE2b-256 | 60f1aa352f877901fefe7a794adbbc95d050763da5c76d39b4e714f359c15b79 |
Close
Hashes for entity_gym_rs-0.3.5-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dfb719a32a4a2d9b09a0883711a11ff81a2ce5386ce967398c2f651cee63a9e |
|
MD5 | 5c9af0be88d4d97e78b7a85d0e8b8332 |
|
BLAKE2b-256 | d19b779b99685fe3e3103226c2c22d5df79c04310e689f197bb6957736c9f42b |
Close
Hashes for entity_gym_rs-0.3.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff100d53ee47e53a76c76817470bee5576151030e367e4e2eff443f5138ea2e0 |
|
MD5 | 875c67237ef3c63b80690b867045cde3 |
|
BLAKE2b-256 | 6c4d8c8f3dc599878ef6a53f53f194819510802d591d571d4416e3f434c2cc29 |
Close
Hashes for entity_gym_rs-0.3.5-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a98b75dcade5cde3193dc72d188a4e640e8171960e7d64c068879da11d4894c |
|
MD5 | 1e7b2c42426c7be30f23e7c46f882b2e |
|
BLAKE2b-256 | d96feec555f9248e4793105461a151fd8f2705702ae7a955dcd4622843e995b3 |
Close
Hashes for entity_gym_rs-0.3.5-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2966797e4a455dcc394d139c281773e03ff28875d1f0422e05d7dcd91d501b8f |
|
MD5 | 8a122d2639b8717cedfc5d652c5cfe84 |
|
BLAKE2b-256 | e1bf9492211269fdab00684196ea0a4717c179f5caa2065648db1c4a42240402 |
Close
Hashes for entity_gym_rs-0.3.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1d9d9948ee5e125d1d0f0d08b49b781bffbe96e11b17605fcb300a748bec606 |
|
MD5 | c04f8707e715d4dbc8439b46a60250b8 |
|
BLAKE2b-256 | a746fdf9fc708fae9c7ece885de00cb4e4b6f621b12be524bc08d81cfb860c61 |
Close
Hashes for entity_gym_rs-0.3.5-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf17b4ce3b9d52c5ca56760e5edc5ff2438ca4380108013f615841674be4a41 |
|
MD5 | 0e86fceaee4442c8a8f5aa743db00126 |
|
BLAKE2b-256 | 0c006c52e83db9a51742b52d34c6b95993b469f409aed4141c354ed5c81a5bd9 |