pub struct SolveConfig {
pub pruning: Pruning,
pub ordering: Ordering,
pub max_solutions: usize,
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: usizeCap on solutions returned. 1 is a satisfiability probe.
On a problem with more than one solution, which first solution comes
back under Pruning::Ac3 is trajectory-dependent — different
pruning/ordering combinations may return different valid members of the
solution set. Each is a genuine member (see kernel-soundness-closure.md
§7.2), but callers must not depend on the specific choice. Only
enumerate-all (usize::MAX) has a defined, pruning-invariant set.
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