Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intro tutorial: Remove unique_id from Agent init #251

Merged
merged 2 commits into from
Sep 26, 2024
Merged

Conversation

EwoutH
Copy link
Member

@EwoutH EwoutH commented Sep 25, 2024

Remove unique_id from the Agent init in the introduction tutorial, since unique_id is now automatically assigned in Mesa 3.0 and Mesa-geo 0.9.

Update after the changes in #248.

@EwoutH EwoutH force-pushed the remove_unique_id branch 2 times, most recently from 9b9719b to aab7ce0 Compare September 25, 2024 18:13
@EwoutH EwoutH requested review from tpike3 and wang-boyu September 25, 2024 18:20
@EwoutH EwoutH added the docs Release notes label label Sep 25, 2024
@EwoutH
Copy link
Member Author

EwoutH commented Sep 25, 2024

@tpike3 @wang-boyu I have a very specific question: The notebook had unique_id = "HOODNUM" defined in the class, and then unique_id=self.unique_id in the AgentCreator from_file() method. I think that meant that the HOODNUM column was assigned as the unique_id, right? How was that used and is it still needed? And isn't it also saved as an Agent attribute?

Please explain to how it's intended to work :)

Edit: I can confirm that HOODNUM is still saved as an attribute for Agents:

image

@wang-boyu
Copy link
Member

I think that meant that the HOODNUM column was assigned as the unique_id, right?

That's right!

How was that used and is it still needed?

I don't think it's really used, but better confirm with @tpike3 for this tutorial.

@EwoutH
Copy link
Member Author

EwoutH commented Sep 26, 2024

For the Neighbourhood, I think I found an elegant solution of using the HOODNUM in the __repr__ method, so that it prints its HOODNUM from the data file.

    def __repr__(self):
        return f"Neighbourhood {self.HOODNUM}"

This was equivalent of the original behavior of assigning HOODNUM to unique_id and then printing unique_id.

I will give @tpike3 a chance to review and otherwise I will merge tonight.

Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM --- HOODNUM was taken from whoever made the model initially (Corvince?). I think you solution is very elegant.

@tpike3 tpike3 merged commit 4e22c5c into main Sep 26, 2024
11 checks passed
@EwoutH
Copy link
Member Author

EwoutH commented Sep 26, 2024

Thanks!

Please don't merge my PRs though, I like to do that myself (in this case I would have liked to squash). An review and approve is really appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants