Skip to main content

solverforge_solver/phase/localsearch/
config.rs

1//! Local search phase configuration.
2
3/// Local search phase configuration.
4#[derive(Debug, Clone)]
5pub struct LocalSearchConfig {
6    /// The acceptor type to use.
7    pub acceptor_type: AcceptorType,
8    /// Maximum number of steps (None = unlimited).
9    pub step_limit: Option<u64>,
10    /// Number of accepted moves to collect before quitting early.
11    pub accepted_count_limit: Option<usize>,
12}
13
14impl Default for LocalSearchConfig {
15    fn default() -> Self {
16        Self {
17            acceptor_type: AcceptorType::HillClimbing,
18            step_limit: Some(1000),
19            accepted_count_limit: Some(1),
20        }
21    }
22}
23
24/// Type of acceptor to use in local search.
25#[derive(Debug, Clone, Copy, PartialEq, Eq)]
26pub enum AcceptorType {
27    /// Accept only improving moves.
28    HillClimbing,
29    /// Accept moves with probability based on temperature.
30    SimulatedAnnealing,
31}