Class ConflictBuilder
- java.lang.Object
-
- org.opentrafficsim.road.network.lane.conflict.ConflictBuilder
-
public final class ConflictBuilder extends Object
Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 11 dec. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ConflictBuilder.CbrTaskBig
(package private) static class
ConflictBuilder.CbrTaskSmall
(package private) static class
ConflictBuilder.ConflictBuilderRecordBig
(package private) static class
ConflictBuilder.ConflictBuilderRecordSmall
static class
ConflictBuilder.FixedWidthGenerator
Generator with fixed width.static class
ConflictBuilder.RelativeWidthGenerator
Generator with width factor on actual lane width.static interface
ConflictBuilder.WidthGenerator
Generator for width.
-
Field Summary
Fields Modifier and Type Field Description static ConflictBuilder.WidthGenerator
DEFAULT_WIDTH_GENERATOR
Default width generator for conflicts which uses 80% of the lane width.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
buildConflicts(List<Lane> lanes, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
Build conflicts on list of lanes.static void
buildConflicts(List<Lane> lanes, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList, String conflictId)
Build conflicts on list of lanes.(package private) static void
buildConflicts(Lane lane1, GTUDirectionality dir1, ImmutableMap<Lane,GTUDirectionality> down1, ImmutableMap<Lane,GTUDirectionality> up1, Lane lane2, GTUDirectionality dir2, ImmutableMap<Lane,GTUDirectionality> down2, ImmutableMap<Lane,GTUDirectionality> up2, GTUType gtuType, boolean permitted, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, Map<Lane,OTSLine3D> leftEdges, Map<Lane,OTSLine3D> rightEdges, boolean intersectionCheck, String conflictId)
Build conflicts on single lane pair.static void
buildConflicts(Lane lane1, GTUDirectionality dir1, Lane lane2, GTUDirectionality dir2, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
Build conflict on single lane pair.static void
buildConflicts(Lane lane1, GTUDirectionality dir1, Lane lane2, GTUDirectionality dir2, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, boolean permitted)
Build conflict on single lane pair.static void
buildConflicts(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
Build conflicts on network.static void
buildConflicts(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
Build conflicts on network.static void
buildConflictsParallel(List<Lane> lanes, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
Build conflicts on list of lanes; parallel implementation.static void
buildConflictsParallel(OTSRoadNetwork network, Map<String,Set<Link>> conflictCandidateMap, GTUType gtuType, 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(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
Build conflicts on network; parallel implementation.static void
buildConflictsParallel(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
Build conflicts on network; parallel implementation.static void
buildConflictsParallelBig(List<Lane> lanes, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
Build conflicts on list of lanes; parallel implementation.static void
buildConflictsParallelSmall(List<Lane> lanes, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
Build conflicts on list of lanes; parallel implementation.(package private) static void
buildConflictsSmall(ConflictBuilder.ConflictBuilderRecordSmall cbr)
Build conflicts for one record.
-
-
-
Field Detail
-
DEFAULT_WIDTH_GENERATOR
public static final ConflictBuilder.WidthGenerator DEFAULT_WIDTH_GENERATOR
Default width generator for conflicts which uses 80% of the lane width.
-
-
Method Detail
-
buildConflicts
public static void buildConflicts(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OTSGeometryException
Build conflicts on network.- Parameters:
network
- OTSRoadNetwork; networkgtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) throws OTSGeometryException
Build conflicts on network.- Parameters:
network
- OTSRoadNetwork; networkgtuType
- GTUType; gtu typesimulator
- 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, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OTSGeometryException
Build conflicts on list of lanes.- Parameters:
lanes
- List<Lane>; lanesgtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(List<Lane> lanes, GTUType gtuType, 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 LanesgtuType
- GTUType; the GTU typesimulator
- 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, GTUDirectionality dir1, Lane lane2, GTUDirectionality dir2, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OTSGeometryException
Build conflict on single lane pair. Connecting lanes are determined.- Parameters:
lane1
- Lane; lane 1dir1
- GTUDirectionality; gtu direction 1lane2
- Lane; lane 2dir2
- GTUDirectionality; gtu direction 2gtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflicts
public static void buildConflicts(Lane lane1, GTUDirectionality dir1, Lane lane2, GTUDirectionality dir2, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, boolean permitted) throws OTSGeometryException
Build conflict on single lane pair. Connecting lanes are determined.- Parameters:
lane1
- Lane; lane 1dir1
- GTUDirectionality; gtu direction 1lane2
- Lane; lane 2dir2
- GTUDirectionality; gtu direction 2gtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generatorpermitted
- boolean; conflict permitted by traffic control- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflicts
static void buildConflicts(Lane lane1, GTUDirectionality dir1, ImmutableMap<Lane,GTUDirectionality> down1, ImmutableMap<Lane,GTUDirectionality> up1, Lane lane2, GTUDirectionality dir2, ImmutableMap<Lane,GTUDirectionality> down2, ImmutableMap<Lane,GTUDirectionality> up2, GTUType gtuType, boolean permitted, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, Map<Lane,OTSLine3D> leftEdges, Map<Lane,OTSLine3D> rightEdges, boolean intersectionCheck, String conflictId) throws OTSGeometryException, NetworkException
Build conflicts on single lane pair.- Parameters:
lane1
- Lane; lane 1dir1
- GTUDirectionality; gtu direction 1down1
- Map<Lane,GTUDirectionality>; downstream lanes 1up1
- Map<Lane,GTUDirectionality>; upstream lanes 1lane2
- Lane; lane 2dir2
- GTUDirectionality; gtu direction 2down2
- Map<Lane,GTUDirectionality>; downstream lane 2up2
- Map<Lane,GTUDirectionality>; upstream lanes 2gtuType
- GTUType; gtu typepermitted
- boolean; conflict permitted by traffic controlsimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generatorleftEdges
- Map<Lane, OTSLine3D>; cache of left edge linesrightEdges
- Map<Lane, OTSLine3D>; 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(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OTSGeometryException
Build conflicts on network; parallel implementation.- Parameters:
network
- OTSRoadNetwork; networkgtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflictsParallel
public static void buildConflictsParallel(OTSRoadNetwork network, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList) throws OTSGeometryException
Build conflicts on network; parallel implementation.- Parameters:
network
- OTSRoadNetwork; networkgtuType
- GTUType; gtu typesimulator
- 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, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OTSGeometryException
Build conflicts on list of lanes; parallel implementation.- Parameters:
lanes
- List<Lane>; lanesgtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflictsParallelSmall
public static void buildConflictsParallelSmall(List<Lane> lanes, GTUType gtuType, 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 LanesgtuType
- GTUType; the GTU typesimulator
- 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, GTUType gtuType, 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 LanesgtuType
- GTUType; the GTU typesimulator
- 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(OTSRoadNetwork network, Map<String,Set<Link>> conflictCandidateMap, GTUType gtuType, OTSSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator) throws OTSGeometryException
Build conflicts on network using only the groups of links that have been identified as candidates with conflicts; parallel implementation.- Parameters:
network
- OTSRoadNetwork; networkconflictCandidateMap
- Map<String, Set<Link>>; the map of the conflicting links to implementgtuType
- GTUType; gtu typesimulator
- OTSSimulatorInterface; simulatorwidthGenerator
- WidthGenerator; width generator- Throws:
OTSGeometryException
- in case of geometry exception
-
buildConflictsSmall
static void buildConflictsSmall(ConflictBuilder.ConflictBuilderRecordSmall cbr)
Build conflicts for one record.- Parameters:
cbr
- the lane record
-
-