Reinforcement learning: negative reward (punish) illegal actions?
I think that you should specify better what an illegal action is. Suppose to me in a highway with a self-driving car. I don't which are your legal limits values but suppose that they are between 20mph and 40mph. Of course, the car itself could drive at less than 20mph and let us suppose that its maximum possible velocity is 60mph. If your self-driving car is driving at less of 20mph or between 40mph and 60mph you should give a negative reward for each time-step it is outside legal limits. Instead, if your self-driving car is at more than 60mph you have a problem in your environment because 60mph is a physical limitation and should be handled by the environment. An easy solution would be to clip the action between 0mph and 60mph and give negative reward if it's in the range 0mph to 20mph or if it is in the range 40mph to 60mph.