Class ConflictBuilder

java.lang.Object
org.opentrafficsim.road.network.lane.conflict.ConflictBuilder

public final class ConflictBuilder extends Object
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:
  • Field Details

    • DEFAULT_WIDTH_GENERATOR

      public static final ConflictBuilder.WidthGenerator 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; network
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - 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; network
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - WidthGenerator; width generator
      ignoreList - LaneCombinationList; lane combinations to ignore
      permittedList - 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>; lanes
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - 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 Lanes
      simulator - OtsSimulatorInterface; the simulator
      widthGenerator - WidthGenerator; the width generator
      ignoreList - LaneCombinationList; lane combinations to ignore
      permittedList - LaneCombinationList; lane combinations that are permitted by traffic control
      conflictId - 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 1
      lane2 - Lane; lane 2
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - 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 1
      lane2 - Lane; lane 2
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - WidthGenerator; width generator
      permitted - 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,OtsLine2d> rightEdges, boolean intersectionCheck, String conflictId) throws OtsGeometryException, NetworkException
      Build conflicts on single lane pair.
      Parameters:
      lane1 - Lane; lane 1
      down1 - Set<Lane>; downstream lanes 1
      up1 - Set<Lane>; upstream lanes 1
      lane2 - Lane; lane 2
      down2 - Set<Lane>; downstream lane 2
      up2 - Set<Lane>; upstream lanes 2
      permitted - boolean; conflict permitted by traffic control
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - WidthGenerator; width generator
      leftEdges - Map<Lane, OtsLine2d>; cache of left edge lines
      rightEdges - Map<Lane, OtsLine2d>; cache of right edge lines
      intersectionCheck - indicate whether we have to do a contour intersection check still
      conflictId - String; identification of the conflict (may be null)
      Throws:
      OtsGeometryException - in case of geometry exception
      NetworkException - 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; network
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - 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; network
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - WidthGenerator; width generator
      ignoreList - LaneCombinationList; lane combinations to ignore
      permittedList - 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>; lanes
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - 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 Lanes
      simulator - OtsSimulatorInterface; the simulator
      widthGenerator - WidthGenerator; the width generator
      ignoreList - LaneCombinationList; lane combinations to ignore
      permittedList - 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 Lanes
      simulator - OtsSimulatorInterface; the simulator
      widthGenerator - WidthGenerator; the width generator
      ignoreList - LaneCombinationList; lane combinations to ignore
      permittedList - 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 OtsGeometryException
      Build conflicts on network using only the groups of links that have been identified as candidates with conflicts; parallel implementation.
      Parameters:
      network - RoadNetwork; network
      conflictCandidateMap - Map<String, Set<Link>>; the map of the conflicting links to implement
      simulator - OtsSimulatorInterface; simulator
      widthGenerator - WidthGenerator; width generator
      Throws:
      OtsGeometryException - in case of geometry exception