Skip to content

model.get_agents_of_type() still contains agents that have been removed both from the grid and the scheduler #2019

@rht

Description

@rht

Describe the bug

I was trying to replace the lines in the Sugarscape G1MT example https://github.com/projectmesa/mesa-examples/blob/34e92d2c29a99e950bc17f7cac860c5b13156b21/examples/sugarscape_g1mt/sugarscape_g1mt/model.py#L146-L149

with

        return list(self.get_agents_of_type(Trader).shuffle(inplace=True))

This failed the tests, because when an agent dies, it only removes itself from the grid and the scheduler.

Expected behavior

The users would expect the 2 methods to give the same outcome, but will be tripped by the new requirement of agent.remove().

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugRelease notes label

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions