Expand description
High-level solver management with ergonomic API.
The SolverManager provides a simplified interface for configuring and
running solvers. It stores configuration and can create solvers on demand.
§Overview
The manager module provides:
SolverManager: High-level solver configuration and creationSolverPhaseFactory: Trait for creating fresh phase instances per solveCloneablePhaseFactory: Factory that clones a prototype phaseClosurePhaseFactory: Factory using a closure
§Example
use solverforge_solver::manager::{SolverManager, LocalSearchType};
use solverforge_core::domain::PlanningSolution;
use solverforge_core::score::SimpleScore;
use std::time::Duration;
#[derive(Clone)]
struct Schedule { score: Option<SimpleScore> }
impl PlanningSolution for Schedule {
type Score = SimpleScore;
fn score(&self) -> Option<Self::Score> { self.score }
fn set_score(&mut self, score: Option<Self::Score>) { self.score = score; }
}
// Create a manager with score calculator and termination
let manager = SolverManager::<Schedule>::builder(|_| SimpleScore::of(0))
.with_construction_heuristic()
.with_local_search(LocalSearchType::HillClimbing)
.with_time_limit(Duration::from_secs(30))
.build()
.expect("Failed to build manager");
// Create a solver from the manager
let solver = manager.create_solver();Structs§
- Cloneable
Phase Factory - A simple phase factory that clones a prototype phase.
- Closure
Phase Factory - A phase factory using a closure.
- Construction
Phase Factory - Factory for creating construction heuristic phases.
- Local
Search Phase Factory - Factory for creating local search phases.
- Solver
Manager - High-level solver manager for ergonomic solving.
- Solver
Manager Builder - Builder for creating a
SolverManagerwith fluent configuration.
Enums§
- Construction
Type - Type of construction heuristic to use.
- Local
Search Type - Type of local search algorithm to use.
- Phase
Config - Configuration for a phase.
Traits§
- Solver
Phase Factory - Factory trait for creating phases.