dynatraffic – models and mathematical prognosis · – matrix representation – vector...

56
DynaTraffic – Models and mathematical prognosis Simulation of the distribution of traffic with the help of Markov chains

Upload: others

Post on 27-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

DynaTraffic – Models and mathematical prognosis

Simulation of the distribution of trafficwith the help of Markov chains

Page 2: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

2

What is this about?

• Models of traffic situations• Graphs:

– Edges, Vertices– Matrix representation– Vector representation

• Markov chains– States, transition probabilities– Special states: periodic, absorbing, or transient– Steady-state distribution

• Matrix vector multiplication

DynaTraffic help to understand and learn these concepts

Page 3: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

3

The goal: analysis of a traffic system

We are interested in this question:„How many cars are thereat a certain time on a lane?”

In order to be able to make statements about the development of a system, we need a model.I.e., first we build a model and then we control and observe this model.

Page 4: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

Mathematical prognosis step 1

Build a model of an everyday situation

Page 5: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

5

Photo from a side perspective

Page 6: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

6

Photo of the layout

© Google Imagery 2007

Page 7: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

7

Model of the layout, with cars

Page 8: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

8

Elements for the model without cars

Nodes

Arrows

What does your model look like?

Page 9: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

9

Model of the layout, without cars

Stop points nodesLanes edges

4

73

Page 10: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

10

Representation in DynaTraffic

4

73

- Characters to label lanes- Colored arrows and slightly different arrangement

Page 11: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

11

Models

• Why does one build models?– To better understand systems– Models are a useful tool to examine systems

• Definition of a model: A simplified representation used to explain the workings of a real world system or event.(Source: http://en.wiktionary.org/wiki/model)

• Mathematical Models try to capture the relevant parameters of natural phenomena and to use these parameters for predictions in the observed system.

Page 12: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

Mathematical prognosis step 2

Transformation of the model

Page 13: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

13

Why a transformation method?

We are concerned with traffic on single lanes and analyze the traffic with the help of a Markov model.

For that lanes must be verticesTransformation of the situation graph!

Page 14: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

14

Transformation recipe

Transformation of situation graph to line graph:• Each edge become a vertex.• There is an edge between two vertices, if one

can change from one lane to the other in the traffic situation.

• Each vertex has an edge to itself.

Page 15: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

15

Transformation step a)

Each edge becomes a vertex.

Page 16: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

16

Transformation step b)

There is an edge between two vertices, if one can change from one lane to the other in the traffic situation.

Page 17: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

17

Transformation step c)

Each vertex has an edge to itself.I.e.: a car can remain on a lane!

Page 18: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

18

The good news concerningthis transformation ☺

We do not need to do this transformation, it is already done in DynaTraffic. But we should understand it…

Situation graph Line graph to the situation graph

Page 19: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

Mathematical prognosis step 3

Define assumptions

Page 20: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

20

Define the process

• Every 10 seconds, each car takes a decision with a certain probability (so-called transition probability):– „I change to another lane“– „I remain on this lane“

• The realization of decisions is called a transition: cars change their state, if necessary.

Page 21: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

21

The transition graph

The transition probabilities areentered in the line graph

Transition graph (= Markov chain)

Page 22: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

22

Our Markov chain

The vertices represent possible states, i.e., lanes on which a car can be.The edges show to which other lanes a car can change from each lane.

Page 23: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

23

Meaning ofthe transition probability?

„If there is a car onlane A now, it will inthe next transitionchange to lane Bwith a probabilityof 83%.

Page 24: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

24

Alternative representationof the transition graph

Transition graph Transition matrix

Page 25: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

25

How to read the transition matrix

From

To

Page 26: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

26

Empty entries inthe transition matrix?

If an edge does not exist, there is a 0 in the transition matrix at the corresponding entry.

Page 27: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

27

Summary:our traffic model

Photo Model with cars

Model without cars

Transition graphTransition matrix

Page 28: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

28

Summary:our traffic model

Photo Model with cars

Model without cars

Transition graphTransition matrix

Step 1: build a model of an everyday situation

Step 2

: tran

sform

ation

of th

e mod

el

Step 3: define assumptions

Page 29: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

29

Demo DynaTraffic

Page 30: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

30

Our Markov chain again

The vertices represent possible states, i.e., lanes on which a car be.The edges show on which other vertices a car can change from one vertex, and with which probability this happens per transition.

Page 31: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

31

„Do a transition“?

To calculate how many cars there are going to be on a certain lane, one needs:

– The number of cars on the individual lanes.– The probabilities leading to the certain lane.

Page 32: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

32

How many cars are on lane Aafter the next transition?

Cars on individual lanes:A: 3 carsB: 4 carsC: 7 cars

Probabilities leading to lane A:A A : 0.17C A : 0.83

Calculation:3 * 0.17 + 7 * 0.83 = 6.32 cars

Page 33: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

33

Probabilities for transitions

The required probabilities can directly be read from the transition matrix!

3 * 0.17 + 7 * 0.83 = 6.32 cars

Page 34: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

34

State vector

The number of cars per lane in the state vector notation

Page 35: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

35

Calculate transitions

As seen: Multiplication of the first row of the transition matrix with the current number of cars on the first lane (= second entry of the state vector) gives the new number of cars on the first lane.

Page 36: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

36

Calculate transitions compactly

With a matrix vector multiplication a transition can be calculated at once for all lanes!

Page 37: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

37

Matrix vector multiplication

+ + + + =

Page 38: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

38

Properties of transition graphs

Based on the transition probabilities, certain states of a transition graph can be classified. States can be absorbing, periodic, or transient.There are further steady-state distributions and irreducible transition graphs.

Page 39: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

39

Absorbing state

A state which has no out-going transitionwith positive probability

Over time all cars conglomerate there!

Where does this happen with real traffic?- Junkyard- dead-end one-way street ;-)

Page 40: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

40

Periodic states

States take periodically the same values

Traffic oscillates between certain states.

Where are such streets in everyday life?- e.g. between work and home

Page 41: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

41

Transient state

A state to which a care cannever return.

Page 42: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

42

Irreducible transition graph

Each state is reachable from every other state.

Page 43: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

43

Is the following graph irreducible?

No! (State D is not reachable from every other state!)

Which transition probabilites couldbe changed in order to make this graph ireducible?

Page 44: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

44

Properties of the transition matrix

Column sum = 1: stochastic matrix

Column sum ≠ 1:

Column sum < 1:total number of cars goes toward 0

Column sum > 1:total number of cars grow infinetly

Page 45: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

45

Steady-state distribution

If a transition graph is irreducible and does not have periodic states, then the system swings into a steady-state distribution, independently of the initial state.

Page 46: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

46

Notation of transition probabilities

„The probability to change fromvertex A to vertex B is 10%”

P(A, B) = 0.1

Page 47: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

47

Summary

Properties of states:– Periodic: Cars move to and fro.– Absorbing: All cars are finally there.– Transient: A car never returns there.

Transitions graphs can be irreducible: Cars can change from every state to every other state.

Distributions can be steady-state: the system has swung into.

Page 48: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

48

Models and their limitations

Lanes can hold a infinitely large number of cars in our model. This is not realistic!

Therefore:– Simulation stops, of > 2000 cars on a lane.– In the upper-limit mode a individual upper limit

(< 2000) can be defined per lane.

Page 49: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

49

The upper-limit mode

Possible application: Different parking areas. Cars should fill the parking areas C, D, and E in this order.

Page 50: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

50

Layout of parking areas in DynaTraffic

Upper limits of lanes are displayed

Page 51: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

51

Process upper-limit:lane C reached its capacity

Set all edges incident to C to 0.No more cars should arrive.

This is not a stochastic matrix any more!Columns must be normalized.

Page 52: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

52

Process upper-limit:lane C is unlocked again

Original row of the lane is reestablishedOnly outgoing edges are reestablished:This is ok for all vertices.Normalize column sum.

Page 53: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

53

What is this about?

• Models of traffic situations• Graphs:

– Edges, Vertices– Matrix representation– Vector representation

• Markov chains– States, transition probabilities– Special states: periodic, absorbing, or transient– Steady-state distribution

• Matrix vector multiplication

DynaTraffic help to understand and learn these concepts

Page 54: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

54

Summary

We model and analyze a traffic system with the help of Markov chains.– How does the traffic distribution evolve?– Does the system swing into?

Like this we can make predictions about the system based on our Markov model!

Page 55: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

55

DynaTraffic

Situationgraph

Transitiongraph

Statestatistics

Transition matrix& state vector

Control of transitions

Page 56: DynaTraffic – Models and mathematical prognosis · – Matrix representation – Vector representation • Markov chains – States, transition probabilities – Special states:

56

Demo DynaTraffic