Filtered Important Questions & Answers
Course - Fundamentals of AI
Coverage - Unit 3 & Unit 4 Filtered Cycle Test Preparation
Question 1: Autonomous Hospital Transport Robot (Agents & PEAS)
Question Statement
A hospital uses an autonomous robot to transport medical supplies through crowded corridors. The robot must respond to moving people, obstacles, and changing floor conditions.
(a) Draw and explain the architecture of a simple reflex agent and a goal-based agent. Give one situation in which each would be suitable for the robot.
(b) Write the PEAS description for this robot.
(c) Classify the task environment as fully/partially observable, deterministic/stochastic, episodic/sequential, static/dynamic, discrete/continuous, and single-agent/multi-agent. Justify each classification.
Model Answer
(a) Agent Architectures & Situational Choice
1. Simple Reflex Agent
- Architecture: Selects actions based solely on the current percept, ignoring history and future consequences.
- Suitable Situation: Emergency obstacle avoidance (e.g., stopping immediately when proximity bumpers detect a sudden obstacle directly ahead).
2. Goal-Based Agent
- Architecture: Combines current state estimation with explicit goal descriptions to evaluate and plan action sequences that reach the goal.
- Suitable Situation: Route planning across multiple wards and floors (e.g., calculating the shortest path from the pharmacy to Ward 4B while scheduling elevator transfers).
(b) PEAS Description
| Component | Specification |
|---|---|
| Performance Measure | On-time delivery rate, zero collisions with pedestrians/obstacles, sample integrity, minimal transit time, battery efficiency. |
| Environment | Corridors, wards, elevators, pharmacy, moving staff, patients, wheelchairs, beds. |
| Actuators | Motorized wheels/drive motors, steering mechanism, compartment lock/unlock, status display screen, speaker, elevator radio transmitter. |
| Sensors | LiDAR, RGB-D cameras, ultrasonic bumper sensors, wheel encoders, Wi-Fi/RFID receiver. |
(c) Task Environment Classification
| Dimension | Classification | Justification |
|---|---|---|
| Observable | Partially Observable | Sensors cannot see through walls, around corners, or inside closed elevator shafts. |
| Deterministic | Stochastic | Pedestrian movements, door closures, and elevator wait times are unpredictable. |
| Episodic | Sequential | Current routing actions directly determine future locations, deadlines, and battery level. |
| Static | Dynamic | Humans and carts move while the robot deliberates its next action. |
| Discrete | Continuous | Robot position coordinates, steering angles, velocity, and time vary continuously. |
| Single / Multi-agent | Multi-Agent | Operates alongside moving humans, doctors, and other automated hospital devices. |
Question 2: Search Tree Tracing (BFS, DFS & DLS)
Question Statement
Consider the following search tree. Children are generated from left to right:
- S: A, B, C
- A: D, E
- B: F, G
- C: H
- D: I
- F: J
- G: K (goal)
(a) Trace Breadth-First Search and Depth-First Search until the goal is found. Show the queue or stack after each expansion.
(b) Apply Depth-Limited Search with limit 2. Does it find the goal? Explain and state the minimum depth limit required.
(c) Compare BFS and DFS in terms of completeness, optimality, time complexity, and space complexity. Which is more appropriate when memory is limited?
Model Answer
(a) Search Traces until Goal () Found
1. Breadth-First Search (Queue: FIFO)
Nodes are appended to the rear and popped from the front.
| Step | Node Expanded | Children Generated | Queue Contents after Expansion |
|---|---|---|---|
| 0 | — | Start | |
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | None | ||
| 7 | |||
| 8 | (Goal) | ||
| 9 | None | ||
| 10 | None | ||
| 11 | None | ||
| 12 | Goal reached on expansion | — |
- Path Found:
2. Depth-First Search (Stack: LIFO)
Children are pushed right-to-left so that the leftmost child sits at the top of the stack.
| Step | Node Expanded | Children Pushed | Stack Contents after Expansion [Top Bottom] |
|---|---|---|---|
| 0 | — | Start | |
| 1 | |||
| 2 | |||
| 3 | |||
| 4 | None (Leaf) | ||
| 5 | None (Leaf) | ||
| 6 | |||
| 7 | |||
| 8 | None (Leaf) | ||
| 9 | (Goal) | ||
| 10 | Goal reached on expansion | — |
- Path Found:
(b) Depth-Limited Search (Limit = 2)
- Depth Levels:
- Depth 0:
- Depth 1:
- Depth 2:
- Depth 3:
- Does it find the goal? No.
- Explanation: Goal node is at depth 3 (). DLS with limit stops search at depth 2 and prunes all nodes at depth . Node at depth 2 is reached, but its child at depth 3 is never explored.
- Minimum Depth Limit Required: Limit = 3.
(c) Comparison between BFS and DFS
| Metric | Breadth-First Search (BFS) | Depth-First Search (DFS) |
|---|---|---|
| Completeness | Complete (if branching factor is finite). | Incomplete in infinite spaces/cycles (Complete here since tree is finite). |
| Optimality | Optimal (guarantees shallowest path). | Non-optimal (returns first path found regardless of depth). |
| Time Complexity | (where is maximum tree depth). | |
| Space Complexity | (Exponential memory). | (Linear memory). |
- Memory-Limited Preference: DFS is more appropriate because its linear space complexity () stores only the active path and unexpanded siblings, avoiding exponential memory exhaustion.
Question 3: Cryptarithmetic Puzzle as a CSP (BASE + BALL = GAMES)
Question Statement
Solve the cryptarithmetic puzzle below. Each letter represents a different digit, and leading letters cannot be zero:
BASE
+ BALL
------
GAMES
Formulate it as a constraint satisfaction problem by specifying variables, domains, carry variables, and constraints. Find a valid assignment and verify the arithmetic.
Model Answer
1. CSP Formulation
- Variables:
- Domains:
- (leading digits ).
- .
- Carry Variables: (for column additions).
- Global Constraint:
- Column Constraints (Right to Left):
- Units:
- Tens:
- Hundreds:
- Thousands:
- Ten-Thousands:
2. Step-by-Step Deduction
- Ten-Thousands Column ():
- The sum of two 4-digit numbers produces at most carry .
- Since and .
- Units and Tens Columns ( and Carries):
- Units:
- Tens:
- Adding both equations:
- If . If , making , which violates .
- Therefore .
- If . Then Units gives . Substituting into Tens yields (contradiction).
- Therefore .
- Substituting : .
- Relating and :
- With and : .
- Hundreds and Thousands Columns:
- Hundreds: .
- Thousands: (since ).
- Since .
- Available digits for from :
- If :
- Hundreds: and .
- Thousands: .
- If :
- Solving and :
- Digits assigned so far: .
- Remaining unused digits: .
- Condition with unused digits:
- Setting yields (both valid and unused).
3. Final Valid Assignment & Verification
- Distinct Digits Check: are all unique
- Leading Non-Zero Check:
- Arithmetic Verification:
Question 4: Game Tree Minimax & Alpha-Beta Pruning
Question Statement
In a game tree, the root P is a MAX node; its children Q and R are MIN nodes. Q has MAX children S and T, while R has MAX children U and V. The leaf values from left to right are:
- S: 4, 7
- T: 2, 8
- U: 5, 6
- V: 1, 3
(a) Apply minimax and calculate the backed-up value at every internal node.
(b) Identify the move selected by MAX at the root.
(c) Apply alpha-beta pruning from left to right, showing alpha and beta values and identifying any pruned leaves or subtrees.
(d) Explain how ordering the children can affect alpha-beta pruning and state its best-case time complexity.
Model Answer
(a) Minimax Backed-Up Values
- Level 3: MAX Nodes ()
- Level 2: MIN Nodes ()
- Level 1: Root MAX Node ()
(b) Move Selected by MAX at Root
- MAX chooses the move to (guaranteed minimax value of ).
(c) Alpha-Beta Pruning Trace (Left to Right)
Root bounds begin at .
- Subtree under (MIN node, ):
- Node (MAX):
- Leaf : .
- Leaf : .
- Returns .
- At MIN node : . Current bounds: .
- Node (MAX, ):
- Leaf : .
- Leaf : . Pruning condition () holds, but leaf is already the last child of .
- Returns .
- At MIN node : . Returns to root .
- Node (MAX):
- At Root (MAX):
- Updates .
- Bounds at Root : .
- Subtree under (MIN node, ):
- Node (MAX):
- Leaf : .
- Leaf : .
- Returns .
- At MIN node :
- Updates .
- Pruning condition triggered: ().
- The remaining branch under is cut off.
- Pruned Leaves/Subtrees: Node and its leaves and are PRUNED.
- Node (MAX):
- Summary:
- Evaluated Leaves: (6 of 8 evaluated).
- Pruned Leaves: (Subtree ).
(d) Move Ordering & Best-Case Complexity
- Effect of Move Ordering:
- Optimal Ordering: If the best moves are considered first, alpha-beta maximizes early cutoffs, pruning large subtrees.
- Worst Ordering: If moves are sorted from worst to best, no cutoffs occur, and search complexity degrades to full minimax ().
- Best-Case Time Complexity: (allows searching twice as deep within the same computational time limit).
Question 5: Delivery Vehicle Navigation (Greedy Best-First & A* Search)
Question Statement
A delivery vehicle must travel from start node S to destination G. The edge costs are: S-A = 3, S-B = 4, A-C = 2, A-D = 5, B-E = 2, E-G = 4, C-G = 4, D-G = 2. The heuristic values are h(S)=7, h(A)=5, h(B)=4, h(C)=3, h(D)=2, h(E)=2, h(G)=0.
(a) Trace Greedy Best-First Search and state the path returned and its total cost.
(b) Trace A* search, showing g(n), h(n), and f(n) for nodes considered. State the path returned and its total cost.
(c) If h(D) is changed to 8, discuss whether the heuristic remains admissible and explain the possible effect on A* search.
Model Answer
(a) Greedy Best-First Search Trace
Greedy BFS selects the node with the lowest heuristic value .
| Step | Node Popped | Successors Generated | Priority Queue | |
|---|---|---|---|---|
| 0 | — | — | Start | |
| 1 | 7 | |||
| 2 | 4 | |||
| 3 | 2 | |||
| 4 | 0 | Goal reached on expansion | — |
- Path Returned:
- Total Cost:
(b) A* Search Trace
Nodes are prioritized by .
| Step | Node Popped | Successors Generated | Open List | |||
|---|---|---|---|---|---|---|
| 0 | — | — | — | — | Start | |
| 1 | 0 | 7 | 7 | |||
| 2 | 3 | 5 | 8 | |||
| 3 | 4 | 4 | 8 | |||
| 4 | 5 | 3 | 8 | |||
| 5 | 6 | 2 | 8 | |||
| 6 | 9 | 0 | 9 | Goal popped on expansion | — |
- Path Returned:
- Total Cost:
(c) Admissibility & Effect if
- Admissibility Analysis:
- True minimal cost from to : .
- Admissibility requires for all nodes.
- Because , the heuristic overestimates true cost and becomes INADMISSIBLE.
- Effect on A* Search:
- With , the estimated total cost becomes .
- This artificially penalizes node , delaying its expansion in the priority queue.
- In this specific graph, the optimal path runs through (cost 9), so A* still finds the optimal path .
- However, in general, an inadmissible heuristic forfeits A*'s guarantee of optimality, as it can cause an optimal path through an overestimated node to be skipped in favor of a suboptimal alternative.
Question 6: Map Colouring with Forward Checking & Heuristics
Question Statement
A map contains the regions WA, NT, SA, Q, NSW, V, and T. Adjacent pairs are:
WA-NT, WA-SA, NT-SA, NT-Q, SA-Q, SA-NSW, SA-V, Q-NSW, NSW-V.
Tasmania (T) has no neighbours.
Use the colours {Yellow, Blue, Green}.
(a) Draw the constraint graph and identify the variables, domains, and constraints.
(b) Assign WA = Yellow and Q = Blue. Show the remaining domains after each assignment using forward checking.
(c) Explain how a domain becoming empty indicates failure.
(d) Use the Minimum Remaining Values and degree heuristics to choose a variable order and give one valid colouring.
Model Answer
(a) Constraint Graph & CSP Formulation
- Variables ():
- Domains (): for every variable.
- Constraints (): for all adjacent pairs : (Tasmania has no constraints).
(b) Forward Checking Trace
Colours: Yellow (Y), Blue (B), Green (G)
| Step | Assignment | Forward Checking Action | |||||||
|---|---|---|---|---|---|---|---|---|---|
| 0 | Initial | All domains complete. | |||||||
| 1 | Remove from neighbors . | ||||||||
| 2 | Remove from neighbors . |
(c) Why an Empty Domain Indicates Failure
- If forward checking reduces any unassigned variable's domain to empty (), no legal colour remains that satisfies constraints with the current assignments.
- This proves immediately that the current partial assignment cannot lead to a valid full solution, signaling a dead-end and triggering an immediate backtrack without exploring doomed child branches.
(d) Heuristics Variable Ordering & Valid Colouring
1. Heuristic Selection Order
- Degree Heuristic (Initial Tie-Breaker):
- Counts constraints on unassigned variables: , , , , , , .
- Pick first (highest degree 5) Assign .
- Minimum Remaining Values (MRV):
- Neighbors of now have domain size 2 ().
- Pick tied MRV variables by degree: pick , assign .
- Now reduces to (singleton, MRV forces with 0 branching).
- Remaining variables are assigned similarly using MRV.
2. One Valid Colouring
- Validation: Every adjacent pair has different colours; Tasmania () is unconstrained.