fitness â , simulated with those rules ... a language for defining rules applicable to the m
Road Traffic Rules Synthesis using Grammatical Evolution Eric Medvet
Alberto Bartoli
Jacopo Talamini
Department of Engineering and Architecture University of Trieste Italy
EvoAPPS, 19/4/2017, Amsterdam (The Netherlands)
http://machinelearning.inginf.units.it
Driving Human driver (now)
Medvet et al. (UniTs)
Road traffic rules with GE
2 / 21
Driving Human driver (now)
Medvet et al. (UniTs)
Driverless car (the future)
Road traffic rules with GE
2 / 21
Driving Human driver (now)
Driverless car (the future)
Both try to: get there avoid accidents comply to the rules
Medvet et al. (UniTs)
Road traffic rules with GE
2 / 21
Driving Human driver (now)
Driverless car (the future)
Both try to: get there avoid accidents comply to the rules Are those rules “optimal” for both? Medvet et al. (UniTs)
Road traffic rules with GE
2 / 21
Re-writing the rules
If we could re-write the rules from scratch, we’d want the rules leading to high traffic efficiency (getting there) and high safety (avoiding accidents) How to write those rules?
Medvet et al. (UniTs)
Road traffic rules with GE
3 / 21
Re-writing the rules
If we could re-write the rules from scratch, we’d want the rules leading to high traffic efficiency (getting there) and high safety (avoiding accidents) How to write those rules? Our solution: write the rules automatically with an evolutionary approach
Medvet et al. (UniTs)
Road traffic rules with GE
3 / 21
In a nutshell
Evolutionary approach: individual → set of rules fitness → hefficiency, safetyi, simulated with those rules
Medvet et al. (UniTs)
Road traffic rules with GE
4 / 21
In a nutshell
Evolutionary approach: individual → set of rules fitness → hefficiency, safetyi, simulated with those rules Our contributions: 1
a model for traffic simulation, suitable for our scenario
2
a language for defining rules applicable to the model
3
a GE-based framework for automatic rules generation, with experimental evaluation
Medvet et al. (UniTs)
Road traffic rules with GE
4 / 21
The traffic model
Table of Contents
1
The traffic model
2
Language for rules
3
GE-based rules generation
4
Experimental evaluation
Medvet et al. (UniTs)
Road traffic rules with GE
5 / 21
The traffic model
The traffic model
Goals (and trade-offs): detailed enough to include concepts amenable to be regulated simple enough to allow for simulation Describes: the physical world the drivers’ behavior
Medvet et al. (UniTs)
Road traffic rules with GE
6 / 21
The traffic model
Physical world Infrastructure: road sections and intersections lanes in sections Cars: position (continuous longitudinally, discrete on lanes) speed status (in {alive, dead}) Collisions With discrete time
Medvet et al. (UniTs)
Road traffic rules with GE
7 / 21
The traffic model
Drivers’ behavior The driver’s algorithm: input: view ahead, speeds, distance to travel output: a list A of actions ↑: accelerate ←: move on left lane . . . and so on (↑, %, →, &, ↓, ., ←, -)
Medvet et al. (UniTs)
Road traffic rules with GE
8 / 21
The traffic model
Drivers’ behavior
Goal: just travel a target distance, no specific target position possibly at maximum (car) speed avoiding hitting other cars
Medvet et al. (UniTs)
Road traffic rules with GE
9 / 21
The traffic model
Drivers’ behavior and rules
The rules-aware driver’s algorithm: input: a list A of actions and a set R of rules output: the first action a ∈ A which breaks the lowest number of rules
Medvet et al. (UniTs)
Road traffic rules with GE
10 / 21
The traffic model
Drivers’ behavior and rules
The rules-aware driver’s algorithm: input: a list A of actions and a set R of rules output: the first action a ∈ A which breaks the lowest number of rules Why driver and rules-aware driver? model the driver’s “instinct” to perform his favorite action with no rules: “I drive as I like” with rules: “among preferred actions, I choose a permitted one”
Medvet et al. (UniTs)
Road traffic rules with GE
10 / 21
Language for rules
Table of Contents
1
The traffic model
2
Language for rules
3
GE-based rules generation
4
Experimental evaluation
Medvet et al. (UniTs)
Road traffic rules with GE
11 / 21
Language for rules
Rules
Rule: each rule is a predicate at a given time, for a given rule, a car breaks (false) or does not break (true) the rule Works on: the car status (speed, position in section/intersection, . . . ) other cars relative distances and speeds current section/intersection
Medvet et al. (UniTs)
Road traffic rules with GE
12 / 21
Language for rules
Language for the rules As a context-free grammar: r ::= hconditionsi hconditionsi ::= hconditioni | hconditionsi ∨ hconditioni hconditioni ::= hbaseConditioni | ¬hbaseConditioni hbaseConditioni ::= hnumericConditioni | hdeltaConditioni | hgraphConditioni hnumericConditioni ::= hnumericVariablei ≤ hnumericValuei hnumericVariablei ::= vˆx | vmax | v∆ | dview | d | xˆ | yˆ | ∆x−1 | ∆x0 | ∆x1 | l(p) | w (p) hnumericValuei ::= hdigiti.hdigitiehexpi hdigiti ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 hexpi ::= −1 | 0 | 1 hdeltaConditioni ::= δv−1 = hdeltaValuei | δv0 = hdeltaValuei | δv1 = hdeltaValuei hdeltaValuei ::= ∅ | opposite | − 1 | 0 | 1 hgraphConditioni ::= p ∈ S
Medvet et al. (UniTs)
Road traffic rules with GE
13 / 21
Language for rules
Language for the rules As a context-free grammar: r ::= hconditionsi hconditionsi ::= hconditioni | hconditionsi ∨ hconditioni hconditioni ::= hbaseConditioni | ¬hbaseConditioni hbaseConditioni ::= hnumericConditioni | hdeltaConditioni | hgraphConditioni hnumericConditioni ::= hnumericVariablei ≤ hnumericValuei hnumericVariablei ::= vˆx | vmax | v∆ | dview | d | xˆ | yˆ | ∆x−1 | ∆x0 | ∆x1 | l(p) | w (p) hnumericValuei ::= hdigiti.hdigitiehexpi hdigiti ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 hexpi ::= −1 | 0 | 1 hdeltaConditioni ::= δv−1 = hdeltaValuei | δv0 = hdeltaValuei | δv1 = hdeltaValuei hdeltaValuei ::= ∅ | opposite | − 1 | 0 | 1 hgraphConditioni ::= p ∈ S
Goal: express realistic rule like “stay on rightmost free lane” Medvet et al. (UniTs)
Road traffic rules with GE
13 / 21
GE-based rules generation
Table of Contents
1
The traffic model
2
Language for rules
3
GE-based rules generation
4
Experimental evaluation
Medvet et al. (UniTs)
Road traffic rules with GE
14 / 21
GE-based rules generation
GE
We have: the fitness (traffic efficiency and safety) the solution space (as a context-free grammar)
⇓ GE is the right tool!
Medvet et al. (UniTs)
Road traffic rules with GE
15 / 21
GE-based rules generation
Fitness Traffic efficiency
Traffic safety
Medvet et al. (UniTs)
Road traffic rules with GE
16 / 21
GE-based rules generation
Fitness Traffic efficiency → average speed ratio (ASR) 1 1 X dtot 1 1− nsim ncar cars ktot vmax Traffic safety → 1 − collision-per-time (CpT) 1
1 X ncollision nsim ncar cars ktot
Minimize a linear combination: f (R) = αtime (1 − ASR) + αcollision CpT
Medvet et al. (UniTs)
Road traffic rules with GE
16 / 21
GE-based rules generation
Fitness Traffic efficiency → average speed ratio (ASR) 1 1 X dtot 1 1− nsim ncar cars ktot vmax Traffic safety → 1 − collision-per-time (CpT) 1
1 X ncollision nsim ncar cars ktot
Minimize a linear combination: f (R) = αtime (1 − ASR) + αcollision CpT Computed over many (nsim ) simulations (stochasticity) Medvet et al. (UniTs)
Road traffic rules with GE
16 / 21
Experimental evaluation
Table of Contents
1
The traffic model
2
Language for rules
3
GE-based rules generation
4
Experimental evaluation
Medvet et al. (UniTs)
Road traffic rules with GE
17 / 21
Experimental evaluation
Goals Traffic model: is it sound? find values for parameters
Medvet et al. (UniTs)
Road traffic rules with GE
18 / 21
Experimental evaluation
Goals Traffic model: is it sound? find values for parameters GE-based rules generation: are generated rules better than no rules? are generated rules better than hand-written rules?
Medvet et al. (UniTs)
Road traffic rules with GE
18 / 21
Experimental evaluation
Goals Traffic model: is it sound? find values for parameters GE-based rules generation: are generated rules better than no rules? are generated rules better than hand-written rules? For both: how does injected traffic affect efficiency and safety? congestion: no further increase in overall traveled distance
Medvet et al. (UniTs)
Road traffic rules with GE
18 / 21
Experimental evaluation
Traffic model validation
1 0.8 0.6 0.4 0.2 0
CpT (Safety)
1 − ASR (Efficiency)
5 road sections, up to tens of cars, values averaged on 10 simulations
Low efficiency
High efficiency 0 ncar
10 20 (injected traffic)
Medvet et al. (UniTs)
1 0.8 0.6 0.4 0.2 0
·10−2 Low safety
High safety 0
Road traffic rules with GE
ncar
10 20 (injected traffic)
19 / 21
Experimental evaluation
Traffic model validation
1 0.8 0.6 0.4 0.2 0
CpT (Safety)
1 − ASR (Efficiency)
5 road sections, up to tens of cars, values averaged on 10 simulations
0 ncar
10 20 (injected traffic)
low ncar high ncar Medvet et al. (UniTs)
1 0.8 0.6 0.4 0.2 0
·10−2
0 ncar
10 20 (injected traffic)
No rules Efficiency Safety high high low low
Road traffic rules with GE
19 / 21
Experimental evaluation
Traffic model validation
1 0.8 0.6 0.4 0.2 0
CpT (Safety)
1 − ASR (Efficiency)
5 road sections, up to tens of cars, values averaged on 10 simulations
0 ncar
10 20 (injected traffic)
low ncar high ncar Medvet et al. (UniTs)
No rules Efficiency Safety high high low low
1 0.8 0.6 0.4 0.2 0
·10−2
0 ncar
10 20 (injected traffic)
Hand-written rules Efficiency Safety < ' ' >
Road traffic rules with GE
19 / 21
Experimental evaluation
Traffic model validation
1 0.8 0.6 0.4 0.2 0
CpT (Safety)
1 − ASR (Efficiency)
5 road sections, up to tens of cars, values averaged on 10 simulations
0 ncar
10 20 (injected traffic)
low ncar high ncar
No rules Efficiency Safety high high low low
1 0.8 0.6 0.4 0.2 0
·10−2
0 ncar
10 20 (injected traffic)
Hand-written rules Efficiency Safety < ' ' >
Rules → lower efficiency, higher safety: sound! Medvet et al. (UniTs)
Road traffic rules with GE
19 / 21
Experimental evaluation
GE-based rules generation
1 0.8 0.6 0.4 0.2 0
CpT (Safety)
1 − ASR (Efficiency)
30 runs, each with a 100 individuals, 100 generations
0 ncar
10 20 (injected traffic)
Medvet et al. (UniTs)
1 0.8 0.6 0.4 0.2 0
·10−2
0
Road traffic rules with GE
ncar
10 20 (injected traffic)
20 / 21
Experimental evaluation
GE-based rules generation
1 0.8 0.6 0.4 0.2 0
CpT (Safety)
1 − ASR (Efficiency)
30 runs, each with a 100 individuals, 100 generations
0 ncar
10 20 (injected traffic)
Best GE rules
1 0.8 0.6 0.4 0.2 0
·10−2
0 ncar
10 20 (injected traffic)
:
slightly higher efficiency higher safety
Medvet et al. (UniTs)
Road traffic rules with GE
20 / 21
Experimental evaluation
Congestion
Overall collisions
Bad 200
100
Good 0
0
2 4 6 Overall distance ·104
Medvet et al. (UniTs)
Road traffic rules with GE
21 / 21
Experimental evaluation
Overall collisions
Congestion
One mark for each ncar value
200
100
0
0
2 4 6 Overall distance ·104
Medvet et al. (UniTs)
Road traffic rules with GE
21 / 21
Experimental evaluation
Overall collisions
Congestion
One mark for each ncar value
200
Congestion: increasing injected traffic does not increase overall distance
100
0
0
2 4 6 Overall distance ·104
Medvet et al. (UniTs)
Road traffic rules with GE
21 / 21
Experimental evaluation
Overall collisions
Congestion
One mark for each ncar value
200
Congestion: increasing injected traffic does not increase overall distance
100
GE vs. hand-written at congestion: 0
longer overall distance 0
2 4 6 Overall distance ·104
Medvet et al. (UniTs)
less overall collisions
Road traffic rules with GE
21 / 21
Experimental evaluation
))) Thanks! )))
Medvet et al. (UniTs)
Road traffic rules with GE
21 / 21