The section provide steps for how to set up Q-learning:
- Define 16 states:
states <- c("s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16")
- Define four actions:
actions<- c("up", "left", "down", "right")
- Define the transitionStateAction function, which can simulate the transitions from one state s to another state s' using an action a. The function takes in the current state s and selected action a, and it returns the next state s' and corresponding reward r'. In case of constrained action, the next state returned is the current state s and the existing reward r:
transitionStateAction<- function(state, action) { # The default state is the existing state in case of ...