Skip to main content

thrust_rl/train/a2c/
mod.rs

1//! Synchronous Advantage Actor-Critic (A2C) trainer.
2//!
3//! A2C is the synchronous variant of A3C (Mnih et al. 2016,
4//! "Asynchronous Methods for Deep Reinforcement Learning",
5//! arXiv:1602.01783): a shared actor-critic network collects short
6//! `n_steps`-long rollouts across `num_envs` parallel actors and performs
7//! a single gradient update per rollout. It lands as a sibling module to
8//! [`crate::train::ppo`], reusing the same policy/optimizer/GAE infra with
9//! a simpler single-update-per-rollout loop.
10//!
11//! This module is built incrementally by the A2C decomposition (#150):
12//! - [`A2cConfig`] — hyperparameters (builder + `validate()`), mirroring
13//!   [`crate::train::ppo::PPOConfig`] (#151).
14//! - [`loss`] — the un-clipped policy-gradient + plain-MSE value loss
15//!   ([`compute_a2c_policy_loss`], [`compute_a2c_value_loss`]) and the
16//!   [`A2cTrainer`] single-update-per-rollout loop (#152).
17
18pub mod config;
19pub mod loss;
20pub mod trainer;
21
22pub use config::A2cConfig;
23pub use loss::{compute_a2c_policy_loss, compute_a2c_value_loss};
24pub use trainer::{A2cStats, A2cTrainer};