Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Artificial intelligence
  3. Question
Artificial intelligence

How can the value iteration pseudocode algorithm be translated to C++?

Asked by Amit Sinha May 16, 2022 709 views 1 answer
Share

About this question

 I am having a difficult time translating this pseudocode into functional C++ code. At line 10: The value function is represented as V[s], which has bracket notation-like arrays. Is this a separate method or just a function of the value with a given state? Why is S inside the brackets? Is this supposed to be an array with as many elements as S?

At line 12: Vk would be the element in index k inside of array V?

At line 16: I'm interpreting this as the start of a do-while loop that ends at line 20. Line 19: I'm finding the action that maximises the sum, for all states, of the equation following the sigma? Line 20: I'm interpreting this as the the-end of the do-while. But what is this condition? Am I checking if there is an s such that this condition applies? So Would I have to loop between all states and stop if any state satisfies the condition? (Basically a loop with a break, instead of a while)

Your answer

1 Answer

More Artificial intelligence discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Artificial Intelligence Blogs

Guides, tips and career advice on Artificial Intelligence from JanBask experts.