<astar> ( neighbors cost heuristic -- astar )

Path finding using the A* algorithm

Path finding using the A* algorithm

Next: | <bfs> ( neighbors -- astar ) |

Vocabulary

path-finding

Inputs

Outputs

Word description

Build an astar object from the given quotations. The neighbors one builds the list of neighbors. The cost and heuristic ones represent respectively the cost for transitioning from a node to one of its neighbor, and the underestimated cost for going from a node to the target. This solution may not be as efficient as subclassing the astar tuple.

See also

<bfs>, <dijkstra>

Definition

path-finding

Inputs

neighbors | a quotation with stack effect ( node -- seq ) |

cost | a quotation with stack effect ( from to -- cost ) |

heuristic | a quotation with stack effect ( pos target -- cost ) |

Outputs

astar | an astar |

Word description

Build an astar object from the given quotations. The neighbors one builds the list of neighbors. The cost and heuristic ones represent respectively the cost for transitioning from a node to one of its neighbor, and the underestimated cost for going from a node to the target. This solution may not be as efficient as subclassing the astar tuple.

See also

<bfs>, <dijkstra>

Definition

: <astar> ( neighbors cost heuristic -- astar )

astar-simple new swap >>heuristic swap >>cost

swap >>neighbors ;

astar-simple new swap >>heuristic swap >>cost

swap >>neighbors ;

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.100 x86.64 (2240, heads/master-b90c89f82e, Sep 26 2023 19:59:25)