entity-neural-network / entity-gym

Standard interface for entity based reinforcement learning environments.
Other
35 stars 5 forks source link

Crash when using `SelectEntityAction` #6

Open cswinter opened 2 years ago

cswinter commented 2 years ago

Occasionally, the PickMatchingBalls environments runs into the following error:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/opt/conda/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/root/enn-incubator/entity_gym/entity_gym/environment/parallel_env_list.py", line 74, in _worker
    observation = envs.act(data[0], data[1])
  File "/root/enn-incubator/entity_gym/entity_gym/environment/env_list.py", line 52, in act
    _actions = action_index_to_actions(
  File "/root/enn-incubator/entity_gym/entity_gym/environment/env_list.py", line 131, in action_index_to_actions
    actees = [
  File "/root/enn-incubator/entity_gym/entity_gym/environment/env_list.py", line 132, in <listcomp>
    mask.actee_ids[e] for e in action[index].as_array().reshape(-1)
IndexError: list index out of range
Bene94 commented 1 year ago

Currently running into the same bug. The action is a selection of a list of flows.

observation = envs.act(data[0], data[1])

File "/local/home/bewinter/miniconda3/envs/entity_gym/lib/python3.9/site-packages/entity_gym/env/env_list.py", line 52, in act _actions = action_index_to_actions( File "/local/home/bewinter/miniconda3/envs/entity_gym/lib/python3.9/site-packages/entity_gym/env/env_list.py", line 127, in action_index_to_actions actees = [ File "/local/home/bewinter/miniconda3/envs/entity_gym/lib/python3.9/site-packages/entity_gym/env/env_list.py", line 128, in index_to_actee[a] for a in action[index].as_array().reshape(-1) IndexError: list index out of range

Bene94 commented 1 year ago

This error happens if the entity list of the actees is empty. A better error message would help in debugging.