pub struct LocalSearchSolver { /* private fields */ }Expand description
Local search solver utilizing tabu search memory and move neighborhoods.
Implementations§
Source§impl LocalSearchSolver
impl LocalSearchSolver
Sourcepub fn new(tabu_tenure: usize) -> Self
pub fn new(tabu_tenure: usize) -> Self
Creates a local search solver with a specified tabu memory size.
Sourcepub fn solve(
&self,
graph: &ValidatedGraph,
options: &SolverOptions,
) -> SolveOutcome
pub fn solve( &self, graph: &ValidatedGraph, options: &SolverOptions, ) -> SolveOutcome
Solves the COP problem using Local Search and Tabu memory.
If options.shared_incumbent is set (see crate::solver::SharedIncumbent, used by
crate::solver::ParallelSolver), every improving solution found is also offered to it —
write-only: unlike crate::solver::BranchAndBoundSolver, this solver has no
bound-pruning to benefit from reading it back.
§Complexity
Time per step: O(D * (K + O)) while repairing a conflict (D is the chosen variable’s domain size, K its constraint degree, O the objective count), O(N * D * (K + O)) for a soft-improvement step over all N variables. Nothing is allocated per candidate. Space: O(N + C + T) for the assignment, the violated-constraint set and the tabu tenure.
Sourcepub fn repair_from(
&self,
graph: &ValidatedGraph,
baseline: &HashMap<VariableId, i64>,
options: &SolverOptions,
) -> SolveOutcome
pub fn repair_from( &self, graph: &ValidatedGraph, baseline: &HashMap<VariableId, i64>, options: &SolverOptions, ) -> SolveOutcome
Repairs baseline instead of building a starting assignment.
The caller already holds a complete assignment and wants it improved, which is the situation every repair search is actually in — after a destroy step, after a model change, after another worker got close. Building a fresh starting assignment there would throw away what is known and cost a propagation pass plus a sweep over every variable, per call.
A value the baseline gives a variable is kept only while its domain still allows it; otherwise the variable is placed like any other. That is what lets a caller pin part of the model by narrowing domains and hand the rest over as-is.