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

Solution to Schelling example does not correspond to model description #212

Closed
jmoy opened this issue Nov 24, 2015 · 3 comments
Closed

Solution to Schelling example does not correspond to model description #212

jmoy opened this issue Nov 24, 2015 · 3 comments

Comments

@jmoy
Copy link

jmoy commented Nov 24, 2015

In the schelling_solutions.ipynb the last two lines of the function happy are:

   num_same_type = sum(self.type == agent.type for agent in neighbors)
   return num_same_type >= require_same_type

According to this code an agent is happy if at least require_same_type number of agents are of the same type as this agent.

This contradicts the text which says: "We will say that an agent is happy if half or more of her 10 nearest neighbors are of the same type".

First, the text clarifies that "They are perfectly happy if half their neighbors are of the other color" whereas here we are checking the number of other agents who are of the same color as this agent.

Second, earlier in the code require_same_type is set to 7 whereas to follow the text it should have been 6.

@jmoy
Copy link
Author

jmoy commented Nov 25, 2015

I think I understand now. "We will say that an agent is happy if half or more of her 10 nearest neighbors are of the same type" means "of the same type as that agent" which is how it is in Schelling's paper.

But the point about require_same_type remains.

@jstac
Copy link
Contributor

jstac commented Nov 25, 2015

@jmoy Many thanks for flagging these issues. Right now we're in the middle of a big reorganization to simplify structure and switch over to Python 3.5. Once those changes are merged we'll tidy this up.

@jstac
Copy link
Contributor

jstac commented Jan 29, 2016

Finally fixed this. Thanks again.

@jstac jstac closed this as completed Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants