The searches of state-space.core as lazy streams of events.
Each function takes the arguments and options of the search with the same name and returns what that search does, step by step, instead of its visits. Every event is a map with an :event key:
{:event :start :visit v :accepted? true} A starting state was considered.
{:event :edge :from parent :transition t :visit v :accepted? true} A transition from an entered visit was considered. :transition is the decoded transition and :visit the candidate it leads to.
{:event :enter :visit v} A visit was accepted for exploration. The :enter events are exactly the visits dfs, bfs, and best-first return, in the same order.
{:event :exit :visit v} Depth-first only: everything below a visit has been explored. The :exit events are exactly the visits postorder returns, with their fold :value.
A candidate that will not be explored has :accepted? false and a :reason:
:on-path its key occurs on the route to it, so accepting it would close a cycle. Reported by every search under :dedupe :path, and by depth-first traces also under :dedupe :search, where the route is the chain of visits still being explored. :already-visited its key was entered before, and is not known to be on that route :not-better best-first already holds a pending visit of its key with an equal or better priority
In dfs, postorder, and bfs an accepted candidate is entered at once. In best-first it waits in the queue: it is entered when selected, unless a later candidate with a better priority takes its place. That later :edge event carries the visit it displaced under :replaced.
Events are produced as lazily as the visits themselves. The visits inside them are ordinary visit maps: those of :start and :edge events are candidates, some of which a search never returns. Events describe what happened; they are not hooks, and a partially consumed trace can hold an :enter without its :exit.
The searches of state-space.core as lazy streams of events.
Each function takes the arguments and options of the search with the same
name and returns what that search does, step by step, instead of its
visits. Every event is a map with an :event key:
{:event :start :visit v :accepted? true}
A starting state was considered.
{:event :edge :from parent :transition t :visit v :accepted? true}
A transition from an entered visit was considered. :transition is the
decoded transition and :visit the candidate it leads to.
{:event :enter :visit v}
A visit was accepted for exploration. The :enter events are exactly
the visits dfs, bfs, and best-first return, in the same order.
{:event :exit :visit v}
Depth-first only: everything below a visit has been explored. The
:exit events are exactly the visits postorder returns, with their
fold :value.
A candidate that will not be explored has :accepted? false and a :reason:
:on-path its key occurs on the route to it, so accepting it
would close a cycle. Reported by every search under
:dedupe :path, and by depth-first traces also under
:dedupe :search, where the route is the chain of
visits still being explored.
:already-visited its key was entered before, and is not known to be on
that route
:not-better best-first already holds a pending visit of its key
with an equal or better priority
In dfs, postorder, and bfs an accepted candidate is entered at once. In
best-first it waits in the queue: it is entered when selected, unless a
later candidate with a better priority takes its place. That later :edge
event carries the visit it displaced under :replaced.
Events are produced as lazily as the visits themselves. The visits inside
them are ordinary visit maps: those of :start and :edge events are
candidates, some of which a search never returns. Events describe what
happened; they are not hooks, and a partially consumed trace can hold an
:enter without its :exit.(best-first space starts)(best-first space starts options)Traces state-space.core/best-first: :start and :edge decisions as candidates are queued, and an :enter event for each visit as it is selected. See the namespace documentation for the events.
Traces state-space.core/best-first: :start and :edge decisions as candidates are queued, and an :enter event for each visit as it is selected. See the namespace documentation for the events.
(bfs space starts)(bfs space starts options)Traces state-space.core/bfs: :start and :edge decisions with an :enter event for each visit, in breadth-first order. See the namespace documentation for the events.
Traces state-space.core/bfs: :start and :edge decisions with an :enter event for each visit, in breadth-first order. See the namespace documentation for the events.
(dfs space starts)(dfs space starts options)Traces state-space.core/dfs: :start and :edge decisions with :enter and :exit events for each visit, in depth-first order. See the namespace documentation for the events.
Traces state-space.core/dfs: :start and :edge decisions with :enter and :exit events for each visit, in depth-first order. See the namespace documentation for the events.
(postorder space starts)(postorder space starts options)Traces state-space.core/postorder. The events are those of dfs; with a :fold, each :exit visit carries its :value. See the namespace documentation for the events.
Traces state-space.core/postorder. The events are those of dfs; with a :fold, each :exit visit carries its :value. See the namespace documentation for the events.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |