COMP338 · Tutorial 1

Tutorial 1: Problem Formulation & Uninformed Search

Quiz #1 of 2025/26 (Second Semester) and previous midterm questions · solve and submit online
Back to COMP338

How this tutorial works

  1. Solve on paper first, then type each answer in its box. Your answers are saved in this browser as you type, so you can leave and come back.
  2. Press Check my answers to test the search answers (orders, paths, costs). Checking needs an internet connection. A wrong answer gets a hint, not the solution, so you can try again.
  3. Press Submit to send your answers to the instructor. You may submit more than once; the latest submission counts.
  4. Model answers unlock after you submit with at least 20 of the 26 answers filled in. Compare them with your own, part by part.

Conventions (Jarrar, Ch.3 Uninformed Search): children are expanded in alphabetical order (ascending order for numbered nodes), and the goal test is applied when a node is removed for expansion, not when it is first generated. Type a sequence of nodes as S, A, C, G; type a cost as one number.

Part A
Quiz #1, 2025/26 Second Semester (Section 3)
Part B
Previous midterm questions on the same material
Covers
Problem formulation, BFS, DFS, UCS
Suggested time
Part A 30 min · Part B 30 min
Part A

Quiz #1 · 2025/26, Second Semester

The quiz as it appeared on the paper (Section 3, 100 marks). Q1 is a written answer marked by the instructor; Q2 is checked automatically.

Q1
Problem formulation for Map Colouring
[ 40 marks ]
Write the problem formulation for the Map Colouring problem. The objective is to assign one colour from the set {Red, Blue, Green} to each region of the map below, so that no two regions sharing a border have the same colour. Figure (a) shows the uncoloured map with five regions A, B, C, D, E; Figure (b) shows one valid 3-colouring. Specify the five components: State Space, Initial State, Actions / Transition Model, Goal Test, and Path Cost.
AB CDE
(a) uncoloured
A · RB · B C · BD · RE · G
(b) one valid 3-colouring

Adjacency (shared border): A–B, A–C, B–D, B–E, C–D, D–E. The pairs A–D and B–C touch only at a corner, so they are not adjacent.

State Space
8 pts
Written
Say what one state looks like, then what the whole set of states is.
Initial State
8 pts
Written
Actions / Transition Model
8 pts
Written
Two things are needed: which actions are available in a state, and the state each action leads to.
Goal Test
8 pts
Written
A goal test is a condition you can check on a state. It is not a restatement of the task.
Path Cost
8 pts
Written
Q2
Search on a weighted graph
[ 60 marks ]
For the graph below, the start node is S and the goal is G. Assume the order of expansion is alphabetical.
2 5 3 1 5 4 2 1 SAC DBEG

Edges (undirected): S–A 2, S–B 5, A–C 3, A–D 1, C–G 5, D–G 4, B–E 2, E–G 1.

Q2.a · Search tree
15 pts
Checked
Draw the search tree generated when expanding nodes from S. Draw it on paper, then type each branch of your tree from the root to a leaf, one branch per line, leftmost branch first.
Example of the format (not the answer): a tree with root S whose leaves are X and Y is typed as two lines, S, A, X and S, B, Y.
Q2.b · Depth-First Search
15 pts
Checked
Give the order in which nodes are expanded and the path returned to the goal.
Q2.c · Uniform-Cost Search
30 pts
Checked
Give the order of expansion, the path to the goal, and the total path cost.
Keep a table on paper: the node you expand with its g, and the frontier afterwards with each node's g.
Part B

Previous midterm questions

Questions from a previous COMP338 midterm on the same material: problem formulation and uninformed search.

Q3
Problem formulation: garment cut optimisation
[ Previous midterm ]
Consider garment cut optimisation in the textile industry. The fabric enters the assembly line as large rolls, and a laser beam cuts the garment pieces out of the roll. The arrangement of the pieces decides how much raw fabric is used to make the same amount of product: the figure shows two layouts of the same ten pieces with very different fabric consumption. To simplify the problem, assume the pieces are either circles or squares, of different sizes.
Used fabric Layout 1 Used fabric Layout 2
Discuss the problem formulation for this problem. Give the same five components as in Q1.
Your formulation
Written
Start from Q1: what plays the role of a "region", and what plays the role of a "colour"? Then ask what makes one solution better than another here; that belongs in the path cost.
Q4
Uniform-Cost Search and cycles
[ Previous midterm ]
Multiple choice
Checked
Why doesn't UCS get stuck in cyclic paths?
Q5
Search on a directed weighted graph
[ Previous midterm ]
Consider the graph below. The start node is 0 and the goal node is 7. Nodes are expanded in ascending order of node number. The edges are directed: follow the arrows only.
573115445221 01345267

Edges (directed): 0→1 5, 0→2 7, 1→3 1, 2→1 3, 2→4 5, 2→6 4, 3→4 1, 4→5 4, 4→6 5, 5→7 1, 6→5 2, 6→7 2.

The original question also asked for A* and Greedy Best-First Search, using a table of heuristic values. Those two belong to informed search and are left for the next tutorial.

Q5.a · Breadth-First Search
Checked
BFS uses a FIFO queue and ignores the edge weights when choosing what to expand. The cost of the path it returns is still the sum of its weights.
Q5.b · Depth-First Search
Checked
Q5.c · Uniform-Cost Search
Checked
There are two ties in g. Break each one by node number.

 Check and submit

Submitting as ….

Checking marks each search answer as right or wrong, all or nothing. The instructor reads your working and your written answers separately and can give partial credit.