- Hoàng Phan Hữu Đức (20020011)
- Hoàng Phan Hữu Phúc (20020026)
- Hoàng Trọng Nghĩa (20020024)
- Phạm Đình Quân (20020067)
https://inst.eecs.berkeley.edu/~cs188/fa20/project1/
- Problem:
PositionSearchProblem
(find paths to only 1 goal position) - Algorithm: Depth-First Search (DFS)
- Heuristic: none
- Normal DFS using stack (in function
depthFirstSearch
)
- Problem:
PositionSearchProblem
- Algorithm: Breadth-First Search (BFS)
- Heuristic: none
- Normal BFS using queue (see
breadthFirstSearch
)
- Problem:
PositionSearchProblem
with optimized cost - Algorithm: Uniform-Cost Search (Dijkstra)
- Heuristic: none
- Normal Dijsktra using priority-queue (heap) in
uniformCostSearch
- Problem:
PositionSearchProblem
with optimized cost - Algorithm: A* Search
- Heuristic: manhattanHeuristic (already implemented)
- Uniform cost search with the priority of the total
cost
+heuristic()
(seeaStarSearch
)
- Problem:
CornersProblem
(find a path through all four corners of a layout, optimized cost) - Algorithm: Breadth-First Search
- Heuristic: None
- Add new tuple to state, represent for list of corners was visited
- Search by BFS algorithm ()
- from
startingState
is(startingPosition, ())
(getStartState
) - goal states are which state visited corners (length = 4) (
isGoalState
) - change state by new implementation of
getSuccessors
- from
- Problem:
CornersProblem
(find a path through all four corners of a layout, optimized cost) - Algorithm: A* Search
- Heuristic:
cornersHeuristic
(require)
cornersHeuristic
: cost of the shortest journey from position through all remaining corners- Start at the current position, go to the nearest unvisited corner by Manhattan distance
- Continue going to the nearest other corners until no one left
- the total Manhattan distance of the journey is the result of heuristic
- A* search with this heuristic (in class
AStarCornersAgent
)
- Problem:
FoodSearchProblem
(find a path that collects all of the food (dots), optimized cost) - Algorithm: A* Search
- Heuristic: need to implement
foodHeuristic
foodHeuristic
: return a max ofmazeDistance
from position to any unclaimed foodmazeDistance
(already implemented) is BFS distance in the maze of 2 positions- This strategy prioritize the position that has the farthest distance to any food is closest
- Execute A* search with this heuristic (
AStarFoodSearchAgent
)
- Problem:
FoodSearchProblem
(find a path that collects all of the food (dots), optimized cost) - Algorithm: Greedy (with any position, the agent will go to the closest food)
- Heuristic: None
- At a position, find a path to the closest food by uniform cost search (goal states are any dots) (
findPathToClosestDot
)- Use class
AnyFoodSearchProblem
to search, goal states is any food (isGoalState
)
- Use class
- Repeat searching until there is no food left
https://inst.eecs.berkeley.edu/~cs188/fa20/project2/
- Problem: improve
ReflexAgent
by implementing functionevaluationFunction
- Algorithm: any
- Calculate the evaluation of each position from -1e6 to 1e6 as:
- If its entity is ghost -> return min value (-1e6)
- If its entity is food -> return max value (1e6)
- Else return 1e6 * (distance from this position to closest food / 2 - distance from this position to closest ghost) (by manhattan distance)
- It means the evaluation considers that keeping distance from ghost is twice important than collecting food.
- Problem: find the minimax action for
MinimaxAgent
- Algorithm: minimax
- Implement function
minimaxValue
to evaluate the minimax action:- For the ghost, choose an action which has the min value with the next minimax action of Pacman. Ghosts start in order of indexes (not the best strategy)
- For Pacman, choose an action which has the max value with the next minimax action of ghosts.
- Problem: Add alpha-beta prunning for minimax from Q2
- Algorithm: minimax
- Add alpha-beta prunning for function
minimaxValue
- Problem: no longer take the min over all ghost actions, but the expectation according to your agent’s model of how the ghosts act
- Algorithm: minimax
minimaxValue
for ghosts returns the average minimax value of all actions (code snippet)
- Problem: a better evaluation function for pacman
- Algorithm: any