Prev: X5 Next: X7
Back to midtern page: Link, final page: Link

# X6 Past Exam Problems

📗 Enter your ID (the wisc email ID without @wisc.edu) here: and click (or hit enter key)
📗 If the questions are not generated correctly, try refresh the page using the button at the top left corner.
📗 The same ID should generate the same set of questions. Your answers are not saved when you close the browser. You could print the page: , solve the problems, then enter all your answers at the end.
📗 Please do not refresh the page: your answers will not be saved.

# Warning: please enter your ID before you start!


# Question 1


📗

# Question 2


📗

# Question 3


📗

# Question 4


📗

# Question 5


📗

# Question 6


📗

# Question 7


📗

# Question 8


📗

# Question 9


📗

# Question 10


📗

# Question 11


📗

# Question 12


📗

# Question 13


📗

# Question 14


📗

# Question 15


📗

# Question 16


📗

# Question 17


📗

# Question 18


📗

# Question 19


📗

# Question 20


📗

# Question 21


📗

# Question 22


📗

# Question 23


📗

# Question 24


📗

# Question 25


📗

# Question 26


📗

# Question 27


📗

# Question 28


📗

# Question 29


📗

# Question 30


📗

# Question 31


📗

# Question 32


📗

# Question 33


📗

# Question 34


📗

# Question 35


📗

# Question 36


📗

# Question 37


📗

# Question 38


📗

# Question 39


📗

# Question 40


📗

# Question 41


📗

# Question 42


📗

# Question 43


📗

# Question 44


📗

# Question 45


📗

# Question 46


📗

# Question 47


📗

# Question 48


📗

# Question 49


📗

# Question 50


📗

📗 [4 points] Imagine a world where each person has friends. Alice and Bob are \(d\) = "friendship links" away (i.e. if \(d\) = 1, Alice and Bob are friends; if \(d\) = 2, there is a third person X such that Alice and X are friends, and Bob and X are friends; and so on). Imagine a breadth first search (BFS) algorithm that has access to the friendship links. The algorithm starts at Alice and the goal is to find Bob. In the worst case, how many people (the same person visited multiple times are counted as multiple visits) the algorithm needs to visit (including Alice and Bob)?
📗 Answer: .
📗 [3 points] Let the search space be integers. Each state \(n\) has successors . Write down the shortest path (i.e. the sequence of states) from the initial state 1 to the goal state .
📗 Answer (comma separated vector): .
📗 [2 points] Consider a 3-puzzle where, like in the usual 8-puzzle game, a tile can only move to an adjacent empty space. Tiles cannot move diagonally. Which of the following initial states can reach the goal state (0 means "no tile")?
📗 Choices:





None of the above
📗 [3 points] Consider Iterative Deepening Search on a tree, where the nodes are denoted by numbers. Write down the sequence IDS visited in the order they are expanded (i.e. expansion path). 0 is the initial state and is the goal state. Start with depth limit 0, include the root, and include repeated nodes.
📗 Note: use the convention used in the lectures, push the rightmost (in the diagram) successor into the stack first or enqueue the leftmost (in the diagram) successor into the queue first.

📗 Answer (comma separated vector): .
📗 [2 points] Consider a search graph which is a tree, and each internal node has children. The only goal node is at depth (root is depth 0). How many total goal-checks will be performed by in the luckiest case (i.e. the smallest number of goal-checks)? If a node is checked multiple times you should count that multiple times.
📗 Answer:
📗 [2 points] Recall in uniform-cost search, each node has a path-cost from the initial node (sum of edge costs along the path), and the search expands the least path-cost node first. Consider a search graph with \(n\) = nodes: \(1, 2, ..., n\). For all \(1 \leq i < j \leq n\), there is a directed edge from \(i\) to \(j\)  with an edge cost . The initial node is 1, and the goal node is \(n\). How many (unique) goal-checks (the same nodes expanded twice is counted only once) with uniform-cost search perform? Break ties by expanding the node with the smaller index first.
📗 Answer:
📗 [2 points] Consider a search tree where the root is at depth 0, each internal node has children, and all leaves are at depth . There is a single goal state at depth . How much (in number of states including the root and the goal) is sufficient so always succeeds? Select all that applies.
📗 Choices:





None of the above
📗 Calculator: .
📗 [2 points] Consider n + 1 = + 1 states. The initial state is 1, the goal state is n. State 0 is a dead-end state with no successors. For each non-0 state i, it has two successors: i + 1 and 0. There is no cycle check nor CLOSED list (this means we may expand (or goal-check) the same nodes many times, because we do not keep track of which nodes are checked previously). How many goal-checks will be performed by Breadth First Search? Break ties by expanding the node with the smaller index first.
📗 Answer: .
📗 [4 points] Suppose the states are integers between and . The initial state is , and the goal state is . The successors of a state \(i\) are \(2 i\) and \(2 i + 1\), if exist. How many states are expanded using a Breadth First Search? Include both the initial and goal states.
📗 Note: use the convention used in the lectures, enqueue the states with smaller index into the queue first.
📗 Answer: .
📗 [4 points] Suppose the states are integers between and . The initial state is , and the goal state is . The successors of a state \(i\) are \(2 i\) and \(2 i + 1\), if exist. How many states are expanded using a Depth First Search? Include both the initial and goal states.
📗 Note: use the convention used in the lectures, push the states with larger index into the stack first (i.e. expand the states with the smaller index first).
📗 Answer: .
📗 [4 points] Suppose the state space has \(n\) = states that form a tree with root state \(0\). What is the shape of the tree that makes iterative deepening realize that a goal does not exist as quickly as possible (i.e. one that minimizes the number of expanded nodes)? Enter the number of nodes searched in this case.
📗 Answer: .
📗 [4 points] Which order of goal check is possible with , without specifying the order of successors when putting them in the queue (i.e. you can rearrange the order of the branches)? That is, if the 2 nodes in the choices can be visited in any order without violating BFS, mark this choice as "possible".
📗 Note: some of the choices may be repeated, if you think the choice is correct, please select all repeated ones as well.

📗 Choices:





None of the above
📗 [4 points] In a by grid, Tom is located at (, ) and Jerry is located at (, ). Tom uses to find Jerry and the successors of a state (one cell in the grid) are the four neighboring states on the grid (the cells above, below, to the left and to the right). What is the imum number of states that need to be expanded to find (and expand) the goal state? The order in which the successors are added can be arbitrary. Do not count repeated expansion of the same state. Include both the initial and the goal states.
📗 Answer: .
📗 [3 points] Suppose the states are integers between \(1\) and \(x\). The initial state is \(1\), and the goal state is . The successors of a state \(i\) are \(2 i\) and \(2 i + 1\), if exist. What is the smallest value of \(x\) so that the worst case space complexity (number of states stored in the list (queue or stack)) of DFS (Depth First Search) is larger than or equal to BFS (Breadth First Search)?
📗 Note: the worst case space complexity for BFS is \(b^{d}\) and for DFS is \(\left(b - 1\right) D + 1\). "Worst case" means you can re-order the successors and search in the order that maximizes the space requirement.
📗 Answer: .
📗 [4 points] Suppose the states are integers between \(1\) and . The initial state is \(1\), and there are two goal states, the optimal one: , and another one with (strictly) higher cost (length of path from initial state to goal state): \(x\). The successors of a state \(i\) are \(2 i\) and \(2 i + 1\), if exist. What is the smallest value of \(x\) such that DFS (Depth First Search) does not find the optimal goal in the worst case? 
📗 Answer: .
📗 [3 points] Suppose the states are integers between \(1\) and . The initial state is \(1\), and the goal state is . The successors of a state \(i\) are \(2 i\) and \(2 i + 1\), if exist. If it is allowed to put the successors into the stack (list) in any order, what are the minimum and maximum numbers of states that will be expanded during a DFS (Depth First Search)? Enter two numbers.
📗 Answer (comma separated vector): .
📗 [3 points] If \(h_{1}\) and \(h_{2}\) are both admissible heuristic functions, which ones of following are also admissible heuristic functions?
📗 Choices:





None of the above
📗 [3 points] Let \(h_{1}\) be an admissible heuristic from a state to the optimal goal, A* search with which ones of the following \(h\) will be admissible?
📗 Choices:





None of the above
📗 [4 points] Run search algorithm on the following graph, starting from state 0 with the goal state being . Write down the expansion path (in the order of the states expanded). The heuristic function \(h\) is shown as subscripts. Break tie by expanding the state with a smaller index.

📗 In case the diagram is not clear: the weights are (with heuristic values on the diagonal entries): .
📗 Answer (comma separated vector): .
📗 [4 points] Consider search algorithm on the following grid, starting from state 0 with the goal state being , and one can move left, right, up, or down one step at a time (no wrapping around). The cost is the number of moves taken, and the heuristic is the Manhattan distance to the goal. Write down the expansion path (in the order of the states expanded). Break tie by expanding the state with a smaller index.
0 1 2
3 4 5
6 7 8

📗 Answer (comma separated vector): .
📗 [4 points] Given the list of states in the priority queue (frontier) and the current cost \(g\) and heuristic cost \(h\), what is the largest value of \(x\) so that state \(0\) will be removed (expanded) from the priority queue next in all three informed search strategies: UCS (Uniform Cost Search), (Best First) Greedy Search, and A Search? Break ties by expanding the state with the smallest index.
State 0 1 2 3 4 5
g
h \(x\)

📗 Answer: .
📗 [3 points] Suppose there are \(n\) = states, \(1\) (initial state), \(2\), ..., \(n\) (goal state) and two heuristics \(h_{1}\) and \(h_{2}\), described in the table below, are both admissible. State \(i\) has successors \(i + 1, i + 2, ..., n\), for each \(i = 1, 2, ..., n - 1\). What is the minimum possible total cost from state \(1\) to state \(n\).
📗 Note: do not assume the cost between a state and its successor is 1. 
State 1 2 3 4 5
\(h_{1}\)
\(h_{2}\)

📗 Answer: .
📗 [3 points] The initial state and goal state of an 8-puzzle are given below. If the heuristic is the sum of Manhattan distances between the current position of each tile and the goal position, what is the heuristic of the initial state?
The goal state is:
\(1\) \(2\) \(3\)
\(4\) \(5\) \(6\)
\(7\) \(8\) \(0\)

The initial state is:

📗 Answer: .
📗 [4 points] Let the states be 3D integer points with integer coordinates \(\left(i, j, k\right)\) with boundary constrains and and . Each state \(\left(i, j, k\right)\) has six successors \(\left(i - 1, j, k\right), \left(i + 1, j, k\right), \left(i, j - 1, k\right), \left(i, j + 1, k\right), \left(i, j, k - 1\right), \left(i, j, k + 1\right)\) or a subset thereof subject to the boundary constraints. The score of state \(\left(i, j, k\right)\) is . Which local minimum will be reached if hill climbing is used starting from ? Enter the state, not the score.
📗 Answer (comma separated vector): .
📗 [2 points] Consider the following version of hill climbing: at initial state \(s\) we randomly choose one of \(s\)'s neighbors with equal probability. If the chosen neighbor has a strictly better score than \(s\) we move to the neighbor; otherwise we stay at \(s\). Assume \(s\) has neighbors, and only of the neighbors has a strictly better score than \(s\). What is the chance that we move out of \(s\) in iterations or less?
📗 Answer: .
📗 [3 points] Consider a state space where the states are positive integers between 1 and . State \(i\) has two neighbors \(i - 1\) and \(i + 1\) (subject to the boundary constraints). State \(i\) has score . If one runs the hill climbing algorithm, which initial states can reach the global minimum? Break ties by moving towards the global minimum. If there are multiple global minima, list the states that lead to all of them.
📗 Answer (comma separated vector): .
📗 [3 points] In the following graph coloring problem, each node is either labeled as + or -. The score of the graph is the number of edges connecting two nodes with the same label (color). We are minimizing the score. If the successor function is to change the label of a single node, in hill climbing (here, valley finding), which node should we change in the following graph? Enter the index of the node (subscript in the diagram) or -1 if we are at a local minimum. Break ties by entering the node with the smaller index.

In case the diagram is not clear: the labels are (1 is +, 0 is -) and the indices are .
📗 Answer: .
📗 [3 points] Given the scores in the following table, if hill-climbing (valley-finding) is used, how many states will lead to the global imum? Note: the neighbors of state \(i\) are states \(i - 1\) and \(i + 1\) (if they exist).
State 0 1 2 3 4 5 6 7
Score

📗 Answer: .
📗 [2 points] In simulated annealing one accepts a transition from \(s\) to an inferior neighbor \(t\) with probability \(\exp\left(\dfrac{- \left| f\left(s\right) - f\left(t\right) \right|}{T}\right)\), where \(T\) is the temperature parameter. Suppose \(f\left(s\right)\) = and \(f\left(t\right)\) = . At what temperature is the transition probability ?
📗 Answer: .
📗 [2 points] In simulated annealing we move from \(s\) to an inferior neighbor \(t\) with probability \(\exp\left(\dfrac{- \left| f\left(s\right) - f\left(t\right) \right|}{T}\right)\), where \(T\) is the temperature parameter. Suppose \(f\left(s\right)\) = and \(f\left(t\right)\) = and \(T\) = . What is the probability we stay at \(s\) instead of moving to \(t\)?
📗 Note: we are minimizing the score.
📗 Answer: .
📗 [3 points] When using Simulated Annealing, which value of temperature \(T\) from the list would imize the probability of moving to an inferior (worse) state? Enter one value of \(T\), not its index in the list.
📗 Answer: .

📗 [3 points] Four individuals (i.e. candidate solutions) in the current generation are given by -digit ( dimensional) sequences: . Individual 1: ; Individual 2: ; Individual 3: ; Individual 4: . The fitness function is . What is the result of performing 1-point crossover for the sequences with the highest fitness (break ties by preferring the sequence that appears earlier in the list) with a cross-point between digit and digit .
📗 Note: the first line representing the first child should start with the sequence with the highest fitness, and the second line representing the second child should start with the sequence with the second highest fitness.
📗 Calculator: .
📗 Answer (matrix with 2 lines, each line is a comma separated vector):
📗 [4 points] When using the Genetic Algorithm, suppose the states are \(\begin{bmatrix} x_{1} & x_{2} & ... & x_{T} \end{bmatrix}\) = , , , . Let \(T\) = , the fitness function (not the cost) is \(\mathop{\mathrm{argmax}}_{t \in \left\{0, ..., T\right\}} x_{t} = 1\) with \(x_{0} = 1\) (i.e. the index of the last feature that is 1). What is the reproduction probability of the first state: ?
📗 Answer: .
📗 [4 points] Suppose the score (fitness) of a state \(\left(d_{1}, d_{2}, d_{3}, d_{4}\right)\) is \(d_{1} + d_{2} + d_{3} + d_{4}\), and only 1-point crossover with the cross-over point between \(d_{2}\) and \(d_{3}\) is used in a genetic algorithm (i.e. mutation probabilities are 0). Two states are chosen as parents at random according to the reproduction probabilities, what is the probability that one of their children is the optimal state (i.e. \(\left(1, 1, 1, 1\right)\)? Enter a number between 0 and 1.
📗 Note: the two parents are sampled with replacement, meaning the probability that two states are chosen as parents is the product of their reproduction probabilities.
Index 1 2 3 4
State

📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .
📗 [1 points] Blank.
📗 Answer: .

# Grade


 * * * *

 * * * * *


📗 You could save the text in the above text box to a file using the button or copy and paste it into a file yourself .
📗 You could load your answers from the text (or txt file) in the text box below using the button . The first two lines should be "##x: 6" and "##id: your id", and the format of the remaining lines should be "##1: your answer to question 1" newline "##2: your answer to question 2", etc. Please make sure that your answers are loaded correctly before submitting them.







Last Updated: November 18, 2024 at 11:43 PM