AStar Goap Planner
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:
Start with the initial world state
Maintain an open list (priority queue) of states to explore, prioritized by f-score
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)
Always expand the state with the lowest f-score first
Track visited states and their best known costs to avoid cycles and redundant exploration
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.
Functions
Return the best plan to any goal
Return the best plan to each goal from the present world state. The plans (one for each goal) are sorted by net value, descending.
Plan from here to the given goal
Return a PlanningSystem that excludes all actions that cannot help achieve one of the goals from the present world state.
Current world state