langgoap.MultiGoal#
- class MultiGoal(goals, mode='sequential')[source]#
A composite goal made up of one or more
GoalSpecchildren.Two execution modes are supported:
"sequential"(default) — the observer plans and executesgoals[0]to completion, then uses the resulting world state as the starting state forgoals[1], and so on. This is the right model when sub-goals represent successive stages of a workflow (e.g. “collect data → analyse → publish”)."any"— the planner plans each sub-goal independently and the observer picks the lowest-Scorefeasible plan. Useful when several possible goals are acceptable and the system should chase the cheapest one.
Recursive (HTN-style) decomposition where a sub-goal is itself a
MultiGoalis out of scope for v0.1.0 — only flat composition is supported and__post_init__()rejects non-GoalSpecchildren with a clearValueError.In
"any"mode, ties on plan cost are broken by list order: the first sub-goal whose plan has the lowest cost wins. This makes the order ofgoalssemantically meaningful when several candidates are equally cheap.- Parameters:
- __init__(goals, mode='sequential')#
- Parameters:
goals (tuple[GoalSpec, ...])
mode (Literal['sequential', 'any', 'best_value'])
- Return type:
None
Methods
__init__(goals[, mode])Attributes
goalsmode