powered by NetLogo

view/download model file: rankSize.nlogo


This model simulates the organization of a cities system. The cities system is supposed to consist of a set of cities and towns located on a surface and distributed at random. Each town has a population which produces goods for the outside demand and for the inside demand coming from the inhabitants of towns comprised in the system. In fact the inhabitants of each towns purchase goods from larger cities because these goods are not available in the towns where they live, and chose the city where to purchase goods by minimizing the transportation cost. The population of each town depends on the outside and inside demand. The dynamics based on this simple economic hypotheses produce a power law distribution of the towns.


At the beginning of the model, the established number of towns are located at random, checking that the distance from the nearest town is greater than a minimum, only to avoid excessive overlapping, and also that the distance from the border is greater tan a minimum.

Towns are the agents of the systems. Their main attributes are the population which, at the beginning, is assigned at random, and the outside demand. This last is normally distributed, but negative values are avoided. It remains constant during the running of the model.

At the beginning of each step the population grows with an established growth rate (0.1). Later each town generates fluxes of population toward the towns with a greater number of inhabitants. The utility of inhabitants consists in the minimization of the transportation cost. A random utility model is utilized, so that the population is distributed among the other towns having a greater number of inhabitants proportionally to the negative exponential function of the intercity distance (exp(-beta*dist)). This evaluation is anyway equal zero if the travel transportation cost (transportationCost*distance) is greater than an established threshold.

Each town collects the in-coming population representing the inside demand and update its population with the following equation: population(t+1)=population(t)+(insideDemand(t) + outsideDemand(t)-population(t))/delay. The total population stabilizes after a certain period due to fact that the outside demand, even if normally distributed remains constant for each city. It is in fact from this demand that the total population depends.

From the running of the model an interconnected organization results, where the distribution of the population among towns is power law.


First choose the number of tows in your urban system, then press SETUP to create the towns with a random population.

Set the TRANSPORTATION-COST-SLIDER to establish the transportation cost per unit of distance. The parameter beta in the evaluation of the distance effect is proportional to the transportation cost. In case the travel cost is greater than a threshold, any movement of population for purchasing is generated. The increase of transportation cost produces the decrease of inter-connectivity of the systems as well as of the total population due to the decrease in intercity exchanges.

Press GO to run the model. The connections will be established. There are a lot of connections among cities but only the first and secondary connections from one town to another are shown. To have a clearer view you can hide secondary connections.

The cumulative distribution of the population is shown in the log-log graph. If the points are distribute along a straight line, the population distribution is power law. The total population is shown in a graph.

The mouse can be utilized in two different ways that you can choose with the MOUSE-COMMAND-CHOOSER. If you choose SHOW DEPENDENT TOWNS, by clicking on a town with the left mouse button, the basin of attraction of the city is highlighted in yellow and the town shape changes from circular to squared (it looks like a constellation). By clicking in an empty region the normal vision is restored.
If you choose PERTURB THE SYSTEM by clicking with the mouse over a town the population of the town is decreased by the half, and you can evaluate the result of this action on the surrounding towns. In case you click over the greatest town, you may need more than one click to obtain the desired result, because the town, due to its attractivity recovers albeit instantaneously its previous population. Look also to the cumulative distribution which usually remains constant, being a macroscopic phenomenon, and to the total population which shows a sudden decrease and later recovers the lost population due to the perturbation.


The organization of the urban system depends on many factors: initial population, outside demand, and location. By trying different urban configurations wit the SETUP button, you can experiments different growth path. In addition by increasing the transportation cost you can watch the decrease of the greatest towns, later if you decrease the transportation cost you can see that not necessarily the same town as before will increase in population.


Try to edit the monitor and to allow horizontal and vertical wrapping. The dynamic without an established center appears as in the global urban system. To have a dynamic more similar to that it is in the reality increases the transportation cost and see the different disconnected urban systems which appear. Now you can try to disturb the system by clicking over a town, and see that the effects of the perturbation decreases as the transportation cost increases. Note that the transportation cost can be considered as the inverse of the "temperature" of the system.


The model cam attain a greatest degree of realism if a road network which is utilized o calculate the distances is included in the model. This allows the model to simulate the regional system of cities when the starting population instead that at random are set equal to the population at the beginning of the period that one wants to simulate.


The lists are utilized to store the calculated attraction and to establish the primary and secondary links with a sorting mechanism. To get the result a list of list is utilized. Lists are also utilized by each agents to store the id of the towns sending the in-coming most important fluxes.



This model is based on the paper: F. Semboloni, Hierarchy, cities size distribution and Zipf's law, The European Physical Journal B, 63, 295--301, 2008

To refer to this model in academic publications, please use: Semboloni (2009). NetLogo Urban System model. http://fs.urba.arch.unifi.it/netlogo/models/urbanSystem. Department of Town and Regional Planning University of Florence

Copyright 2011 Ferdinando Semboloni. All rights reserved.