Wisc NetID for In-class Quiz: @wisc.edu
4-digit Passcode: (anything is okay, use the same one for all lectures or use based on your id)
Save submission to file? File name: (leave it blank to not save anything) 17id,answer_id;token,answer_check;download,answer_download
# Warning: this is a draft and will be updated one day before the lecture.
📗 Search problems solve for a sequence of optimal actions to minimize the total cost of these actions.
📗 Reinforcement learning is similar but the cost is unknown so the agent has the learn the costs (usually in the form of reward) while finding the optimal actions.
➩ Board games.
➩ Robotic control.
➩ Autonomous vehicle control.
➩ Economic models.
➩ Large language models.
📗 The total number of possible action sequences is large, so efficient algorithms are needed to search only the relevant ones.
📗 A search problem is defined by a state space graph (search graph): Wikipedia.
➩ \(V\) is the set of nodes (or vertices) representing the states (outcome from a sequence of actions).
➩ \(E\) is the set of edges (or arcs) representing the possible actions at each state.
➩ \(c\) is the cost (or weights) associated with each edge, assumed to be positive.
📗 The search graph is usually in the form of a tree.
➩ At the beginning of a search, only the initial state is expanded.
➩ The list of states that can be reached from some state \(s\) by performing some action is called successors of \(s\).
➩ Expanding a state means generating the list of successors and adding them to the search tree.
➩ The leafs of the search tree is called the frontier (or the fringe).
➩ The search is over when a goal state is expanded. The path from the initial state to the goal state is called a solution to the search problem.
➩ The solution is optimal if it has the smallest cost.
📗 A search strategy is the order in which the states are expanded.
In-class Discussion
📗 [1 points] people with one flashlight (torch) want to go across a river. The bridge can hold two people at a time, and they must cross with the flashlight. The time it takes for each person to cross the river:
A
B
C
D
What is the minimum total time required for everyone to cross the river?
📗 BFS (Breadth First Search) uses Queue for the frontier: remove from the front, add to the back: Wikipedia.
📗 BFS is complete.
📗 BFS is optimal when the cost of every action is 1.
📗 Time complexity is \(T = 1 + b + b^{2} + ... + b^{d}\).
➩ This count includes the root and the goal.
📗 Space complexity is \(S = b^{d+1}\).
📗 Bidirectional search does BFS from the initial and goal states at the same time and stops when they meet.
In-class Quiz
ID:
📗 [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 ? 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: .
[Note] Use the space to explain the steps or just take notes:
📗 DFS (Depth First Search) uses Stack for the frontier: remove from the front, add to the front: Wikipedia.
📗 DFS is incomplete if \(D = \infty\).
📗 DFS is not optimal.
📗 Time complexity is \(T = 1 + b^{D-d+1} + ... + b^{D-1} + b^{D}\).
➩ This count includes the root and the goal.
📗 Space complexity is \(S = \left(b - 1\right) D + 1\).
In-class Quiz
ID:
📗 [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 ? 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: .
[Note] Use the space to explain the steps or just take notes:
➩ DFS and stops if path length is larger than \(1\).
➩ DFS and stops if path length is larger than \(2\).
➩ ...
➩ DFS and stops if path length is larger than \(d\).
📗 IDS is complete.
📗 IDS is optimal when the cost of all actions are 1.
📗 Time complexity is \(T = \left(d + 1\right) + d b + \left(d - 1\right) b^{2} + ... + 3 b^{d-2} + 2 b^{d-1} + 1 b^{d}\).
➩ This count includes the root and the goal, and the first DFS step is only on the root.
📗 Space complexity is \(S = \left(b - 1\right) d + 1\).
In-class Quiz
📗 [1 points] Find worst-case time complexity (green point) and space complexity (blue point) for if the search strategy (tie-breaking) expands from left to right.
📗 What is a good search strategy for the water jugs game (note: there are cycles, so the search tree can be a search graph if the search strategy does not keep track of the visited states): Link.
📗 If you have questions, please (i) Ask during or after the lecture or the break, (ii) Piazza: Link, (iii) Office hours and discussion sessions. Please do NOT use Canvas mail and use email only to the course instructor (not TAs) for grading issues.
Additional In-class Discussion
📗 Sometimes a question not in the notes will be asked during the lecture, you can submit your answer here:
[Notes] (not visible to other students):
[L17Q7]
Submit your answer to see other students answers (click the submit button to refresh):
Additional In-class Quiz
📗 Sometimes a question not in the notes will be asked during the lecture, you can submit your answer here:
A.
B.
C.
D.
E.
[Notes] (not visible to other students):
[L17Q8]
Submit your answer to see other students answers (click the submit button to refresh):
📗 To get full points on the in-class quizzes for a lecture:
➩ Submit relevant answers to the questions discussed during the lecture: incorrect answers are okay.
➩ Some questions require [notes] to earn the point.
➩ Some questions require special ID (given during the lecture) to earn the point.
➩ Do not submit answers to questions that are not discussed during the lectures. Each such submission will result in a deduction of one point.
➩ The grade on Canvas Assignment W17 is computed as number of points divided by the number of questions asked (and multiplied by 4, out of 4) and updated on Canvas every weekend.
📗 Notes and code adapted from the course taught by Professors Jerry Zhu, Blerina Gkotse, Yudong Chen, Yingyu Liang, Charles Dyer. Some content are generated using Copilot .