View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.directedlanechange;
2   
3   import org.djunits.unit.AccelerationUnit;
4   import org.djunits.value.vdouble.scalar.Acceleration;
5   import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
6   import org.opentrafficsim.road.gtu.lane.tactical.following.DualAccelerationStep;
7   
8   /**
9    * The altruistic driver changes lane when that is beneficial for all drivers.
10   * <p>
11   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
13   * <p>
14   * @version $Revision: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
15   *          initial version 5 nov. 2014 <br>
16   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
17   */
18  public class DirectedAltruistic extends AbstractDirectedLaneChangeModel
19  {
20      /**
21       * @param perception the perception to use
22       */
23      public DirectedAltruistic(final LanePerception perception)
24      {
25          super(perception);
26      }
27  
28      /** {@inheritDoc} */
29      @Override
30      public final Acceleration applyDriverPersonality(final DualAccelerationStep accelerationSteps)
31      {
32          // The unit of the result is the acceleration unit of the leader acceleration.
33          // Discussion. The altruistic driver personality in Treiber adds two accelerations together. This reduces the
34          // "sensitivity" for keep lane, keep right and follow route incentives.
35          // This implementation returns the average of the two in order to avoid this sensitivity problem.
36          AccelerationUnit unit = accelerationSteps.getLeaderAcceleration().getUnit();
37          return new Acceleration((accelerationSteps.getLeaderAcceleration().getInUnit()
38                  + accelerationSteps.getFollowerAcceleration().getInUnit(unit)) / 2, unit);
39      }
40  
41      /** {@inheritDoc} */
42      @Override
43      public final String getName()
44      {
45          return "Altruistic";
46      }
47  
48      /** {@inheritDoc} */
49      @Override
50      public final String getLongName()
51      {
52          return "Altruistic lane change model (as described by Treiber).";
53      }
54  
55      /** {@inheritDoc} */
56      @Override
57      public final String toString()
58      {
59          return "DirectedAltruistic [name=" + getName() + "]";
60      }
61  
62  }