During Reinforcement Training, is it possible to remove the action which was taken after each state?

2 views (last 30 days)
In Reinforcement learning toolbox, I wish to remove the action which is assigned during the particular state.
For instance, if state 1 has n possible actions, state 2 should have n-1 possible actions and so on. The episode has to terminate until available actions become empty.
On an averge, the avaialble actions at state 1 is around 100.
Any help is highly regarded !!!
Thanks in advance

Answers (1)

Dhruv
Dhruv on 4 Sep 2023
Yes, it is possible to remove the action which was taken after each state in reinforcement learning in MATLAB. Here is a way to do it:
  1. Create a list of all possible actions.
  2. Initialize a counter to 0.
  3. For each state:
  • Choose an action from the list.
  • Remove the chosen action from the list.
  • Increment the counter.
  • If the counter is equal to the number of available actions, terminate the episode.
Here is an example of how to implement this:
possible_actions = 1:100;
counter = 0;
while counter < length(possible_actions)
action = randperm(length(possible_actions));
possible_actions(action) = [];
counter = counter + 1;
end
This code will first create a vector of 100 integers from 1 to 100. Then, it will loop over each state. In each state, it will randomly choose an action from the vector and remove it from the vector. The loop will continue until there are no more available actions, at which point the episode will terminate.
You may want to refer to the documentation link below to gain more insight into it: https://www.mathworks.com/help/reinforcement-learning/ug/train-reinforcement-learning-agents.html
I hope this helps!

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!