Picat The Planner Module 3 — Questions and Answers
Question 1: What type constraint applies to the Cost argument in `action(State, NextState, Action, Cost)`?
- It must be a non-negative number (Correct answer)
- It must be a positive integer only
- It must be a floating-point value
- It can be any Picat term
Correct 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.
Question 2: What happens when `plan/2` cannot find any plan from the given initial state?
- The call fails (Correct answer)
- It returns an empty list
- It throws an exception
- It enters an infinite loop
Correct answer: The call fails
Like most Picat predicates, `plan/2` simply fails (backtracks) when no plan exists rather than throwing an error.
Question 3: Which predicate finds a cost-optimal plan in Picat's planner module?
- best_plan/2 (Correct answer)
- plan/2
- min_plan/2
- optimal_plan/2
Correct answer: best_plan/2
`best_plan(State, Plan)` searches for the plan with the minimum total cost among all valid plans.
Question 4: How should states be represented in Picat planning problems for best performance?
- As ground (fully instantiated) terms (Correct answer)
- As free logic variables
- As strings
- As integer indices into a global table
Correct answer: As ground (fully instantiated) terms
Ground terms allow the planner to efficiently hash and detect previously visited states, preventing redundant exploration.
Question 5: What does `plan_unbounded/2` do differently from `plan/2`?
- It searches without any cost bound, potentially exploring all reachable states (Correct answer)
- It returns all possible plans instead of just one
- It runs on a separate thread
- It uses breadth-first search exclusively
Correct 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.
Question 6: What is the fourth argument unified by `best_plan/4`?
- The total cost of the optimal plan (Correct answer)
- The length of the plan
- The final state reached
- The number of states explored
Correct 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.
Question 7: If `action/4` has multiple clauses for the same initial state, what does each clause represent?
- A different available action (transition) from that state (Correct answer)
- An alternative representation of the same action
- An error handler for failed transitions
- A priority ordering of moves
Correct 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.
What type constraint applies to the Cost argument in `action(State, NextState, Action, Cost)`?