pub struct SolveConfig {
pub pruning: Pruning,
pub ordering: Ordering,
pub max_solutions: usize,
pub restarts: bool,
pub optimization_mode: OptimizationMode,
pub node_budget: Option<u64>,
pub cancel: Option<CancelToken>,
}Expand description
Solve configuration, isomorphic to Python’s CSP constructor arguments.
Fields§
§pruning: Pruning§ordering: Ordering§max_solutions: usize§restarts: boolEnable Luby restarts with phase saving and (if Ordering::Chs) dynamic
conflict-history weighting. Opt-in; production sudoku stays Ac3 + Mrv.
The restart driver is not yet wired onto the unified kernel (see the
pass-3 composition report — chs backtrack.rs re-authoring is deferred);
today this flag is accepted but inert.
optimization_mode: OptimizationModeOptimization mode. Defaults to Feasibility (pure constraint satisfaction).
node_budget: Option<u64>Maximum number of search nodes (backtrack / branch-and-bound
recursions) before the solver aborts early and returns whatever
solutions it has found so far. None disables the budget.
Defaults to Some(1_000_000) so an unbounded pathological
search cannot hang a caller. When the budget is hit,
SolveStats::budget_exceeded is set to true on the
returning Csp::stats(). Callers that care about optimality
should branch on this flag and either accept the best-so-far
solution or fall back to a trivial per-variable pick.
cancel: Option<CancelToken>Cooperative cancellation flag, checked at the same cadence as
node_budget. None (the default) means the search cannot be
cancelled externally. Set this to a CancelToken clone and keep
another clone on the calling side to request an early stop — e.g.
from Python, released via Python::allow_threads, when an
asyncio.wait_for timeout elapses. See SolveStats::cancelled.
Trait Implementations§
Source§impl Clone for SolveConfig
impl Clone for SolveConfig
Source§fn clone(&self) -> SolveConfig
fn clone(&self) -> SolveConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more