Skip to main content

ember_rl/
lib.rs

1//! Reinforcement learning algorithms powered by Burn, built on rl-traits.
2//!
3//! `ember-rl` is the algorithm layer in the stack:
4//!
5//! ```text
6//! rl-traits     →  core traits (Environment, Agent, Policy, ...)
7//! ember-rl      →  algorithm implementations using Burn (this crate)
8//! bevy-gym      →  Bevy ECS plugin for visualisation and parallelisation
9//! ```
10//!
11//! # Quick start
12//!
13//! ```rust,ignore
14//! use burn::backend::NdArray;
15//! use ember_rl::{
16//!     algorithms::dqn::{DqnAgent, DqnConfig},
17//!     encoding::{VecEncoder, UsizeActionMapper},
18//!     training::DqnRunner,
19//! };
20//!
21//! type B = NdArray;
22//!
23//! let env = CartPoleEnv::new();
24//! let config = DqnConfig::default();
25//! let encoder = VecEncoder::new(4);
26//! let action_mapper = UsizeActionMapper::new(2);
27//! let device = Default::default();
28//!
29//! let agent = DqnAgent::<_, _, _, B>::new(encoder, action_mapper, config, device);
30//! let mut runner = DqnRunner::new(env, agent, 42);
31//!
32//! for step in runner.steps().take(50_000) {
33//!     if step.episode_done {
34//!         println!("Episode {} | reward: {:.1}", step.episode, step.episode_reward);
35//!     }
36//! }
37//! ```
38
39pub mod algorithms;
40pub mod encoding;
41pub mod stats;
42pub mod traits;
43pub mod training;
44
45#[cfg(feature = "envs")]
46pub mod envs;
47
48#[cfg(feature = "dashboard")]
49pub mod dashboard;