Answers.Body: <p>Wow, that's a really confusing example, if I were you I would check out some other RL resources. I wouldn't consider <em>h</em> being the last step and <em>h-1</em> being the previous step. In terms of steps of iterations of the dynamic programming algorithm, <em>h</em> is actually the first step, <em>h-1</em> the next step and so on. Viewing it in these terms it makes sense that the Value of RF increases from 10 to 19, because after the first step of dynamic programming the state RF incorporates some of the value from RU.</p>
  <p>Here is the correct calculation for h-2.</p>
  <p><span class="math-container">$$10 + 0.9(0.5\times19+0.5\times14.5) = 25.08$$</span></p>
  <p>You are doing a couple of things incorrectly in your calculation:</p>
  <ul>
  <li>Firstly, you are mistakenly assigning the reward a value of 19. The reward should be 10. Note that the reward and Value are two different quantities. As we iterate through the dynamic programming algorithm, our current approximation of the values will change but reward will always remain the same (it is the number as indicated in the bubbles in the diagram). It just so happens that the Value and reward are equal on the first step (h).</li>
  <li>You are using the Values for states RU and RF (=10) from step <em>h</em> to calculate the values step <em>h-2</em> which is incorrect. You should be using the values from step <em>h-1</em> which are 14.5 and 19 respectively.</li>
  </ul>
  <p>Using this understanding, the calculation for the next step <em>h-3</em> would be (notice that I am now using values from step <em>h-2</em>).</p>
  <p><span class="math-container">$$10 + 0.9*(0.5*25.08+0.5*16.53) = 28.72$$</span></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-06T02:26:03.623Z
Answers.LastActivityDate: 2021-06-06T02:32:59.060Z
Answers.LastEditDate: 2021-06-06T02:32:59.060Z
Answers.UserDisplayName: James
Body: <p>I am trying to understand the <a href="http://www.youtube.com/watch?v=SWYceQpEVKM&amp;t=37m47s" rel="nofollow noreferrer">problem below, represented as an MDP with four states (PU, PF, RU, and RF) and two actions (AS)</a>.</p>
  <p><a href="https://i.sstatic.net/V9KE8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/V9KE8.png" alt="enter image description here" /></a></p>
  <p>Let's consider V(RF), the value of the state RF. At time-step <span class="math-container">$h$</span>, V(RF) = 10. When we go to the previous time-step <span class="math-container">$h-1$</span>, V(RF) increases to 19.</p>
  <p>Why is the value of RF increasing backward, i.e. at time-step <span class="math-container">$h$</span>, which is the last step, it's 10, but in <span class="math-container">$h-1$</span> it's 19?</p>
  <p>Also, when I apply the Bellman equation, I am not getting the value of V(RF) at time-step <span class="math-container">$h-2$</span>, which is 25.08, according to the table.</p>
  <p>Below is my solution which I am applying on V(RF):</p>
  <pre><code>Lets suppose for RF, I know that
  Vh (RF) = max {R(RF,A), R(RF,S)}
          = max ({10,10}
  Vh (RF) = 10
  
      **for h-1**
      Vh-1 (RF) = max R(RF,act) + gamma E (summation state) P(State|RF,act) Vh(State)
                = max {10+0.9(1*0), 10+0.9(0.5(10)+0.5(10))}
                = max (10,19)
  
      **for h-2**
      Vh-2(RF) = max R(RF,act) + gamma E(summation state) P(State|RF,act) Vh(State h-1)
               = max {19+0.9(1*0), 19+0.9(0.5(10)+0.5(10))}
               = 28.0
  </code></pre>
  <p>So, in the above scenario, the reward is 0.9, but I am not sure how we get the third result in V(RF) as 25.08. Where are we using this last part <code>Vh(State)</code> from the equation?</p>
  
Tags: <markov-decision-process><reward-functions><bellman-equations><policy-iteration><dynamic-programming>
Title: How do we get the value of this state of an MDP, at time-step $h-2$, using dynamic programming?
UserDisplayName: AHF
ThreadText: # How do we get the value of this state of an MDP, at time-step $h-2$, using dynamic programming?
  
  (Asked by: username_0 on 2021-06-03)
  
  I am trying to understand the problem below, represented as an MDP with four states (PU, PF, RU, and RF) and two actions (AS).
  
  Let's consider V(RF), the value of the state RF. At time-step $h$, V(RF) = 10. When we go to the previous time-step $h-1$, V(RF) increases to 19.
  Why is the value of RF increasing backward, i.e. at time-step $h$, which is the last step, it's 10, but in $h-1$ it's 19?
  Also, when I apply the Bellman equation, I am not getting the value of V(RF) at time-step $h-2$, which is 25.08, according to the table.
  Below is my solution which I am applying on V(RF):
  Lets suppose for RF, I know that
  Vh (RF) = max {R(RF,A), R(RF,S)}
          = max ({10,10}
  Vh (RF) = 10
  
      **for h-1**
      Vh-1 (RF) = max R(RF,act) + gamma E (summation state) P(State|RF,act) Vh(State)
                = max {10+0.9(1*0), 10+0.9(0.5(10)+0.5(10))}
                = max (10,19)
  
      **for h-2**
      Vh-2(RF) = max R(RF,act) + gamma E(summation state) P(State|RF,act) Vh(State h-1)
               = max {19+0.9(1*0), 19+0.9(0.5(10)+0.5(10))}
               = 28.0
  
  So, in the above scenario, the reward is 0.9, but I am not sure how we get the third result in V(RF) as 25.08. Where are we using this last part Vh(State) from the equation?
  
  **Tags:** markov-decision-process, reward-functions, bellman-equations, policy-iteration, dynamic-programming
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-06-06. Score: 1 | Accepted answer
  
  Wow, that's a really confusing example, if I were you I would check out some other RL resources. I wouldn't consider *h* being the last step and *h-1* being the previous step. In terms of steps of iterations of the dynamic programming algorithm, *h* is actually the first step, *h-1* the next step and so on. Viewing it in these terms it makes sense that the Value of RF increases from 10 to 19, because after the first step of dynamic programming the state RF incorporates some of the value from RU.
  
  Here is the correct calculation for h-2.
  
  $$10 + 0.9(0.5\times19+0.5\times14.5) = 25.08$$
  
  You are doing a couple of things incorrectly in your calculation:
  
  * Firstly, you are mistakenly assigning the reward a value of 19. The reward should be 10. Note that the reward and Value are two different quantities. As we iterate through the dynamic programming algorithm, our current approximation of the values will change but reward will always remain the same (it is the number as indicated in the bubbles in the diagram). It just so happens that the Value and reward are equal on the first step (h).
  * You are using the Values for states RU and RF (=10) from step *h* to calculate the values step *h-2* which is incorrect. You should be using the values from step *h-1* which are 14.5 and 19 respectively.
  
  Using this understanding, the calculation for the next step *h-3* would be (notice that I am now using values from step *h-2*).
  
  $$10 + 0.9\*(0.5\*25.08+0.5\*16.53) = 28.72$$
  
  
  ---
  
  