Skip to content

Bug with idx_range, causing error with Prioritized ER #3

@Maxtoq

Description

@Maxtoq

Describe the bug
When using PER with QMIX, an issue arises with the idx_range returned by the insert function of RecPolicyBuffer:

line 267, in insert
for idx in range(idx_range[0], idx_range[1]):
IndexError: index 1 is out of bounds for axis 0 with size 1`.

The reason seems to be that the insert function takes as first parameter the number of episodes to insert, instead of the number of steps (as the function description explains it).

To try fixing the issue, I computed the number of steps to insert, from the number of episodes, as such:
from line 164:

episode_length = acts.shape[0]
assert episode_length == self.episode_length, ("different dimension!")
# My line
number_insert_steps = num_insert_episodes * episode_length

And then I replace num_insert_episode by num_insert_steps in the rest of the function.

This seems to work.
However, I am not completely sure that it was intended like that.

Tell me if I am wrong and the issue is related to something else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions