View Source Backfish (Backfish v0.1.0)
Backfish is a flexible and powerful backtracking library for Elixir, designed to solve combinatorial and constraint satisfaction problems.
Summary
Functions
Finds all solutions to the given problem.
Finds the first valid solution to the given problem.
Functions
Finds all solutions to the given problem.
Parameters
problem_module
: The module implementing the problem definition usingBackfish.ProblemDefinition
.opts
: Optional keyword list of options. Supports::args
: Arguments to pass to theinitial_state/1
function of the problem module.:depth_limit
: Optional limit on the depth of the search.
Examples
iex> opts = [args: [size: 8]]
iex> Backfish.find_all_solutions(Backfish.Examples.NQueens, opts)
[solution1, solution2, ...]
Finds the first valid solution to the given problem.
Parameters
problem_module
: The module implementing the problem definition usingBackfish.ProblemDefinition
.opts
: Optional keyword list of options. Supports::args
: Arguments to pass to theinitial_state/1
function of the problem module.:depth_limit
: Optional limit on the depth of the search.
Examples
iex> opts = [args: [size: 8]]
iex> {:ok, solution} = Backfish.find_first_solution(Backfish.Examples.NQueens, opts)
{:ok, solution}