VNUHCM-UNIVERSITY OF SCIENCE Archive code
(written by ET&QA
MIDTERM EXAMINATION Office)
Semester I – Academic year 2024-2025
Course name: Artificial Intelligence 22TT1 Course code: CS420
Time: 75 minutes Date: 05/11/2024
Note: Students are allowed to use one A4 SHEETS of materials and calculators.
Full name of student: ….......................................................Student ID: …………..… No: …...
Q1. (1pt) The below implementation of graph search A* may be incorrect. Note that the fringe is a priority
queue, with nodes inserted using the standard A* key: 𝑓 = 𝑔 + ℎ, where ℎ is a consistent heuristic.
This is a question to check your logical thinking, the algorithm mentioned here is not what you studied.
N
O
TI
LU
SO
M
R
TE
In the list below, choose a problem that the bugs may cause during execution and justify your answer.
ID
The GetSuccessors function could be called multiple times on the same state.
M
The algorithm is no longer complete.
The algorithm could return a suboptimal solution.
The implementation is incorrect, but none of the above problems will be caused.
The implementation is correct.
Explanation: The bug is the insertion of successor into closed at time of insertion of a node into the
fringe, rather than at the time that node gets popped from the fringe. As a consequence of this bug, the
first path encountered to a state will put that state in the closed list. This can cause suboptimality as we
only have the guarantee that a state has been reached optimally once a node reaching it gets popped
off the fringe.
(This question paper includes 5 pages)
Full name of paper setter/staff code: ................................................ Signature: ………[page 1/5]
Full name of approver: ..................................................................... Signature: ................
VNUHCM-UNIVERSITY OF SCIENCE Archive code
(written by ET&QA
MIDTERM EXAMINATION Office)
Semester I – Academic year 2024-2025
Q2. (1pt) Consider an admissible heuristic ℎ of nonnegative real values. Is h2 admissible? Explain.
NO. Counter example: h = 2, h* = 3 → h2 = 4 > h*. There exists a value that violates inequality h<= h*.
Therefore, h2 is inadmissible.
Q3. (2pts) Your sister Mia has a big celebration coming up, and she has been promised a special cake.
However, Mia has been sneaking treats lately, so your mom thinks she should get the simplest cake.
Mia, of course, wants the most elaborate and expensive cake available. Mom will pick the bakery, Mia
will choose the cake flavor, and you will get to pick the cake itself. You do not want to take sides so
you decide to pick a cake at random. All prices (including X and Y) are assumed to be nonnegative.
N
O
TI
LU
SO
a) (0.5pt) Note on the figure the values of all the nodes that do not depend on X or Y.
M
b) (0.5pt) What values of X will make Mom pick ABC Bakery regardless of the price of Y?
R
X > 84. Mom pick ABC Bakery when Paris Baguette leads to the max node that is larger than 40. Since
TE
Mille-Feuille leads to 30, Black Forest must lead to a value that is larger than 40, i.e., (X+Y+36)/3 > 40.
We set Y = 0 to reflect the fact that “regardless of the price of Y”. Thus, (X+36)/3 > 40 -> X > 84.
ID
c) (0.5pt) We know that Y is at most $30. What values of X will result in a Mille-Feuille cake regardless
of the exact price of Y?
M
X < 24. Mille-Feuille can be achieved when Black Forest leads to a node that is smaller than 30. That is,
(X+Y+36)/3 < 30. We set Y = 30 to consider the worst case when Y is at most 30. Thus, X < 24.
d) (0.5pt) With certain additional information, alpha-beta pruning can be applied to expectimax. Which
of the following conditions must a problem meet to enable pruning with expectimax?
The children of the expectation node are leaves.
All values are positive.
The children of the expectation node have specified ranges.
The child to prune is last.
Q4. (1pt) Consider the following game tree, where each node is labeled with a pair of numbers, 𝑄/𝑁,
where 𝑄 represents the node's value and 𝑁 denotes the number of visits to that node.
(This question paper includes 5 pages)
Full name of paper setter/staff code: ................................................ Signature: ………[page 2/5]
Full name of approver: ..................................................................... Signature: ................
VNUHCM-UNIVERSITY OF SCIENCE Archive code
(written by ET&QA
MIDTERM EXAMINATION Office)
Semester I – Academic year 2024-2025
N
O
TI
Assume that the selection step of MCTS uses the Upper Confidence Bound for trees (UCT) to
LU
recursively evaluate nodes from the root down to the most urgent expandable node.
where 𝑄(𝑣𝑖 ) is the total reward at node 𝑣𝑖 , 𝑁(𝑣)
SO
𝑄(𝑣𝑖 ) 𝑙𝑛(𝑁(𝑣))
𝕌ℂ𝕋(𝑣𝑖 , 𝑣) = + 𝐶√ and 𝑁(𝑣𝑖 ) are the number of visits at the parent
𝑁(𝑣𝑖 ) 𝑁(𝑣𝑖 )
node 𝑣 and the current node 𝑣𝑖 , respectively.
Calculate the UCT value (with 𝐶 = 2) for each node evaluated during this step and write the values
M
next to the corresponding nodes.
R
Q5. (1pt) You have a problem with a very high branching factor, so you cannot run A* on it. Instead, you
TE
use a beam search algorithm. For every node, you insert in the queue only the 𝑘 best successors,
according to 𝑓 = 𝑔 + ℎ. Here, 𝑘 is a fixed parameter that you set based on your memory requirements
(e.g., 𝑘 = 2). If the heuristic is admissible, this algorithm is guaranteed to find the optimal solution.
ID
Is the given statement TRUE or FALSE? Justify your answer.
M
FALSE. An optimal solution may require returning to some steps earlier during exploration while local
search can only move forward. Note that even with a consistent heuristic, we still need to update the
nodes while they are still in the frontier; however, local beam search does not track nodes from
previous iteration.
Q6. (2pts) We have five planes: A, B, C, D, and E and two runways: international and domestic. We
would like to schedule a time slot and runway for each aircraft to either land or take off. We have four
time slots: {1, 2, 3, 4} for each runway, during which we can schedule a landing or take off of a plane.
We must find an assignment that meets the following constraints:
• Plane B has lost an engine and must land in time slot 1.
• Plane D can only arrive at the airport to land during or after time slot 3.
(This question paper includes 5 pages)
Full name of paper setter/staff code: ................................................ Signature: ………[page 3/5]
Full name of approver: ..................................................................... Signature: ................
VNUHCM-UNIVERSITY OF SCIENCE Archive code
(written by ET&QA
MIDTERM EXAMINATION Office)
Semester I – Academic year 2024-2025
• Plane A is running low on fuel but can last until at most time slot 2.
• Plane D must land before plane C takes off, because some passengers must transfer from plane
D to plane C.
• No two aircrafts can reserve the same time slot for the same runway.
a) (0.5pt) Formulate this problem as a CSP in terms of variables, domains, and constraints (both unary
and binary). To express the constraints and domains clearly, you should prefer mathematical or logical
notation to words when possible.
Variables A, B, C, D, E
Initial domains for a tuple (runway type, time slot) for runway type {international, domestic}
all variables and time slot {1, 2, 3, 4}.
N
Constraints: B[1] = 1, D[1] 3, A[1] 2, D[1] < C[1]
O
x, y {A, B, C, D, E}, x[0] = y[0] → x[1] y[1]
TI
b) (0.5pt) We add the following two constraints:
LU
• Planes A, B, and C cater to international flights and can only use the international runway.
• Planes D and E cater to domestic flights and can only use the domestic runway.
SO
With the addition of the two constraints above, we completely reformulate the CSP.
You are given the variables and domains of the new formulation. Complete the constraint graph for
this problem given the original constraints and the two added ones.
M
Variables: A C
A, B, C, D, E for each plane
R
Initial Domains:
TE
{1, 2, 3, 4} for each variable B D E
Constraint graph:
ID
c) (0.5pt) Show the domains of all variables after enforcing the unary constraints.
Variables A B C D E
M
Domains 1, 2 1 1, 2, 3 ,4 3, 4 1, 2, 3, 4
d) (0.5pt) Consider the filtered domains in (c). Show the resulting domains of all variables after applying
arc consistency.
Variables A B C D E
Domains 2 1 4 3 1, 2, 4
Q7. (2pts) As a staff member at an art museum, your daily task is to guide visitors to their designated
locations where famous artworks are displayed. The museum layout is a maze-like rectangular space
(This question paper includes 5 pages)
Full name of paper setter/staff code: ................................................ Signature: ………[page 4/5]
Full name of approver: ..................................................................... Signature: ................
VNUHCM-UNIVERSITY OF SCIENCE Archive code
(written by ET&QA
MIDTERM EXAMINATION Office)
Semester I – Academic year 2024-2025
with dimensions 𝑀 × 𝑁. Due to Covid-19 protocols in winter, you must manage the space remotely.
While you have information on whether each square is accessible or blocked by walls, you can only
identify which artwork occupies a particular square once the visitor arrives there.
You guide 𝐾 visitors, locating at (x1V, y1V), (x2V, y2V),..., (xKV, yKV).
Each visitor has a specific target ending location. At each time step, all
visitors act simultaneously, and each of them moves into an adjacent
square if that square is free or he stays still, that is, (North, East, South,
West, and Stop). Two visitors may occupy the same square. The aside
figure is just for demonstration.
N
O
Formulate the given problem as a single-agent state-space and then describe the following concept.
TI
a) (0.5pt) Give an efficient state space formulation for this problem. Specify the domain of each variable
in your state space. LU
A state contains the locations of K visitors, each of which is a pair of 2D coordinates (xi, yi).
Thus, it is { (x1, y1), (x2, y2), …, (xi, yi),…, (xk, yk) }, where 0 < i K, 1 xi M, 1 yi N
SO
Note that, including the locations of targets in every state is unnecessary.
b) (0.5pt) Give an upper bound on the size of the state space. Justify your answer.
M
Each visitor can be at any square in the maze of NxM, and many visitors may occupy the same square.
R
Thus, (MN)K
TE
c) (0.5pt) Give an upper bound on the branching factor of the search problem.
Each visitor can perform one of the five actions. Thus, 5K
ID
M
d) (0.5pt) Give a non-trivial admissible heuristic for this problem. Explain why it is admissible.
There are several options. You can take the maximum / minimum value of the Manhattan distances of
every visitor to their targets as heuristic. However, the sum is not an admissible heuristic, since the K
visitors move simultaneously.
--- THE END ---
(This question paper includes 5 pages)
Full name of paper setter/staff code: ................................................ Signature: ………[page 5/5]
Full name of approver: ..................................................................... Signature: ................