Skip to content

Incorrect dtype of actions accepted by continuous action space with PettingZoo ParallelEnv #6214

Open
@rullo16

Description

@rullo16

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behaviour:
If you pass a continuous action, which is a float, to the agents, it will be converted to an int, losing the actual actions.

in unity_pettingzoo_base_env.py:

if act_spec.continuous_size > 0:
c_space = spaces.Box(
-1, 1, (act_spec.continuous_size,), dtype=np.int32
)
if self._seed is not None:
c_space.seed(self._seed)
if len(act_spec.discrete_branches) == 0:
self._action_spaces[behavior_name] = c_space
continue

change to:
if act_spec.continuous_size > 0:
c_space = spaces.Box(
-1, 1, (act_spec.continuous_size,), dtype=np.float32
)
if self._seed is not None:
c_space.seed(self._seed)
if len(act_spec.discrete_branches) == 0:
self._action_spaces[behavior_name] = c_space
continue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue describes a potential bug in ml-agents.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions