Skip to content

Commit

Permalink
Fix for projectmesa#919, adding exception for duplicate ids
Browse files Browse the repository at this point in the history
  • Loading branch information
allofhercats committed Sep 12, 2020
1 parent f15b272 commit 6fe7a43
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mesa/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def add(self, agent: Agent) -> None:
have a step() method.
"""

if agent.unique_id in self._agents:
raise Exception("Agent with unique id {0} already added to scheduler".format(repr(agent.unique_id)))

self._agents[agent.unique_id] = agent

def remove(self, agent: Agent) -> None:
Expand Down

0 comments on commit 6fe7a43

Please sign in to comment.