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
When would you choose `best_plan` over `plan` in a Picat program?
Answer: When you need the minimum-cost solution, not just any valid solution
`best_plan` exhausts the search to guarantee cost optimality, while `plan` returns the first solution it finds which may not be cheapest.
In what form does the Plan variable appear after a successful call to `plan/2`?
Answer: A Picat list of action terms, e.g., [Action1, Action2, ...]
The Plan is unified with a standard Picat list where each element is the Action term from the corresponding `action/4` call.
What is printed when you call `writeln(Plan)` after `plan(InitState, Plan)` succeeds with a three-step plan?
Answer: A list with three elements, one per action
Plan is a list of action terms, so `writeln` outputs something like `[action1,action2,action3]` with one element per step.
If the initial state already satisfies `final/1`, what does `plan/2` return?
Answer: An empty list, since no actions are needed
When the start state is already a goal state, `plan/2` succeeds immediately with Plan = [], reflecting that zero actions are required.
Which statement best describes how `plan/3` and `plan/4` differ?
Answer: plan/4 also unifies a variable with the total plan cost; plan/3 does not
`plan(State, Limit, Plan, Cost)` adds a fourth argument that is unified with the total accumulated cost of the returned plan.
What is the effect of giving an overly tight Limit value in `plan/3`?
Answer: plan/3 fails even though a valid plan exists beyond the limit
If every valid plan costs more than Limit, `plan/3` fails because no solution satisfies the bound — it does not relax the limit automatically.
Which of the following is the correct way to test a Picat planning module with a simple two-state problem?
Answer: Define action/4 for the one transition and final/1 for the goal, then call plan/2
A minimal planning problem needs at least one `action/4` clause defining the transition and a `final/1` clause defining the goal, then `plan/2` is called.