mod runner

module runner

run_rs: the pure-Rust SA driver loop. Drives any Sampler<f64> and returns a History. The Sampler trait keeps the driver loop independent of the concrete proposal and acceptance machinery.

Functions

fn qmc_skip_from_seed(seed: u64) -> u64

Deterministic positive Halton skip derived from a run seed.

fn run_rs<S: Sampler<f64>>(sampler: S, cooling: &dyn Cooling<f64>, n_epochs: usize, steps_per_epoch: usize, seed: u64) -> History

Runs the Metropolis-Hastings SA driver for n_epochs epochs of steps_per_epoch proposals each, seeded from seed.

Initial position is drawn uniformly from variant.obj.bounds(). Per epoch: temperature T_k = variant.cool.temperature(epoch); each proposal goes through variant.mover.propose -> variant.obj.eval -> variant.accept.accept_prob; bookkeeping per epoch is collected into an EpochLine. Best-seen (pos, val) is updated after every accepted move.

Determinism: same seed produces bitwise-identical History.best.pos and per-epoch accepted / rejected counters.

fn run_rs_qmc_variant<O, C, N, M, A>(variant: SaVariant<f64, O, C, N, M, A>, n_starts: usize, n_epochs: usize, steps_per_epoch: usize, seed: u64) -> History
where
    O: eindir_core::Objective<f64> + Send + Sync,
    C: Cooling<f64> + Clone,
    N: crate::neigh::Neighborhood<f64>,
    M: crate::movekernel::MoveKernel<f64>,
    A: crate::accept::AcceptRule<f64>

Runs the same SaVariant from a bounded low-discrepancy start set and returns the best history across starts.

fn run_rs_variant<O, C, N, M, A>(variant: SaVariant<f64, O, C, N, M, A>, n_epochs: usize, steps_per_epoch: usize, seed: u64) -> History
where
    O: eindir_core::Objective<f64> + Send + Sync,
    C: Cooling<f64> + Clone,
    N: crate::neigh::Neighborhood<f64>,
    M: crate::movekernel::MoveKernel<f64>,
    A: crate::accept::AcceptRule<f64>

Convenience wrapper: drives a SaVariant through run_rs, supplying the variant’s own cooling schedule. Equivalent to the pre-A1 API.

fn run_rs_variant_resumed<O, C, N, M, A>(variant: SaVariant<f64, O, C, N, M, A>, start_epoch: usize, n_epochs: usize, steps_per_epoch: usize, seed: u64, resume: Option<eindir_core::FPair<f64>>) -> (History, eindir_core::FPair<f64>)
where
    O: eindir_core::Objective<f64> + Send + Sync,
    C: Cooling<f64> + Clone,
    N: crate::neigh::Neighborhood<f64>,
    M: crate::movekernel::MoveKernel<f64>,
    A: crate::accept::AcceptRule<f64>

Resumable variant driver: runs epochs [start_epoch, start_epoch + n_epochs) of the variant’s own cooling schedule, continuing from a prior chain position when one is supplied, and returns the history together with the final chain state so a caller can extend the same annealing trajectory across allocation slices. Slice-restarted SA never anneals; a persistent chain recovers the long-schedule behaviour of the classical presets.