the-sett/ai-search/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Search

Input types for searches:

type alias Node state =
( state, Bool )

Defines the type of Nodes that searches work over.

type alias Step state =
Node state -> List (Node state)

Defines the type of the step function that produces new states from existing ones. This is how the graph over the search space is defined.

type alias Uninformed state =
{ step : Step state }

Defines the type of a bundle of operators that need to be supplied to conduct an uninformed (non-heuristic) search.

The search output type:

type SearchResult state
= Complete
| Goal state
| Ongoing state (() -> SearchResult state)

Defines the possible outcomes of a search.

The search function:

Helper functions for iterating searches to produce results:

nextGoal : SearchResult state -> SearchResult state

Continues a search result, to produce the next search goal. * The result of this function will never be an Ongoing search. This function will recursively apply the search until either a Goal state if found or the walk over the search space is Complete.