View Javadoc
1   package org.opentrafficsim.road.gtu.tactical.lmrs;
2   
3   import org.djunits.value.vdouble.scalar.Acceleration;
4   import org.djunits.value.vdouble.scalar.Length;
5   import org.opentrafficsim.base.parameters.ParameterException;
6   import org.opentrafficsim.core.gtu.GtuException;
7   import org.opentrafficsim.road.gtu.perception.RelativeLane;
8   import org.opentrafficsim.road.gtu.tactical.Blockable;
9   import org.opentrafficsim.road.gtu.tactical.TacticalContextEgo;
10  import org.opentrafficsim.road.gtu.tactical.util.ConflictUtil;
11  import org.opentrafficsim.road.gtu.tactical.util.ConflictUtil.ConflictPlans;
12  
13  /**
14   * Conflicts acceleration incentive.
15   * <p>
16   * Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
17   * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
18   * </p>
19   * @author Alexander Verbraeck
20   * @author Peter Knoppers
21   * @author Wouter Schakel
22   */
23  
24  public class AccelerationConflicts implements AccelerationIncentive, Blockable
25  {
26  
27      /** Set of yield plans at conflicts with priority. Remembering for static model. */
28      // @docs/06-behavior/tactical-planner/#modular-utilities
29      private final ConflictPlans conflictPlans = new ConflictPlans();
30  
31      /**
32       * Constructor.
33       */
34      public AccelerationConflicts()
35      {
36          //
37      }
38  
39      @Override
40      public final Acceleration accelerate(final TacticalContextEgo context, final RelativeLane lane, final Length mergeDistance)
41              throws ParameterException, GtuException
42      {
43          return ConflictUtil.approachConflicts(context, this.conflictPlans, lane, mergeDistance, true);
44      }
45  
46      @Override
47      public boolean isBlocking()
48      {
49          return this.conflictPlans.isBlocking();
50      }
51  
52      @Override
53      public final String toString()
54      {
55          return "AccelerationConflicts";
56      }
57  
58  }