AStarGoapPlanner

Implements a Goal-Oriented Action Planning system using the A* algorithm. A* works by finding the optimal sequence of actions to transform an initial state into a goal state while minimizing total cost. See https://en.wikipedia.org/wiki/A*_search_algorithm

The algorithm works as follows:

  1. Start with the initial world state

  2. Maintain an open list (priority queue) of states to explore, prioritized by f-score

  3. For each state, explore all achievable actions, calculating:

    • g-score: The cost accumulated so far to reach this state

    • h-score: A heuristic estimate of the remaining cost to reach the goal

    • f-score: g-score + h-score (total estimated cost)

  4. Always expand the state with the lowest f-score first

  5. Track visited states and their best known costs to avoid cycles and redundant exploration

  6. Continue until finding a state that satisfies the goal conditions

The implementation ensures finding the optimal (lowest cost) sequence of actions by properly tracking path costs and using an admissible heuristic function.

Constructors

Link copied to clipboard
constructor(worldStateDeterminer: WorldStateDeterminer)

Properties

Functions

Link copied to clipboard

Return the best plan to any goal

Link copied to clipboard

Return the best plan to each goal from the present world state. The plans (one for each goal) are sorted by net value, descending.

Link copied to clipboard
override fun planToGoal(actions: Collection<Action>, goal: Goal): GoapPlan?

Plan from here to the given goal

Link copied to clipboard
open override fun prune(planningSystem: GoapPlanningSystem): GoapPlanningSystem

Return a PlanningSystem that excludes all actions that cannot help achieve one of the goals from the present world state.

Link copied to clipboard
open override fun worldState(): GoapWorldState

Current world state