Here is the pseudocode for SARSA (which I took from here)
Why are we choosing more than 1 action in SARSA? One for going into the next state and the other one for updating the Q function?
Artificial Intelligence Stack Exchange is a question and answer site for people interested in conceptual questions about life and challenges in a world where "cognitive" functions can be mimicked in purely digital environment. It only takes a minute to sign up.Sign up to join this community
Why are we choosing more than 1 action in SARSA?
There is never a state where more than one action is chosen.
The appearance of two
Choose statements is an artifact of the loop design and variable management in the pseudocode.
One for going into the next state and the other one for updating the Q function?
Sort of. There is only ever one chosen action for each state.
However, you need to have two actions in scope - the current action (just taken and observed) and planned next action, in order to process the update rule. Hence there are two variables
a' and the code needs to generate one or other outside the main loop, or have some other way to ensure that it has access to current and next values. This is also why at the end of the loop, the "next" values $s', a'$ get copied to the "current" values $s, a$.