Class ConflictBuilder
java.lang.Object
org.opentrafficsim.road.network.lane.conflict.ConflictBuilder
Conflict builder allows automatic generation of conflicts. This happens based on the geometry of lanes. Parallel execution
allows this algorithm to run faster. There are two parallel implementations:
- Small; between two lanes.
- Big; between one particular lane, and all lanes further in a list (i.e. similar to a triangular matrix procedure).
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
Large conflict builder task.(package private) static class
Small conflict builder task.(package private) static final record
Big conflict builder record.(package private) static final record
Small conflict builder record.static class
Generator with fixed width.static class
Generator with width factor on actual lane width.static interface
Generator for width. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ConflictBuilder.WidthGenerator
Default width generator for conflicts which uses 80% of the lane width. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
buildConflicts
(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) Build conflicts on list of lanes.static void
buildConflicts
(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList, String conflictId) Build conflicts on list of lanes.(package private) static void
buildConflicts
(Lane lane1, Set<Lane> down1, Set<Lane> up1, Lane lane2, Set<Lane> down2, Set<Lane> up2, boolean permitted, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, Map<Lane, OtsLine2d> leftEdges, Map<Lane, OtsLine2d> rightEdges, boolean intersectionCheck, String conflictId) Build conflicts on single lane pair.static void
buildConflicts
(Lane lane1, Lane lane2, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) Build conflict on single lane pair.static void
buildConflicts
(Lane lane1, Lane lane2, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, boolean permitted) Build conflict on single lane pair.static void
buildConflicts
(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) Build conflicts on network.static void
buildConflicts
(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) Build conflicts on network.static void
buildConflictsParallel
(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) Build conflicts on list of lanes; parallel implementation.static void
buildConflictsParallel
(RoadNetwork network, Map<String, Set<Link>> conflictCandidateMap, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) Build conflicts on network using only the groups of links that have been identified as candidates with conflicts; parallel implementation.static void
buildConflictsParallel
(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) Build conflicts on network; parallel implementation.static void
buildConflictsParallel
(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) Build conflicts on network; parallel implementation.static void
buildConflictsParallelBig
(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) Build conflicts on list of lanes; parallel implementation.static void
buildConflictsParallelSmall
(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) Build conflicts on list of lanes; parallel implementation.
-
Field Details
-
DEFAULT_WIDTH_GENERATOR
Default width generator for conflicts which uses 80% of the lane width.
-
-
Method Details
-
buildConflicts
public static void buildConflicts(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OtsGeometryException Build conflicts on network.- Parameters:
network
- RoadNetwork; networksimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) throws OtsGeometryException Build conflicts on network.- Parameters:
network
- RoadNetwork; networksimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generatorignoreList
- LaneCombinationList; lane combinations to ignorepermittedList
- LaneCombinationList; lane combinations that are permitted by traffic control- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OtsGeometryException Build conflicts on list of lanes.- Parameters:
lanes
- List<Lane>; lanessimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList, String conflictId) throws OtsGeometryException Build conflicts on list of lanes.- Parameters:
lanes
- List<Lane>; list of Lanessimulator
- OtsSimulatorInterface; the simulatorwidthGenerator
- WidthGenerator; the width generatorignoreList
- LaneCombinationList; lane combinations to ignorepermittedList
- LaneCombinationList; lane combinations that are permitted by traffic controlconflictId
- String; identification of the conflict (null value permitted)- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(Lane lane1, Lane lane2, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OtsGeometryException Build conflict on single lane pair. Connecting lanes are determined.- Parameters:
lane1
- Lane; lane 1lane2
- Lane; lane 2simulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(Lane lane1, Lane lane2, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, boolean permitted) throws OtsGeometryException Build conflict on single lane pair. Connecting lanes are determined.- Parameters:
lane1
- Lane; lane 1lane2
- Lane; lane 2simulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generatorpermitted
- boolean; conflict permitted by traffic control- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflicts
static void buildConflicts(Lane lane1, Set<Lane> down1, Set<Lane> up1, Lane lane2, Set<Lane> down2, Set<Lane> up2, boolean permitted, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, Map<Lane, OtsLine2d> leftEdges, Map<Lane, throws OtsGeometryException, NetworkExceptionOtsLine2d> rightEdges, boolean intersectionCheck, String conflictId) Build conflicts on single lane pair.- Parameters:
lane1
- Lane; lane 1down1
- Set<Lane>; downstream lanes 1up1
- Set<Lane>; upstream lanes 1lane2
- Lane; lane 2down2
- Set<Lane>; downstream lane 2up2
- Set<Lane>; upstream lanes 2permitted
- boolean; conflict permitted by traffic controlsimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generatorleftEdges
- Map<Lane, OtsLine2d>; cache of left edge linesrightEdges
- Map<Lane, OtsLine2d>; cache of right edge linesintersectionCheck
- indicate whether we have to do a contour intersection check stillconflictId
- String; identification of the conflict (may be null)- Throws:
OtsGeometryException
- in case of geometry exceptionNetworkException
- if the combination of conflict type and both conflict rules is not correct
-
buildConflictsParallel
public static void buildConflictsParallel(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OtsGeometryException Build conflicts on network; parallel implementation.- Parameters:
network
- RoadNetwork; networksimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflictsParallel
public static void buildConflictsParallel(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) throws OtsGeometryException Build conflicts on network; parallel implementation.- Parameters:
network
- RoadNetwork; networksimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generatorignoreList
- LaneCombinationList; lane combinations to ignorepermittedList
- LaneCombinationList; lane combinations that are permitted by traffic control- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflictsParallel
public static void buildConflictsParallel(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OtsGeometryException Build conflicts on list of lanes; parallel implementation.- Parameters:
lanes
- List<Lane>; lanessimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflictsParallelSmall
public static void buildConflictsParallelSmall(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) throws OtsGeometryException Build conflicts on list of lanes; parallel implementation. Small jobs.- Parameters:
lanes
- List<Lane>; list of Lanessimulator
- OtsSimulatorInterface; the simulatorwidthGenerator
- WidthGenerator; the width generatorignoreList
- LaneCombinationList; lane combinations to ignorepermittedList
- LaneCombinationList; lane combinations that are permitted by traffic control- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflictsParallelBig
public static void buildConflictsParallelBig(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) throws OtsGeometryException Build conflicts on list of lanes; parallel implementation. Big jobs.- Parameters:
lanes
- List<Lane>; list of Lanessimulator
- OtsSimulatorInterface; the simulatorwidthGenerator
- WidthGenerator; the width generatorignoreList
- LaneCombinationList; lane combinations to ignorepermittedList
- LaneCombinationList; lane combinations that are permitted by traffic control- Throws:
OtsGeometryException
- in case of geometry exception
-
buildConflictsParallel
public static void buildConflictsParallel(RoadNetwork network, Map<String, Set<Link>> conflictCandidateMap, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OtsGeometryExceptionBuild conflicts on network using only the groups of links that have been identified as candidates with conflicts; parallel implementation.- Parameters:
network
- RoadNetwork; networkconflictCandidateMap
- Map<String, Set<Link>>; the map of the conflicting links to implementsimulator
- OtsSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OtsGeometryException
- in case of geometry exception
-