Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
About ReinforceX
ReinforceX (ReX) is a deep reinforcement learning framework built entirely from scratch in Rust. We plan to implement various reinforcement learning algorithms, including value-based, policy-based, and actor-critic methods.
Advantages of Rust: Efficient memory management prevents memory leaks that often trouble data scientists when using Python. Enables thread-safe execution for parallel training. Offers overall faster training speeds compared to Python-based frameworks.
Package
crates.io: https://crates.io/crates/reinforcex
cargo add reinforcex
Algorithms
DQN PPO
API
Instantiate the agent.
use ;
use EpsilonGreedy;
use FCQNetwork;
use ReplayBuffer;
use Arc;
let device = cuda_if_available;
let vs = new;
let n_input_channels = 4;
let action_size = 2;
let n_hidden_layers = 2;
let n_hidden_channels = 128;
let optimizer = default.build.unwrap;
let model = Boxnew;
let gamma = 0.97;
let n_steps = 3;
let batchsize = 16;
let update_interval = 8;
let target_update_interval = 100;
let replay_buffer_capacity = 2000
let explorer = new;
let transition_buffer = new;
let mut agent = DQNnew;
Methods of agent.
;
;
;
Pseudo code for training.
for episode in 0..max_episode
This is a pseudo code for parallel learning. ReplayBuffer is shared by all agents.
use *;
let buffer = new;
.into_par_iter.for_each;
Sample experiments
The experimental environment is built using OpenAI Gym. Since Gym is a Python framework, set up a Python environment and run the following pip command:
pip install gymnasium==0.26.3
We use Gym as the environment by calling Python from Rust.
cargo run --features cpu -- --env cartpole --algo dqn
Unit test
cargo test
License
MIT License (https://github.com/kakky-hacker/reinforcex/blob/master/LICENSE)