mod exchange

module exchange

Parallel-tempering exchange operator for multi-temperature ensembles. trait Exchange<T>: the parallel-tempering swap operator that handles periodic swaps between chains at distinct temperatures. The composition law E1 (detailed balance across the swap) is satisfied by Metropolis acceptance.

Within the typed algebra:

  • Cool, Neigh, Move, Accept stay per-chain unchanged.

  • Exchange takes two chain states, temperatures, and objective values, then returns a swap-accept probability in [0, 1].

  • ParallelTemperingSampler wraps an inner Sampler<T>, runs M replicas on a temperature ladder, and calls Exchange every swap_period steps.

Traits

trait Exchange<T: Float>

Parallel-tempering swap acceptance rule.

At adjacent chains i (cooler) and j (hotter) with temperatures T_i < T_j` and objective values F_i, F_j`, the probability of accepting a state swap is min(1, exp((1/T_i - 1/T_j) * (F_i - F_j))). This satisfies detailed balance with respect to the joint product distribution ``prod_k pi_{T_k}(x_k).

Functions

fn satisfies_detailed_balance(&self) -> bool

Optional witness for E1 (detailed balance). Default returns true since the Metropolis swap below satisfies E1 by construction; custom Exchange impls can override when they need executable proptest sweeps.

fn swap_accept_prob(&self, f_i: T, t_i: T, f_j: T, t_j: T) -> T

Returns the swap-accept probability in [0, 1].

Structs and Unions

struct MetropolisExchange

Standard parallel-tempering Metropolis swap. The canonical choice; satisfies detailed balance for any pair of canonical-Boltzmann distributions at temperatures T_i, T_j.

Traits implemented

impl<T: Float + Send + Sync> Exchange<T> for MetropolisExchange
struct TsallisExchange<T: Float>

Tsallis-q exchange rule: the q-deformed analogue of the canonical Metropolis swap, matching the GSA acceptance family. At q = 1 reduces to MetropolisExchange.

Swap probability is the q-deformed expression max(0, [1 - (q - 1) * (F_i - F_j) * (1/T_i - 1/T_j)]^{1/(q-1)}), clamped to [0, 1]. Reduces to standard PT via the Metropolis limit Theorem 3 of the IISE manuscript at q -> 1.

q: T

Tsallis index. q = 1 reduces to Metropolis.

Implementations

impl<T: Float> TsallisExchange<T>

Functions

fn new(q: T) -> Self

Constructs with the given q.

Traits implemented

impl<T: Float + Send + Sync> Exchange<T> for TsallisExchange<T>