The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.
powered by NetLogo
view/download model file: hitchhiking_against_traffic_jam.nlogo
The model simulates the dynamics of Jungo, a system based on a modern vision of hitch-hiking. Every Jungo-person has a card that identifies herself and allows her to obtein a passage from a Jungo-motorist who partecipates to the system.
Our aim is to monitoring the average of wait time and of travel in order to valuate the efficiency of this possible alternative movement.
There are two agentsets: cars and people. Jungo-cars and Jungo-people are orange while other agents are blue. Cars can move only into roads, while people move randomly on sidewalk. When Jungo-people want a passage, they go into roads and ask it. If there is a Jungo-car, it stops and puts the passenger into itself. After the travel, the passenger goes at work, changing her color in yellow, and then ask a new passage.
It is important to underline that every car can have a maximum of four passengers, indeed the car becomes green when it is occupied by a person at least. If the car is full, it does not stop.
There is a mechanism of diffusion, that allows blue agents to become Jungo.
Indeed, when blue people meet Jungo ones, after ten times, they become Jungo too and, when a new Jungo person meets a blue car, this one becomes Jungo.
Start the simulation by clicking "Setup". Then, after clicking "Go", the turtles start moving and interacting in the way explained above. If you want to stop the simulation, you have to click again the "Go" button. Instead, if you click "Go-on-tick", the model runs the simulation for only a tick.
Button: Setup
It creates turtles and resets everything to the beginning values.
Button: Go
It starts the simulation.
Button: Go-on-tick
It allows to run the model on step.
Slider: Num-cars
It allows to choose the number of blue cars.
Slider: Num-jungo-cars
It allows to choose the number of Jungo-cars.
Slider: Num-people
It allows to choose the number of blue people.
Slider: Num-jungo-people
It allows to choose the number of Jungo-people.
Monitor: Jungo People Diffusion
It shows how many people become Jungo.
Monitor: Jungo Cars Diffusion
It shows how many cars become Jungo.
Plot: Average Waiting Time
It represents the average of Jungo-people wait time.
Plot: Average Travel Number
It represents the average of travel that Jungo people do during the simulation.
It is important to notice that only Jungo-people have active this variables:
"wait-time": when they are waiting for a passage;
"time-on-cars": when they are doing a travel;
"travel": that count the number of travel done;
"time-at-work": when they are yellow and have just done a travel.
It is interesting to modify the values of the sliders for analyse the average of waiting time, the average of travels done and the phenomenon of diffusion.
It could be interesting find a mechanism that shows that the number of cars decreases as a consequence of the diffusion because some motorists prefer to become Jungo-people and, not using their cars, they occupate free car seats of other vehicles.
This has as a result the decreasing of traffic with well-being for society.
Traffic Grid from NetLogo Library.
Jungo website; http://www.jungo.it/
globals [ roads ;; patches with white color ] breed [ houses house ] breed [ trees tree ] breed [ cars car ] breed [ people person ] cars-own [ passenger ;; passenger on cars ] people-own [ wait-time ;; waiting time for a passage time-on-cars ;; lenght of the passage time-at-work ;; time between time-on-cars and wait-time travel ;; number of passage done meet ;; number of meeting between pedestrian and jungo-person ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SETUP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to setup ca setup-patches setup-roads setup-houses setup-trees setup-cars setup-people do-plots end to setup-patches ask patches [ set pcolor gray + 3 if ((pxcor > 6) and (pxcor < 12) and (pycor < -12) and (pycor > -17)) ;;the greeen section is the park [set pcolor green + 2] ] end to setup-roads ask patches with [ pycor >= -13 and pycor <= -12] ;; the first horizontal street from the bottom [set pcolor white] ask patches with [ pycor >= 0 and pycor <= 1] ;; the central horizontal street [set pcolor white] ask patches with [ pycor >= 12 and pycor <= 13] ;; the last horizontal street from the bottom [set pcolor white] ask patches with [ pxcor >= -13 and pxcor <= -12] ;; the vertical street on the left [set pcolor white] ask patches with [ pxcor >= 0 and pxcor <= 1] ;; the central vertical street [set pcolor white] ask patches with [ pxcor >= 12 and pxcor <= 13] ;; the vertical street on the right [set pcolor white] set roads patches with [ pcolor = white ] ;; all street have white color end to setup-houses set-default-shape houses "house" create-houses 2 ask houses [ set size 3 put-on-intersection-1 put-on-intersection-2 ] end to put-on-intersection-1 ;; yellow house represents a house ask house 0 [ move-to one-of patches with [ pxcor = -10 and pycor = 3 ] set color yellow] end to put-on-intersection-2 ;; brown house represents a school ask house 1 [ move-to one-of patches with [ pxcor = 10 and pycor = 3 ] set color brown] end to setup-trees ;; these are the trees in the park set-default-shape trees "tree" create-trees 4 ask trees [ set color green - 2 set size 2 move-to one-of patches with [ pcolor = green + 2 ]] end to setup-cars set-default-shape cars "car top" create-cars Num-cars ;; Cars not Jungo. [ set color sky + 2 set size 1.8 set passenger 0 ] create-cars Num-jungo-cars ;; Jungo Cars. [ set color orange set size 1.9 set passenger 0 ] ask cars [ if ((heading >= 0) and (heading < 90)) ;; all Cars have a direction. [ move-to one-of roads with [pxcor = -12 or pxcor = 1 or pxcor = 13] ;; when their direction is north or north-east they go to NORTH. set heading 0] if ((heading >= 90) and (heading < 180)) ;; when their direction is east or south-east they go to EAST. [ move-to one-of roads with [pycor = -13 or pycor = 0 or pycor = 12] set heading 90] if ((heading >= 180) and (heading < 270)) ;; when their direction is south or south-west they go to SOUTH. [move-to one-of roads with [pxcor = -13 or pxcor = 0 or pxcor = 12] set heading 180] if ((heading >= 270) and (heading < 360)) ;; when their direction is west or north-west they go to WEST. [move-to one-of roads with [pycor = -12 or pycor = 1 or pycor = 13] set heading 270] ] end to setup-people set-default-shape people "person" create-people Num-people ;; People not Jungo. [ set color blue - 1 set size 1.3 set wait-time 0 set time-on-cars 0 set time-at-work 0 set travel 0 set meet 0 ] create-people Num-jungo-people ;; Jungo People. [ set color orange + 1 set size 1.3 set wait-time 0 set time-on-cars 0 set time-at-work 0 set travel 0 set meet 0 ] ask people ;; People must stay only on sidewalk. [move-to one-of patches with [pcolor != white] if(color = orange + 1) ;; Jungo people have a "label" that represents the number of steps that [set label (random 15) ;; they want to do on car. set label-color black if label = 0 [set label 1]] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RUNNING PROCEDURE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go move-cars move-people tick do-plots end to move-cars ask cars ;; it allows the movement of all Cars. [ifelse (not any? cars-on patch-ahead 1) ;; when there is not a car in front, she must step forward [fd 1] ;; otherwise step back. [fd -1] ] ask cars with [color = orange] ;; when Jungo Car meets a Jungo Person, she must stop and put [if (any? people-here with [color = orange + 1] and (passenger < 4)) ;; the person on but only if she has less than 4 passengers. [wait 1 set passenger (passenger + 1)] ;; when Jungo Car has a passenger, she notes an additional passenger. if((passenger = 4) and (any? people-here with [color = orange + 1])) ;; when Jungo Car has 4 passengers, she does not stop even if [fd 1] ;; there is a Jungo Person. if (passenger >= 1) ;; when Jungo Car has a passenger at least, she becomes lime. [set color lime]] ask cars with [color = lime] [if (any? people-here with [color = orange + 1] and (passenger < 4)) [wait 1 set passenger (passenger + 1)] if((passenger = 4) and (any? people-here with [color = orange + 1])) [fd 1] ] ask cars with [color = sky + 2] ;; JUNGO DIFFUSION: when Cars not Jungo meet a Person that has become Jungo, [ if (any? people-here with [label-color = white]) ;; they become Jungo too. [set color orange]] end to move-people ask people with [color = blue - 1] [ move-to one-of patches with [ pcolor != white ] ;; People not Jungo must go only on sidewalk. if(any? people-here with [color != blue - 1]) ;; JUNGO DIFFUSION: when People not Jungo meet a Jungo Person for ten times, [set meet (meet + 1)] ;; they become Jungo too and they take a "label" as old Jungo if (meet = 10) ;; People. This label has a different color: white instead of black. [set color orange + 1 set label (random 15) if(label = 0) [set label (random 15)] set wait-time 0 set time-on-cars 0 set time-at-work 0 set travel 0] ] ask people with [color = orange + 1] ;; Jungo People can go into street to ask for a passage. [every 1 [set wait-time (wait-time + 1)] ifelse [pcolor] of patch-here != white [fd 1] [if ((any? cars-here with [color = orange] with [passenger < 4]) ;; when there is a Jungo Car (with color orange or color lime) with less than 4 passengers, or (any? cars-here with [color = lime] with [passenger < 4])) ;; they become red and invisible. [move-to one-of cars-here set color red hide-turtle ask cars with [color = orange and passenger < 4] [set passenger (passenger + 1)] set wait-time 0] if not (any? cars-here with [color = orange] with [passenger < 4]) ;; when People do not find a Jungo Car, they come back for a step and [back 1 ;; change their direction ramdomly. set heading (random (3 * 90))]] ] ask people with [color = red] ;; in this moment Jungo Person is like on Car, so she activates the counter time-on-cars [ set time-on-cars (time-on-cars + 1) if(label = time-on-cars) ;; when time-on-cars is equal to her label, she gets out, stops the counter time-on-cars [move-to one-of neighbors with [pcolor != white] ;; and notes an additional number of travel. set travel (travel + 1) set time-on-cars (time-on-cars) ask cars with [color = lime and passenger <= 4] ;; when passenger gets out, Jungo Car subtracts a passenger. [ if(passenger = 4) [set passenger 3] if(passenger = 3) [set passenger 2] if (passenger = 2) [set passenger 1] if (passenger = 1) [set passenger 0 set color orange]] set color yellow ;; when Jungo People get out, they take color yellow and become visible. show-turtle] ] ask people with [color = yellow] [ set time-at-work (time-at-work + 1) ;; when People have color yellow we assume that they are working. The counter if (label = time-at-work) ;; time-at-work starts and has a duration equal to their label. Then when the counter [set color orange + 1 ;; stops, they become orange and start again to ask for a passage. set time-at-work 0] set wait-time 0 set time-on-cars 0 ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PLOTTING ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to do-plots ;; we compute the average of the variables "wait-time" and "travel". plot-new-value "Average Waiting Time" mean [ wait-time ] of people with [color = orange + 1] plot-new-value "Average Travel Number" mean [travel] of people with [color != blue - 1] end to plot-new-value [ name-of-plot value ] set-current-plot name-of-plot plot value end