The Planner Module Flashcards
7 cards from real Picat practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 The Planner Module flashcards as text
What type constraint applies to the Cost argument in `action(State, NextState, Action, Cost)`?
Answer: It must be a non-negative number
Cost must be a non-negative numeric value; negative costs are not supported and would prevent the planner from terminating.
What happens when `plan/2` cannot find any plan from the given initial state?
Answer: The call fails
Like most Picat predicates, `plan/2` simply fails (backtracks) when no plan exists rather than throwing an error.
Which predicate finds a cost-optimal plan in Picat's planner module?
Answer: best_plan/2
`best_plan(State, Plan)` searches for the plan with the minimum total cost among all valid plans.
How should states be represented in Picat planning problems for best performance?
Answer: As ground (fully instantiated) terms
Ground terms allow the planner to efficiently hash and detect previously visited states, preventing redundant exploration.
What does `plan_unbounded/2` do differently from `plan/2`?
Answer: It searches without any cost bound, potentially exploring all reachable states
`plan_unbounded/2` imposes no upper cost limit on the search, whereas `plan/2` uses iterative deepening with increasing cost bounds.
What is the fourth argument unified by `best_plan/4`?
Answer: The total cost of the optimal plan
`best_plan(State, Limit, Plan, Cost)` unifies Cost with the accumulated cost of all actions in the returned optimal plan.
If `action/4` has multiple clauses for the same initial state, what does each clause represent?
Answer: A different available action (transition) from that state
Each clause of `action/4` that succeeds for a given State represents a distinct action the planner can choose, enabling branching search.