Skip to main content

simulated_annealing

Function simulated_annealing 

Source
pub fn simulated_annealing<S, NB, O>(
    initial: S,
    neighbor: NB,
    objective: O,
    t0: f64,
    cooling: f64,
    max_iter: usize,
    seed: u64,
) -> (S, f64)
where S: Clone, NB: Fn(&S, &mut Rng) -> S, O: Fn(&S) -> f64,
Expand description

Generic simulated annealing: accept worsening moves with probability exp(−Δ/T), cooling T ← cooling·T each step, to escape local minima. neighbor proposes a single random move.