mod parallel_tempering¶
- module parallel_tempering¶
Parallel-tempering driver. Wraps any Sampler<f64> and runs M of them in parallel at a geometric temperature ladder, with adjacent- pair Metropolis swaps every
swap_periodsteps.Composition: PT is orthogonal to the inner Sampler. Whether the inner kernel is random-walk Metropolis (
SaVariant), HMC (HmcSaSampler), or a custom sampler, PT lifts it to a multi-temperature ensemble.Functions
- fn geometric_ladder(t_cold: f64, t_hot: f64, n_chains: usize) -> Vec<f64>¶
Geometric temperature ladder spanning
[t_cold, t_hot]withn_chainsrungs.T_0 = t_cold(production temperature),T_{M-1} = t_hot(broad-exploration temperature).
Structs and Unions
- struct ParallelTemperingSampler<S: Sampler<f64>, E: Exchange<f64>>¶
PT driver. Constraint: the inner sampler’s
Coolingis bypassed – each chain operates at a fixed temperature from the ladder, NOT at the cooling schedule’s epoch-indexed value. PT and cooling are orthogonal in this driver.- sampler: S¶
Shared inner-sampler logic.
- exchange: E¶
The exchange operator. Defaults to
MetropolisExchange.
- temps: Vec<f64>¶
Temperature ladder (length = n_chains).
- k_inner: usize¶
Inner-loop step count per epoch per chain.
- swap_period: usize¶
Swap attempt period: try a swap every
swap_periodinner-loop steps.
Implementations
- impl<S: Sampler<f64>> ParallelTemperingSampler<S, MetropolisExchange>¶
Functions
- fn new(sampler: S, temps: Vec<f64>, k_inner: usize, swap_period: usize) -> Self¶
Constructs with default Metropolis exchange.
- impl<S: Sampler<f64>, E: Exchange<f64>> ParallelTemperingSampler<S, E>¶
Functions
-
fn run<C>(&self, _cooling: &C, n_epochs: usize, seed: u64) -> PtResult¶
where
C: Cooling<f64>
¶ Runs the PT loop for
n_epochsepochs.Each chain’s RNG is seeded from
seed.wrapping_add(c as u64). The shared swap RNG isseed.wrapping_add(M+1). Per epoch we runk_innerinner-loop steps per chain, attempting adjacent- pair swaps everyswap_periodsteps. The Cool inside the inner sampler is ignored at the chain temperature; the swap rule targets the Boltzmann distribution at each chain’s fixed temp.
- fn with_exchange(sampler: S, exchange: E, temps: Vec<f64>, k_inner: usize, swap_period: usize) -> Self¶
Constructs with a user-chosen exchange operator.
-
fn run<C>(&self, _cooling: &C, n_epochs: usize, seed: u64) -> PtResult¶
- struct PtChainState¶
Per-temperature chain state for a PT run.
- temp: f64¶
Temperature this chain operates at.