traffic lights specification niek. overview traffic lights are used everywhere various algorithms:...
TRANSCRIPT
![Page 1: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/1.jpg)
Traffic Lights Specification
Niek
![Page 2: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/2.jpg)
Overview
Traffic lights are used everywhereVarious algorithms:
◦Simple time-based traffic lights◦Pressure sensors-based systems◦Connected systems (“green wave”)
We don’t bother:◦This is not an algorithm specification◦We’ll define a spec to check whether a traffic
lights system is correct◦Not whether it’s the most optimal solution
![Page 3: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/3.jpg)
Assumptions
Placed at intersections◦Typically T-type or cross-type intersections◦Assumption: dedicated light/lane per direction◦No deadlocks shall occur◦Example:
![Page 4: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/4.jpg)
Definition of an intersection
type Intersection := {Road}type Road := {Lane}
There is a relation between the number of roads at an intersection and the number of lanes per road:
![Page 5: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/5.jpg)
Definition of lanes
type Lane := (label :: Label, conflicts :: {Label},color :: Color)
type Color := Green | Red
The label of a lane is unique in the scope of the intersection
The conflicts labels are the lanes which cannot be green at the same time as the current lane
![Page 6: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/6.jpg)
Conflicting lanes example
Crossing lanes are not allowedNeither are lanes which arrive on the
same road
![Page 7: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/7.jpg)
Enforcing unique labels
Labels are unique in the scope of the intersection:
type Intersection := {Road}type Road := {Lane}type Lane := (label :: Label, conflicts :: {Label}, color :: Color)
![Page 8: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/8.jpg)
Conflicting lanes
If conflicting labels are specified, they must be part of the same intersection:
type Intersection := {Road}type Road := {Lane}type Lane := (label :: Label, conflicts :: {Label}, color :: Color)
![Page 9: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/9.jpg)
Correctness
Conflicting lanes may not have a green light at the same time:
type Intersection := {Road}type Road := {Lane}type Lane := (label :: Label, conflicts :: {Label}, color :: Color)
![Page 10: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/10.jpg)
Correctness (cont’d)
Intuitively: if a lane has a green light, all non-conflicting lanes should be green as well:
This is not the case, example on next slide.
type Intersection := {Road}type Road := {Lane}type Lane := (label :: Label, conflicts :: {Label}, color :: Color)
![Page 11: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/11.jpg)
Correctness (cont’d)
Example:
In other words: an algorithm is required to select non-conflicting lanes with the highest “priority”◦E.g. Longest wait time/most cars
![Page 12: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/12.jpg)
Conclusion
If a traffic lights system confirms this spec, no accidents will occur◦At least not due to conflicting lights
Whether or not the system is optimized, depends on the algorithm
Real-life issues which make the problem harder:◦Pedestrian paths/lights crossing the lanes◦Merged lanes/lights
![Page 13: Traffic Lights Specification Niek. Overview Traffic lights are used everywhere Various algorithms: ◦Simple time-based traffic lights ◦Pressure sensors-based](https://reader035.vdocument.in/reader035/viewer/2022081908/56649d975503460f94a81417/html5/thumbnails/13.jpg)
Conclusion (cont’d)
01
54
2 3
Intersection = {{(0, {2, 4, 3}, Green), (1, {4}, Green)},{(2, {0, 4, 5}, Red), (3, {0}, Red)},{(4, {0, 1, 3}, Red), (5, {2}, Green)}}