Skip to main content

Crate tempura_sa

Crate tempura_sa 

Source
Expand description

§Tempura — Temperature-Driven Optimization Primitives for Rust

Tempura is a high-performance annealing framework providing composable primitives for temperature-based stochastic optimization.

§Quick Start

use tempura_sa::prelude::*;

fn main() -> Result<(), AnnealError> {
    let result = Annealer::builder()
        .objective(FnEnergy(|x: &Vec<f64>| x.iter().map(|v| v * v).sum()))
        .moves(GaussianMove::new(0.5))
        .schedule(Exponential::new(100.0, 0.9999))
        .iterations(100_000)
        .seed(42)
        .build()?
        .run(vec![5.0, -3.0, 7.0]);

    println!("Best energy: {}", result.best_energy);
    Ok(())
}

Modules§

annealer
Single-solution simulated annealing engine with builder pattern. Single-solution simulated annealing engine.
diagnostics
Run diagnostics, trajectory recording, and result types. Observability for annealing runs — energy trajectory, acceptance ratio, temperature evolution, and convergence diagnostics.
energy
Energy (cost function) trait and helpers. Energy (cost function) trait — the objective to minimize.
error
Error types for configuration and runtime failures. Error types for the Tempura annealing framework.
landscape
Benchmark landscapes for testing and validation. Benchmark energy landscapes with known analytical properties.
math
Numerical primitives: acceptance functions, fast exp, quantum tunneling. Numerical primitives for the annealing hot loop.
moves
Move operators: Gaussian perturbation, neighbor swap, and custom moves. Move operators — state perturbation strategies.
parallel
Parallel tempering (replica exchange) algorithm. Parallel Tempering (Replica Exchange) engine.
population
Population annealing with Boltzmann-weighted resampling. Population Annealing engine.
prelude
Convenience re-exports for the most common types.
rng
Deterministic pseudo-random number generators. Deterministic RNG infrastructure for reproducible annealing.
schedule
Cooling schedules: linear, exponential, logarithmic, adaptive, and more. Cooling schedules — temperature as a function of iteration.
state
State trait (blanket impl for Clone + Debug).