LocalSearchType

Enum LocalSearchType 

Source
pub enum LocalSearchType {
    HillClimbing,
    TabuSearch {
        tabu_size: usize,
    },
    SimulatedAnnealing {
        starting_temp: f64,
        decay_rate: f64,
    },
    LateAcceptance {
        size: usize,
    },
    ValueTabuSearch {
        value_tabu_size: usize,
    },
    MoveTabuSearch {
        move_tabu_size: usize,
        aspiration_enabled: bool,
    },
}
Expand description

Type of local search algorithm to use.

Different local search algorithms have different characteristics:

§Examples

use solverforge_solver::manager::LocalSearchType;

// Hill climbing - simplest approach
let hill = LocalSearchType::HillClimbing;
assert_eq!(hill, LocalSearchType::default());

// Tabu search with memory of 10 recent moves
let tabu = LocalSearchType::TabuSearch { tabu_size: 10 };

// Simulated annealing with temperature decay
let sa = LocalSearchType::SimulatedAnnealing {
    starting_temp: 1.0,
    decay_rate: 0.995,
};

// Late acceptance comparing to 100 steps ago
let late = LocalSearchType::LateAcceptance { size: 100 };

Variants§

§

HillClimbing

Hill climbing: only accept improving moves.

This is the simplest local search strategy. It only accepts moves that improve the score. Fast but can easily get stuck in local optima.

§Example

use solverforge_solver::manager::LocalSearchType;

let acceptor = LocalSearchType::HillClimbing;
§

TabuSearch

Tabu search: avoid recently visited states.

Maintains a list of recently made moves and forbids reversing them. This helps escape local optima by forcing exploration.

§Example

use solverforge_solver::manager::LocalSearchType;

// Keep last 7 moves in tabu list
let tabu = LocalSearchType::TabuSearch { tabu_size: 7 };

Fields

§tabu_size: usize

Size of the tabu list.

§

SimulatedAnnealing

Simulated annealing: accept worse moves with decreasing probability.

Initially accepts worse moves with high probability, but as the “temperature” decreases, it becomes more selective. Good for escaping local optima early in the search.

§Example

use solverforge_solver::manager::LocalSearchType;

// Start with temperature 1.0, decay by 0.1% per step
let sa = LocalSearchType::SimulatedAnnealing {
    starting_temp: 1.0,
    decay_rate: 0.999,
};

Fields

§starting_temp: f64

Initial temperature.

§decay_rate: f64

Temperature decay rate per step.

§

LateAcceptance

Late acceptance: compare against score from N steps ago.

Accepts a move if the new score is better than the score from N steps ago. Provides a balance between exploration and exploitation.

§Example

use solverforge_solver::manager::LocalSearchType;

// Compare against score from 400 steps ago
let late = LocalSearchType::LateAcceptance { size: 400 };

Fields

§size: usize

Number of steps to look back.

§

ValueTabuSearch

Value tabu search: forbid recently assigned values.

Remembers recently assigned values and forbids reassigning them. Different from entity tabu in that it tracks the values themselves, not the entity-variable combinations.

§Example

use solverforge_solver::manager::LocalSearchType;

// Forbid last 5 assigned values
let value_tabu = LocalSearchType::ValueTabuSearch { value_tabu_size: 5 };

Fields

§value_tabu_size: usize

Number of recent values to forbid.

§

MoveTabuSearch

Move tabu search: forbid recently made moves.

Remembers recently made moves (by hash) and forbids making the same move again. Supports aspiration criterion: tabu moves can be accepted if they lead to a new best solution.

§Example

use solverforge_solver::manager::LocalSearchType;

// Forbid last 10 moves, with aspiration enabled
let move_tabu = LocalSearchType::MoveTabuSearch {
    move_tabu_size: 10,
    aspiration_enabled: true,
};

Fields

§move_tabu_size: usize

Number of recent moves to forbid.

§aspiration_enabled: bool

Whether to allow tabu moves that reach new best score.

Trait Implementations§

Source§

impl Clone for LocalSearchType

Source§

fn clone(&self) -> LocalSearchType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalSearchType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LocalSearchType

Source§

fn default() -> Self

Returns HillClimbing as the default.

§Example
use solverforge_solver::manager::LocalSearchType;

let default = LocalSearchType::default();
assert_eq!(default, LocalSearchType::HillClimbing);
Source§

impl PartialEq for LocalSearchType

Source§

fn eq(&self, other: &LocalSearchType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for LocalSearchType

Source§

impl StructuralPartialEq for LocalSearchType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more