csp v0.1.0 Csp.Backtracking
Backtracking algorithm implementation.
Link to this section Summary
Functions
Backtracking implementation for solving CSPs.
Link to this section Types
Link to this type
variable_selector()
Specs
variable_selector() :: :take_head | ([Csp.variable()] -> {Csp.variable(), [Csp.variable()]})
Link to this section Functions
Link to this function
solve(csp, opts \\ [])
Specs
solve(Csp.t(), Keyword.t()) :: Csp.solve_result()
Backtracking implementation for solving CSPs.
Options
The following opts
are supported:
all
, boolean,false
by default: if only first, or all variables should be returned.ac3
, boolean,false
by default: if AC3 runs should be performed during each backtracking step.variable_selector
, either:take_head
(default),:minimum_remaining_values
(will select the variable with the least values remaining in the domain as the next candidate to consider), or a function accepting a list of unassigned variables, and returning a tuple of a variable we should consider next and a rest of the unassigned variables list.