Implement asynchronous value iteration for a Markov Decision Process (MDP). Unlike synchronous dynamic programming, where all states are updated simultaneously in each sweep using values from the previous iteration, asynchronous DP updates states one at a time in a given order, and each update immediately uses the most recent value estimates (in-place updates).
Given an MDP specified by:
num_states: the number of statestransitions: a nested list where transitions[s][a] is a list of (probability, next_state, reward) tuples representing the dynamics for taking action a in state sgamma: the discount factorupdate_order: a list of state indices specifying which state to update at each step (states may repeat)Your function should:
update_order sequentially, performing a Bellman optimality backup using the current value estimatesIf a state has no available actions (empty action list), its value remains unchanged when selected for update.
The Bellman optimality backup for a state computes the maximum expected return over all available actions.