Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We would like to use a Q - learning agent for Pacman, but the size of the state space for a large grid is too
We would like to use a Qlearning agent for Pacman, but the size of the state
space for a large grid is too massive to hold in memory. To solve this, we will
switch to featurebased representation of Pacmans state.
We will have two features, Fg and Fp defined as follows:
Fg s a As Bs a Cs a
Fps a DsEs a
where
As number of ghosts within step of state s
Bs a number of ghosts Pacman touches after taking action a from state s
Cs a number of ghosts within step of the state Pacman ends up in after taking action a
Ds number of food pellets within step of state s
Es a number of food pellets eaten after taking action a from state s
For this pacman board, the ghosts will always be stationary, and the action
space is lef t right, up down, stayCalculate the features for the actions in lef t right, up stay from the current state.
After a few episodes of Qlearning, the weights are wg and wp Calculate the Q value for each action in lef t right, up stay from the current state.
We observe a transition that starts from the state above, s takes action up ends in state sthe state with the food pellet above and receives a reward Rs a s The available actions from state s are down and stay. Assuming a discount of gamma calculate the new estimate of the Q value for s based on this episode.
With this new estimate and a learning rate alpha update the weights
for each feature.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started