thrust-rl 0.4.0

High-performance reinforcement learning in Rust with the Burn tensor backend
Documentation
//! Guided tutorial series: from `cargo add thrust-rl` to a trained,
//! deployed policy.
//!
//! Each tutorial is a single Markdown file under [`docs/tutorials/`] whose
//! `rust` code blocks are pulled in here with `#[doc = include_str!(...)]`.
//! Because they are rendered as rustdoc, every code block is compiled and
//! run as a doc-test by `cargo test --features training` — so the copy-paste
//! code in the prose can never rot out of sync with the library API. This is
//! the CI-enforced mechanism the tutorial series is built on.
//!
//! The Markdown files are the single source of truth: read them in
//! [`docs/tutorials/`] (rendered nicely on GitHub) or here on docs.rs. The
//! series is ordered by concept dependency — see
//! [`docs/tutorials/README.md`] for the full dependency-ordered outline.
//!
//! [`docs/tutorials/`]: https://github.com/rjwalters/thrust/tree/main/docs/tutorials
//! [`docs/tutorials/README.md`]: https://github.com/rjwalters/thrust/blob/main/docs/tutorials/README.md
//!
//! # Landed tutorials
//!
//! - [`tutorial_01_first_agent`](crate::tutorials::tutorial_01_first_agent) —
//!   Your first agent (SimpleBandit + actor-critic; the rollout → loss → update
//!   loop).
//! - [`tutorial_02_cartpole_ppo`](crate::tutorials::tutorial_02_cartpole_ppo) —
//!   Solving CartPole with PPO (`EnvPool`, GAE, the config surface, reading
//!   learning curves).
//! - [`tutorial_03_dqn`](crate::tutorials::tutorial_03_dqn) — Off-policy
//!   training with DQN (replay buffer, target network, ε-annealing, Double-DQN,
//!   Polyak soft updates; when to prefer DQN over PPO).
//! - [`tutorial_04_sac`](crate::tutorials::tutorial_04_sac) — Continuous
//!   control with SAC (Box action spaces, tanh squashing, automatic entropy
//!   tuning, twin critics; reusing the off-policy replay + Polyak machinery for
//!   continuous actions).
//! - [`tutorial_05_memory`](crate::tutorials::tutorial_05_memory) — Memory and
//!   POMDPs with recurrent PPO (`FlickeringCartPole`, LSTM policy, recurrent
//!   rollouts and hidden-state handling; when an LSTM earns its cost vs. a
//!   memoryless MLP baseline).
//! - [`tutorial_06_own_env`](crate::tutorials::tutorial_06_own_env) — Writing
//!   your own environment (implementing the `Environment` trait from scratch;
//!   the seeding/determinism contract behind `clone_state` / `restore_state`).
//! - [`tutorial_07_wasm`](crate::tutorials::tutorial_07_wasm) — Train in Rust,
//!   run in the browser (exporting a trained `MlpBurnPolicy` to the
//!   `InferenceModel` JSON format, the Burn→inference weight transpose, and
//!   wiring the JSON into the WASM demo).

/// Tutorial 1 — Your first agent.
///
/// See the rendered Markdown at
/// [`docs/tutorials/01-your-first-agent.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/01-your-first-agent.md).
#[doc = include_str!("../docs/tutorials/01-your-first-agent.md")]
pub mod tutorial_01_first_agent {}

/// Tutorial 2 — Solving CartPole with PPO.
///
/// See the rendered Markdown at
/// [`docs/tutorials/02-cartpole-ppo.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/02-cartpole-ppo.md).
#[doc = include_str!("../docs/tutorials/02-cartpole-ppo.md")]
pub mod tutorial_02_cartpole_ppo {}

/// Tutorial 3 — Off-policy training with DQN.
///
/// See the rendered Markdown at
/// [`docs/tutorials/03-dqn.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/03-dqn.md).
#[doc = include_str!("../docs/tutorials/03-dqn.md")]
pub mod tutorial_03_dqn {}

/// Tutorial 4 — Continuous control with SAC.
///
/// See the rendered Markdown at
/// [`docs/tutorials/04-sac-continuous.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/04-sac-continuous.md).
#[doc = include_str!("../docs/tutorials/04-sac-continuous.md")]
pub mod tutorial_04_sac {}

/// Tutorial 5 — Memory and POMDPs with recurrent PPO.
///
/// See the rendered Markdown at
/// [`docs/tutorials/05-memory-pomdps.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/05-memory-pomdps.md).
#[doc = include_str!("../docs/tutorials/05-memory-pomdps.md")]
pub mod tutorial_05_memory {}

/// Tutorial 6 — Writing your own environment.
///
/// See the rendered Markdown at
/// [`docs/tutorials/06-your-own-env.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/06-your-own-env.md).
#[doc = include_str!("../docs/tutorials/06-your-own-env.md")]
pub mod tutorial_06_own_env {}

/// Tutorial 7 — Train in Rust, run in the browser.
///
/// See the rendered Markdown at
/// [`docs/tutorials/07-wasm-deploy.md`](https://github.com/rjwalters/thrust/blob/main/docs/tutorials/07-wasm-deploy.md).
#[doc = include_str!("../docs/tutorials/07-wasm-deploy.md")]
pub mod tutorial_07_wasm {}