Professional Documents
Culture Documents
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:
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.
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
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
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: