Design simulation in NetLogo
Design simulation in NetLogo
Assignment Brief:
For this assignment you must design simulation in NetLogo that contains an autonomous agent that attempts to find the optimal (shortest) route between a number of cities then return to the starting point and stop at this point. Your model must adhere to the following rules:
Simulator setup requirements (5 marks)
- The world must be 201 patches wide by 201 patches high.
- The origin of the world must be at the center
- The world must wrap both horizontally and vertically
- The patch size must be set to 2
- The framerate must be set to 30 frames per secon
Overall model requirements (5 marks)
- The EXACT following code must be placed the beginning of your model:
- The breed called cities must be used to create the locations in the model.
- The breed called cars must be used to create the autonomous agent that moves around
your model.
- The cars-own variables history – must be used to store the identity of each individual city visited. Each time a new city is visited it must be added to this list.
- The cars-own variables travelled-distance – must be used to store the total distance travelled by the agent.
World setup (20 marks)
The model must have a function called setup that sets up the world with the following
parameters:
- Creates 50 randomly placed cities that are set to size 2, are circle shapes and are blue in color.
- Creates 1 car that starts at the location -90, -90, is set to size 5 and is set to the color red.
- Sets the background color of your world to green using the patches.
- Creates 100 randomly placed blocks of patches that are 2 by 2 that brown in color. These patches should represent solid blocks in your world that the agent cannot pass through.
- No location should be placed on a brown patch as this would make it inaccessible.
- The model must clear any previous activities when the setup procedure is called
Figure 1. Example layout
Agent setup (50 marks)
-
- Your agent must run from a function called go and must add a tick to the counter as it runs.
- Your agent must try to find the shortest route between all of the locations whilst also avoiding the brown patches as these represent solid impassable objects.
- Each time a city is visited the color of that city must turn yellow.
- Your agent must draw a line as it moves along to show the path.
- When all cities have been visited it must return to the first city it visited and stop in that position.
Figure 2. Example of expected output
300 word report (20 marks)
You must write a 300 word (maximum) report explaining how you programed the agent to find the optimal route and avoid the obstacles including details of the features you used. If you were unable to get the agent to perform this activity perfectly you should explain the difficulties you had.
Submission Requirements:
1 * NetLogo file (.nlogo) containging your complete model. |
Marks awarded for: Simulator setup – 5%
Following overall model requirements – 5% World setup – 20% |