| Crates.io | frostfire |
| lib.rs | frostfire |
| version | 0.1.2 |
| created_at | 2025-05-25 07:04:59.638993+00 |
| updated_at | 2025-05-25 07:31:53.360909+00 |
| description | A modular, mathematically rigorous, performant, reusable simulated annealing optimization engine |
| homepage | |
| repository | https://github.com/copyleftdev/frostfire |
| max_upload_size | |
| id | 1688128 |
| size | 64,379 |
A modular, mathematically rigorous, performant, reusable simulated annealing optimization engine implemented in Rust.
use frostfire::prelude::*;
// Define your problem state
#[derive(Clone)]
struct MyState { /* ... */ }
impl State for MyState {
fn neighbor(&self, rng: &mut impl Rng) -> Self {
// Generate a neighbor state
}
}
// Define your energy/cost function
struct MyEnergy { /* ... */ }
impl Energy for MyEnergy {
type State = MyState;
fn cost(&self, state: &Self::State) -> f64 {
// Calculate cost
}
}
// Create and run the annealer
fn main() {
let initial_state = MyState { /* ... */ };
let energy = MyEnergy { /* ... */ };
let schedule = GeometricSchedule::new(100.0, 0.95);
let mut annealer = Annealer::new(
initial_state,
energy,
schedule,
seeded_rng(42), // For reproducibility
10000, // Max iterations
);
let (best_state, best_energy) = annealer.run();
println!("Best energy: {}", best_energy);
}
For full API documentation, please visit docs.rs/frostfire.
Licensed under either of:
at your option.