This question already has an answer here:
I'm trying to implement DQN using tf-agents for simple environment. So far I have
from tf_agents.specs import array_spec action_spec = array_spec.BoundedArraySpec( shape=(), dtype=np.int32, minimum=0, maximum=10, name='action', )
10 states for the environment. But in some states agent is able to perform [1-5] actions not the whole range [1-10]. How can I specify that in practice?
Right now I've came up only with the idea of giving really high negative reward when being in the state and performing illegal action. Is there a right way how to accomplish that?