Expand description
Solution representation and solving statistics.
This module provides types for representing solutions to CSP problems and collecting statistics about the solving process.
§Solution Access
Solutions are represented by the Solution struct, which allows indexed access
to variable values using the original VarId handles. Every solution includes
statistics about how it was found.
§Statistics
The solver collects statistics about the solving process, including the number of propagations performed and search nodes explored. These are automatically included with every solution.
§Example
use cspsolver::prelude::*;
let mut m = Model::default();
let x = m.int(1, 10);
let y = m.int(1, 10);
post!(m, x + y == int(15));
// Solve and get solution with statistics
let solution = m.solve().unwrap();
// Access solution values
println!("x = {:?}", solution[x]);
println!("y = {:?}", solution[y]);
// Access statistics
println!("Propagations: {}", solution.stats.propagation_count);
println!("Search nodes: {}", solution.stats.node_count);Structs§
- Enhanced
Solve Stats - Enhanced statistics with detailed timing information for performance analysis.
- Solution
- Assignment for decision variables that satisfies all constraints.
- Solve
Stats - Statistics collected during the solving process.