Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Agent Based Modelling in python. All instructions are in the pictures themselves. Please also add comment were comment are needed. Please help me with the

Agent Based Modelling in python. All instructions are in the pictures themselves. Please also add comment were comment are needed.image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedPlease help me with the code. Most of it is just filling in comments which is what i understand. Really need help with the coding aspect mostly

The 2D Schelling Model For this part of the assignment, you're going to work on an implementation of a simple version of the 2D Schelling model. Two kinds of polygons (triangles and squares) are living on a 2-dimensional grid. You're essentially going to be coding up a version of the Parable of Polyogons that you've reviewed previously. To run this model, you'll set it up and solve it as follows Create a 2D Numpy array that is 20x20 cells. In this implementation, the number 0 will represent an empty cell, 1 will represent a triangle, and 2 will represent a square. Initialize the array with approximately 1/3 empty cells, 1/3 triangles, and 1/3 squares, with each cell having a random chance of being one of these options. Then, evolve this model using the following rules: A polygon's neighbors are the polygons in any cell that is adjacent to i. This could be either a Moore neighborhood (left/right/up/down and the diagonals) or a von Neumann neighborhood Gust left/right/up/down). .A polygon is happy if at least 1/3 of its neighbors are like it A polygon is considered to be segregated if all of its neighbors are like it, or if it has no neighbors. The board is evolved by randomly selecting a single unhappy polygon and moving it to a random empty cell. This continues until every polygon is happy. The level of segregation of the board is tracked with each step Before you start coding Before you dive into the coding part of this assignment, you might want to spend some time thinking about how you world set up this problem and attempt to solve it. Coming up with a plan before you start trying to turn your thoughts into code can help to make your coding more productive. The 2D Schelling Model For this part of the assignment, you're going to work on an implementation of a simple version of the 2D Schelling model. Two kinds of polygons (triangles and squares) are living on a 2-dimensional grid. You're essentially going to be coding up a version of the Parable of Polyogons that you've reviewed previously. To run this model, you'll set it up and solve it as follows Create a 2D Numpy array that is 20x20 cells. In this implementation, the number 0 will represent an empty cell, 1 will represent a triangle, and 2 will represent a square. Initialize the array with approximately 1/3 empty cells, 1/3 triangles, and 1/3 squares, with each cell having a random chance of being one of these options. Then, evolve this model using the following rules: A polygon's neighbors are the polygons in any cell that is adjacent to i. This could be either a Moore neighborhood (left/right/up/down and the diagonals) or a von Neumann neighborhood Gust left/right/up/down). .A polygon is happy if at least 1/3 of its neighbors are like it A polygon is considered to be segregated if all of its neighbors are like it, or if it has no neighbors. The board is evolved by randomly selecting a single unhappy polygon and moving it to a random empty cell. This continues until every polygon is happy. The level of segregation of the board is tracked with each step Before you start coding Before you dive into the coding part of this assignment, you might want to spend some time thinking about how you world set up this problem and attempt to solve it. Coming up with a plan before you start trying to turn your thoughts into code can help to make your coding more productive

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions