Upload
priscilla-willett
View
214
Download
2
Tags:
Embed Size (px)
Citation preview
Got Gas?Got Gas?
Jim and MichaelJim and Michael
Problem Statement (Weight 15%)Problem Statement (Weight 15%)
• An investigation of a gas pump queue as a function of rationing policy
• We modeled the queue at a gas station specifically during a gas crisis in which the number of gallons in a single purchase is limited.
Mathematical/Algorithmic Model Mathematical/Algorithmic Model (Weight 25%)(Weight 25%)
• Queue length was modeled by following a decision making matrix that was created using fixed quantities for amount of gas in a tank. Later matrix was improved to use percentages since agents have varying gas tank capacities.
Mathematical/Algorithmic Model Mathematical/Algorithmic Model (Weight 25%) - cMap(Weight 25%) - cMap
Agent-Based Model (Weight 25%)Agent-Based Model (Weight 25%)
• Gas Crisis 1973– Know 2-3 hour wait
– Know purchase limited to 10 gallons• Agent never join queue if tank is > 50%
as per policy
– Know MPG was 14 MPG
– Model functions as expected
Agent-Based Model (Weight 25%)Agent-Based Model (Weight 25%)
• If gas crisis today – what would happen?– Know mpg = 24 (2004)– Fewer gas station– Faster checkout – pay at pump and no full-
service– Based on model queue wait time would be
longer at 5 gallons per fill up
Agent-Based Model (Weight 25%)Agent-Based Model (Weight 25%)
• Is the agent-based model a reasonable representation of the problem?– We believe that it does based on its reflection of the 1973
situation.
• Does the model provide insight into the problem? – Yes, it demonstrates that improved MPG would minimize
wait times.
• Can anything be learned from the model? – Continued investment in improving MPG or alternates to
gas purchases (public transportation alternative fuels) will continue to erode the effect of gas pump queue lines.
Agent-Based Model (Weight Agent-Based Model (Weight 25%)25%)
Factors modeled– Various tank sizes– Various initial states – Average miles per gallon– Varied number of cars to
fix demand– Agents have various
sizes of tanks
Decision to join queue based on – fuel state– line length – policy
• Does the team understand the agent’s states and behaviors, and the role of the environment? In particular, does the team understand how the agents affect each other and/or modify their environment?– Used agents to generate demand and represent
queue length
Agent-Based Model (Weight 25%)Agent-Based Model (Weight 25%)
• Assumptions– One pump– 50 miles of road– 15 cars – Decision to get in line depends on number of
people in queue
• Limitations– Driving habits– Option for alternative transportation
Results & Conclusions (Weight Results & Conclusions (Weight 15%)15%) - G - Graphsraphs
Average Wait Time With 1973 Fuel Efficency
0102030405060708090
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5
Amount of Gas Available
Wai
t Tim
ee
Average Wait Time With Modern Fuel Efficency
0
5
10
15
20
25
30
20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5
Amount of Gas Available
Wai
t Tim
ee
Results & Conclusions (Weight Results & Conclusions (Weight 15%)15%)
• Limiting the amount of gas per purchase did not have a significant impact until quantities were reduced to below 10 gallons.
• One factor that is not modeled is anxiety. We believe that the long lines at the pump are more a result of concern about future availability at current prices.
Code (Weight 10%)Code (Weight 10%)
Globals [queue totWait totVisit ]
turtles-own [gas done tanksize waittime waithold visits]
to setup
ca
set totVisit 0
set queue 0
set gasPlus 20
ask patches [ setup-road ]
setup-cars
open-file
end
Code (Weight 10%)Code (Weight 10%) - This function - This function draws the roadsdraws the roads
to setup-road ;; patch procedure if ( pycor < 4. ) and ( pycor > 1 ) [ set pcolor white
] ; upper road if ( pycor < -1 ) and ( pycor > -4 ) [ set pcolor
white ] ; lower road if ( pycor = 0 ) and ( pxcor = 48 ) [set pcolor
green] ; gas station if ( pycor = -4 ) and ( pxcor = 47 ) [set pcolor grey
] ; gas pumpend
Code (Weight 10%)Code (Weight 10%) - This function - This function creates the carscreates the cars
to setup-cars set-default-shape turtles "car" crt numcars [ set color 10 + random 130 set visits 0 set waittime 0 set done -1 set tanksize 10 + random 12 set gas 2.5 + random 7.5 ; various amounts of gas at start setxy random 50 3 ; spreads out cars along road set heading 90 ; cars drive east set label gas ; tells how many gallons each car has separate-cars ] ; set sample-car one-of turtles ; ask sample-car [ set color red ]end
Code (Weight 10%)Code (Weight 10%) - This function - This function spreads the cars outspreads the cars out
; this function is needed so when we click "Setup" we; don't end up with any two cars on the same patchto separate-cars ;; turtle procedure if any? other turtles-here [ fd 1 ; 1 separate-cars ]end
; this function is needed so when we click "go" we; don't end up with any two cars on the same patchto separate-queque ;; turtle procedure if any? other turtles-here [ bk 1 separate-queque ]end
Code (Weight 10%)Code (Weight 10%) - This function - This function is an envelope for the loopis an envelope for the loop
to master
start
if gasPlus < 5 [ printout file-close stop]
end
Code (Weight 10%)Code (Weight 10%) - This function - This function runs each iterationruns each iteration
to start tick ask turtles [go] if totvisit > 0 [ plot (totwait / totvisit) ] if ticks > 2500 [ printout type gasPlus type " " print (totwait / totvisit) set gasPlus gasPlus - 1 reset-ticks set totvisit 0 set totwait 0 ]end
Code (Weight 10%)Code (Weight 10%) - Allows cars - Allows cars to know if they are in line to know if they are in line
to Go ifelse ([pcolor] of (patch-at 1 3)) = 55 ; Am at the pump? [ ;Yes I am set done (done + 1) if done > 9 [ ; I’m done I need to leave the pump>> setxy 49 3 set done 0 set gas (gas + gasplus) set queue (queue - 1) set totwait totwait + (waittime - waithold) set totvisit totvisit + 1 if gas > tanksize [set gas tanksize ] ;don't overflow tank ] ] [ ; I am not at the pump if ycor = -3 [set waittime (waittime + 1) ] fd 1 if any? other turtles-here [bk 1] ]
Code (Weight 10%)Code (Weight 10%) - Continuation - Continuation of Go for cars on roadof Go for cars on road
ifelse ( ([pcolor] of patch-at 1 -3) = 55 ) ;is the gas station close?
[ shouldI ]
[ move ]
end
Code (Weight 10%)Code (Weight 10%) - Moves cars - Moves cars if they are driving – using gasif they are driving – using gas
to move if gas > 0 [ if ycor != -3 [fd 1 set gas (gas - ( factor / mipg ))]
;move consuming gas ;show (sentence precision gas 2 tanksize
precision (gas / tanksize) 2 waittime totwait totvisit ) ;tell us percent of gas left in tank
]end
Code (Weight 10%)Code (Weight 10%) - THE - THE MATRIXMATRIX
to shouldI ifelse ( gas / tanksize ) > .5 [move] [ ifelse ( gas / tanksize ) > .25 and queue > 5 [move] [ ifelse gas > 2.5 and queue > 10 [move] [getInLine] ] ]end
Code (Weight 10%)Code (Weight 10%) - Moves cars - Moves cars to Queueto Queue
to getInLine
set visits (visits + 1)
set waithold waittime
setxy 40 -3 ; move to the queue road
set queue (queue + 1) ; increase the queue count
separate-queque ; keeps cars seperate in line
end
Code (Weight 10%)Code (Weight 10%) - Creates a - Creates a CSV file and creates headersCSV file and creates headers
to open-file let file "output1.csv" ;user-new-file if ( file != false ) [ if ( file-exists? file ) [ file-delete file ] file-open file ] file-print (word "Gas Plus,Number of Cars,Wait
time,Visits,Average")end
Code (Weight 10%)Code (Weight 10%) - Adds data to - Adds data to CSV file for each iterationCSV file for each iteration
to printout
let average (totWait / (totVisit + .000001) )
; file-print (word "Gas Plus,Number of Cars,Wait time,Visits,Average")
file-print (word gasPlus "," numcars ","totWait","totVisit "," average ) ;
end
Code (Weight 10%)Code (Weight 10%) - - Sample CSV Sample CSV filefile
Code (Weight 10%)Code (Weight 10%) - - Real-time Real-time demo demo
Got Gas-G.nlogo
Display (Weight 10%)Display (Weight 10%)
We recognize that time is limited and we may have skipped something, so we
would like to take this opportunity to ask if there are any questions or parts of the presentation that need to be repeated?
f u wn2 mEt ppl, travL, n lern hw
vid gmes r md C d comp teacha