langgoap.AnytimePlanningStrategy#
- class AnytimePlanningStrategy(time_budget_ms, *, inner=None)[source]#
Return the best plan found within a wall-clock time budget.
With the default inner strategy (A*) the deadline is enforced natively:
langgoap.planner.astar.plan()runs weighted A* with a tightening weight schedule, so a complete plan exists early and is improved while the budget lasts, and the best complete plan found so far is returned on expiry (seelanggoap.planner.astar.ANYTIME_WEIGHTS).Any other
innerstrategy is a black box: it runs in a worker thread and, when it exceeds the budget, this strategy returnsNoneimmediately with aRuntimeWarning. Python cannot interrupt a running thread, so the inner strategy keeps running in the background until it finishes on its own; prefer strategies that accept a budget themselves (AStarStrategy(time_budget_ms=...),MCTSStrategyiteration limits) when the planning problem is large.- Parameters:
time_budget_ms (float) – Wall-clock budget in milliseconds.
inner (PlanningStrategy | None) – Strategy to wrap.
None(default) or anAStarStrategyuses the native anytime A* path.
- __init__(time_budget_ms, *, inner=None)[source]#
- Parameters:
time_budget_ms (float)
inner (PlanningStrategy | None)
- Return type:
None
Methods
__init__(time_budget_ms, *[, inner])plan(start, goal, actions, *[, ...])