In RL how to tell an agent that some actions in the action space are currently not available in gym?

91 Views Asked by At

I want to make a task allocation decision by reinforcement learning. Suppose there are N tasks to be allocated and M severs to complete these task. However, there is a constraint that one task should be served by only one server.How should I design the action space?

So when I design the decision-making action space,I don't know which design is better:

        self.action_space = spaces.MultiDiscrete([2]*(M*N)) #the first way-action space: [a_11,a_12,...,a_1N,a_M1,a_M2,...,a_MN]  M*N discrete vector,a_mn in [0,1]
        self.action_space = spaces.MultiDiscrete([M]*N) #the second way-action space: [a_1,a_2,...,a_N] N discrete vector, a_n in [0,M-1]

In first way, the variable a_mn stands for if the n-th task is offloaded to m-th server or not. While in the second way,a_n represents which server should be chosen by the n-th task.

If the first way is better, how can I implement the constraints mentioned before, since there is lots of infeasible actions in the action space?

Thank a lot

0

There are 0 best solutions below