0
$\begingroup$

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',
)

and just 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?

$\endgroup$

marked as duplicate by Philip Raeisghasem, Community Mar 27 at 18:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.