Skip to main content

simulated_annealing

Function simulated_annealing 

Source
pub fn simulated_annealing(
    f: impl Fn(&[f64]) -> f64,
    x0: Vec<f64>,
    initial_temp: f64,
    cooling_rate: f64,
    step_size: f64,
    max_iter: u32,
) -> OptResult
Expand description

Simulated annealing for global minimisation.

Uses a random walk proposal x_new = x + N(0, step_size). The Metropolis acceptance criterion allows uphill moves with probability exp(-ΔE / T).

Temperature follows a geometric schedule: T ← T * cooling_rate.