pub enum AssignmentError {
DimensionsNotSet,
CostNotSet,
GroupLengthMismatch,
InvalidPin {
row: usize,
col: i32,
},
Infeasible,
BudgetExceeded,
}Expand description
Errors from AssignmentBuilder::solve.
Variants§
DimensionsNotSet
.rows() or .cols() was not called before .solve() (or
either was set to zero).
CostNotSet
.cost() was not called before .solve().
GroupLengthMismatch
A custom row_group / col_group slice did not match the
declared dimensions.
InvalidPin
A pin references an out-of-range row or a column that is
neither SENTINEL nor a valid 0..n_cols index, or whose
row-group does not match its target column’s group.
Fields
row: usizeRow index supplied to AssignmentBuilder::pin.
col: i32Column index (or SENTINEL) supplied to
AssignmentBuilder::pin.
Infeasible
The CSP has no feasible solution under the supplied
constraints. Note that with SENTINEL always available a
pure assignment problem is always feasible; this variant
surfaces when pins or group constraints are mutually
incompatible.
BudgetExceeded
The branch-and-bound search hit its
AssignmentBuilder::node_budget before scoring a single
complete assignment, so there is no best-so-far solution to
return. Distinct from Infeasible: the
problem may well be satisfiable — the search simply ran out of
budget. Retry with a larger (or None) node_budget. When the
budget is hit after at least one complete assignment was
scored, .solve() instead returns Ok with
SolveStats::budget_exceeded set on the best-so-far solution.
Trait Implementations§
Source§impl Debug for AssignmentError
impl Debug for AssignmentError
Source§impl Display for AssignmentError
impl Display for AssignmentError
Source§impl Error for AssignmentError
impl Error for AssignmentError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<AssignmentError> for CspError
AssignmentBuilder’s error family converts too, so py//wasm call
sites that touch the assignment/COP path get the same typed exceptions
as the Sudoku path for free. Note this conversion is itself evidence of
Pass-1 finding R8: Infeasible collapses onto Unsatisfiable here
because AssignmentError has no distinct budget-exhaustion variant yet
— fixing that is a separate, already ledgered item, not silently patched
over by this mapping.
impl From<AssignmentError> for CspError
AssignmentBuilder’s error family converts too, so py//wasm call
sites that touch the assignment/COP path get the same typed exceptions
as the Sudoku path for free. Note this conversion is itself evidence of
Pass-1 finding R8: Infeasible collapses onto Unsatisfiable here
because AssignmentError has no distinct budget-exhaustion variant yet
— fixing that is a separate, already ledgered item, not silently patched
over by this mapping.