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)
      Build conflicts on network.
      Parameters:
      network - network
      simulator - simulator
      widthGenerator - width generator
    • buildConflicts

      public static void buildConflicts(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
      Build conflicts on network.
      Parameters:
      network - network
      simulator - simulator
      widthGenerator - width generator
      ignoreList - lane combinations to ignore
      permittedList - lane combinations that are permitted by traffic control
    • buildConflicts

      public static void buildConflicts(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
      Build conflicts on list of lanes.
      Parameters:
      lanes - lanes
      simulator - simulator
      widthGenerator - width generator
    • buildConflicts

      public static void buildConflicts(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList, String conflictId)
      Build conflicts on list of lanes.
      Parameters:
      lanes - list of Lanes
      simulator - the simulator
      widthGenerator - the width generator
      ignoreList - lane combinations to ignore
      permittedList - lane combinations that are permitted by traffic control
      conflictId - identification of the conflict (null value permitted)
    • buildConflicts

      public static void buildConflicts(Lane lane1, Lane lane2, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
      Build conflict on single lane pair. Connecting lanes are determined.
      Parameters:
      lane1 - lane 1
      lane2 - lane 2
      simulator - simulator
      widthGenerator - width generator
    • buildConflicts

      public static void buildConflicts(Lane lane1, Lane lane2, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, boolean permitted)
      Build conflict on single lane pair. Connecting lanes are determined.
      Parameters:
      lane1 - lane 1
      lane2 - lane 2
      simulator - simulator
      widthGenerator - width generator
      permitted - conflict permitted by traffic control
    • 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,org.opentrafficsim.base.geometry.OtsLine2d> leftEdges, Map<Lane,org.opentrafficsim.base.geometry.OtsLine2d> rightEdges, boolean intersectionCheck, String conflictId) throws NetworkException
      Build conflicts on single lane pair.
      Parameters:
      lane1 - lane 1
      down1 - downstream lanes 1
      up1 - upstream lanes 1
      lane2 - lane 2
      down2 - downstream lane 2
      up2 - upstream lanes 2
      permitted - conflict permitted by traffic control
      simulator - simulator
      widthGenerator - width generator
      leftEdges - cache of left edge lines
      rightEdges - cache of right edge lines
      intersectionCheck - indicate whether we have to do a contour intersection check still
      conflictId - identification of the conflict (may be null)
      Throws:
      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)
      Build conflicts on network; parallel implementation.
      Parameters:
      network - network
      simulator - simulator
      widthGenerator - width generator
    • buildConflictsParallel

      public static void buildConflictsParallel(RoadNetwork network, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
      Build conflicts on network; parallel implementation.
      Parameters:
      network - network
      simulator - simulator
      widthGenerator - width generator
      ignoreList - lane combinations to ignore
      permittedList - lane combinations that are permitted by traffic control
    • buildConflictsParallel

      public static void buildConflictsParallel(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator)
      Build conflicts on list of lanes; parallel implementation.
      Parameters:
      lanes - lanes
      simulator - simulator
      widthGenerator - width generator
    • buildConflictsParallelSmall

      public static void buildConflictsParallelSmall(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
      Build conflicts on list of lanes; parallel implementation. Small jobs.
      Parameters:
      lanes - list of Lanes
      simulator - the simulator
      widthGenerator - the width generator
      ignoreList - lane combinations to ignore
      permittedList - lane combinations that are permitted by traffic control
    • buildConflictsParallelBig

      public static void buildConflictsParallelBig(List<Lane> lanes, OtsSimulatorInterface simulator, ConflictBuilder.WidthGenerator widthGenerator, LaneCombinationList ignoreList, LaneCombinationList permittedList)
      Build conflicts on list of lanes; parallel implementation. Big jobs.
      Parameters:
      lanes - list of Lanes
      simulator - the simulator
      widthGenerator - the width generator
      ignoreList - lane combinations to ignore
      permittedList - lane combinations that are permitted by traffic control
    • buildConflictsParallel

      public 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.
      Parameters:
      network - network
      conflictCandidateMap - the map of the conflicting links to implement
      simulator - simulator
      widthGenerator - width generator