valueIterationAgents.py
def computeQValueFromValues(self, state, action):
        """
          Compute the Q-value of action in state from the
          value function stored in self.values.
        """
        tot = 0
        for nextState, prob in self.mdp.getTransitionStatesAndProbs(state, action):
            tot += prob * (self.mdp.getReward(state, action, nextState) + (self.discount * self.values[nextState])) #  P * (R + gamma * Val)
        return tot

          Compute the Q-value of action in state from the
          value function stored in self.values.
        
Compute the Q-value of action in state from the
value function stored in self.values.
Compute the Q - value of action in state from the value function stored in self . values .
def computeQValueFromValues(self, state, action):
        tot = 0
        for nextState, prob in self.mdp.getTransitionStatesAndProbs(state, action):
            tot += prob * (self.mdp.getReward(state, action, nextState) + (self.discount * self.values[nextState])) 
        return tot
def computeQValueFromValues ( self , state , action ) : tot = 0 for nextState , prob in self . mdp . getTransitionStatesAndProbs ( state , action ) : tot += prob * ( self . mdp . getReward ( state , action , nextState ) + ( self . discount * self . values [ nextState ] ) ) return tot
Compute the Q-value of action in state from the
value function stored in self.values.
Compute the Q - value of action in state from the value function stored in self . values .
"""
          Compute the Q-value of action in state from the
          value function stored in self.values.
        """ #  P * (R + gamma * Val)
self
state
action