Road traffic rules synthesis using grammatical evolution
1. Road Traffic Rules Synthesis
Using Grammatical Evolution
07 June 2017
University of Trieste
Supervisor: Eric Medvet
Co-supervisors: Alberto Bartoli
Lorenzo Castelli
Author: Jacopo Talamini
2. Road Traffic (Present Scenario)
Road traffic agents:
Human drivers
Road traffic rules:
Traffic rules designed for humans
2
3. Road Traffic (Future Scenario)
Road traffic agents:
Human drivers
Driverless cars
Road traffic rules:
Traffic rules designed for humans
Do we need other rules or are the same ones suitable for both agents?
3
4. Road Traffic Agents (I)
Human drivers
Driverless cars
Same purposes:
Reach a destination
Avoid accidents
Comply to the rules
4
5. Road Traffic Agents (II)
Human drivers
Driverless cars
Different nature with respect to:
Reflexiveness
Reliability
Making decisions
…
5
6. Re-writing the rules (I)
If we could re-write the rules from scratch, we would consider:
Traffic efficency (reach destination in lowest time possible)
Traffic safety (avoiding accidents)
How to write those rules?
6
7. Re-writing the rules (II)
If we could re-write the rules from scratch, we would consider:
Traffic efficency (reach destination in lowest time possible)
Traffic safety (avoiding accidents)
How to write those rules?
Proposed solution:
consider an evolutionary approch to write the rules automatically
7
8. Proposed Solution (I)
Evolutionary approach:
Individual := set of rules
Fitness := (efficiency, safety), simulated with those rules
8
9. Proposed Solution (II)
Evolutionary approach:
Individual := set of rules
Fitness := (efficiency, safety), simulated with those rules
Contributions made:
1. Road Traffic model
2. Language for the rules
3. GE-based rules generation
4. Experimental evaluation
9
10. Road Traffic model (I)
Trade-off:
Detailed enough to resemble real traffic
Simple enough to allow for simulation
Describes:
The physical world
The driver’s behaviour
10
11. Road Traffic model (II)
Infrastructure:
Road graph
(include concepts like road segments, crossroads, lanes in sections)
Agents:
Move according to the driver’s algorithm
Continuous position in the sense of the road sections length
Discrete position on the lanes
Speed
Status (collisions)
…
11
13. Driver’s Algorithm (I)
Each car moves according to the driver’s algorithm
Input:
Input variables (info about closest cars)
State variables (distance of view, …)
Output:
a list A of actions:
Examples: accelerate, move on the left lane, ..
13
16. Driver’s Algorithm (IV)
Goals:
No route to travel, just cross a target distance
Possibly travel at maximum speed
Avoid hitting other cars
Perform always the desired action
16
17. Driver vs Rules-aware driver (I)
At each time step each driver performs exactly one action from A
Driver’s performed action:
The first action on the list (most preferred action)
17
18. Driver vs Rules-aware driver (II)
At each time step each driver performs exactly one action from A
Driver’s performed action:
The first action on the list (most preferred action)
Rules-aware driver’s performed action:
The first action a in A which breaks the lowest number of rules
18
19. Driver vs Rules-aware driver (III)
At each time step each driver performs exactly one action from A
Driver’s performed action:
The first action on the list (most preferred action)
Rules-aware driver’s performed action:
The first action a in A which breaks the lowest number of rules
Why driver and rules-aware driver?
19
20. Driver vs Rules-aware driver (IV)
Why driver and rules-aware driver?
Driver: free to drive as desired, no constraints
Rules-aware driver: among preferred actions chooses a permitted one
20
21. Rules-aware driver prediction algorithm
At each time step rules-aware driver perform a prediction:
For each action in A
For k time steps in the future
Assuming the same action for each time step
Result:
Action that will break the lowest number of rules
The lowest number of rules might be > 0 !
21
22. Language for the rules (I)
Rule:
A predicate that can be evaluated to true or false
Rules-aware drivers consider rules to choose the performed action
All agents consider the same rules
Works on:
Car status (speed, position,..)
Other cars relative distances and speeds
Current road section/intersection
22
23. Language for the rules (II)
Rules are expressed as the context-free grammar:
23
24. Language for the rules (III)
Rules are expressed as the context-free grammar:
24Goal: express rules in a human-readable way
25. Examples of rules (I)
Examples of possible rules:
«stay on the rightmost free lane»
«mantain a low speed near an intersection»
«keep a minimum distance from the car ahead»
25
26. Example of rules (II)
Examples of possible rules:
«stay on the rightmost free lane»
«mantain a low speed near an intersection»
«keep a minimum distance from the car ahead»
26
27. Hand-written rules
Design inspired by real traffic rules
Provide a first example of rules to the model
Compared then with rules generated with GE
27
28. Evolutionary Computation (I)
We know :
the nature of the solution
A way to evaluate a candidate solution
Basic scheme:
Dynamic population of individuals (individual die and are born)
Fittest individuals survive and reproduce more than others
Offspring inherit some character from the parents
28
29. Evolutionary Computation (II)
Generational model
At each time tick we have:
A population of parents
A population of offspring (built from parents)
29
30. Evolutionary Computation (III)
Individual:
Phenotype := candidate solution for the considered problem
Genotype := its inner representation used for manipulations
Given the genotype of an individual, it is possible to obtain:
Its phenotype
Its fitness
30
31. Grammatical Evolution
Individual:
Phenotype := string of a Language
Genotype := binary string
Given the genotype of an individual, it is possible to obtain:
Its phenotype: through mapping function (genotype -> phenotype)
Its fitness: the goodness of the phenotype obtained
31
32. GE-based rules generation
In the considered scenrario:
Solution space as Context-Free Grammar
Individual := string of the defined Context-Free Grammar
Fitness := linear combination of (traffic efficiency, traffic safety)
32
33. Fitness (I)
Traffic efficiency := average speed ratio (ASR)
(1 – AsR) =
Traffic safety := 1 – collision-per-time (CpT)
CpT =
Minimize the linear combination (1 – AsR, CpT):
33
34. Fitness (II)
Meaning of nsim:
The vaule is computed over many (nsim) simulations
It allows to detect common trends in different simulations
Minimize the linear combination (1 – AsR, CpT):
34
35. Experimental Evaluation (I)
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?
35
36. Experimental Evaluation (II)
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
36
37. Traffic model validation (I)
5 road sections, up to 20 cars, values averaged on 10 simulations
37
38. Traffic model validation (II)
5 road sections, up to 20 cars, values averaged on 10 simulations
38
39. Traffic model validation (III)
5 road sections, up to 20 cars, values averaged on 10 simulations
39
40. Traffic model validation (IV)
30 runs, each with 100 individuals, 100 generations, ncar fixed!
Slightly higher efficiency
Higher safety 40
45. Congestion scenario (V)
Results:
With high traffic injected (congestion)
GE vs. hand-written rules:
Longer overall distance
Less overall collisions
45