View Javadoc
1   package org.opentrafficsim.road.gtu.lane.tactical.directedlanechange;
2   
3   import org.djunits.value.vdouble.scalar.Acceleration;
4   import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
5   import org.opentrafficsim.road.gtu.lane.tactical.following.DualAccelerationStep;
6   
7   /**
8    * The egoistic drive changes lane when this yields is personal advantage (totally ignoring any disadvantage to others).
9    * <p>
10   * Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11   * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12   * <p>
13   * @version $Revision: 1375 $, $LastChangedDate: 2015-09-03 03:32:20 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $,
14   *          initial version Sep 19, 2014 <br>
15   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
16   */
17  public class DirectedEgoistic extends AbstractDirectedLaneChangeModel
18  {
19      /**
20       * @param perception the perception to use
21       */
22      public DirectedEgoistic(final LanePerception perception)
23      {
24          super(perception);
25      }
26  
27      /** {@inheritDoc} */
28      @Override
29      public final Acceleration applyDriverPersonality(final DualAccelerationStep accelerations)
30      {
31          // The egoistic driver only looks at the effects on him-/herself.
32          return accelerations.getLeaderAcceleration();
33      }
34  
35      /** {@inheritDoc} */
36      @Override
37      public final String getName()
38      {
39          return "Egoistic";
40      }
41  
42      /** {@inheritDoc} */
43      @Override
44      public final String getLongName()
45      {
46          return "Egoistic lane change model (as described by Treiber).";
47      }
48  
49      /** {@inheritDoc} */
50      @Override
51      public final String toString()
52      {
53          return "DirectedEgoistic [name=" + this.getName() + "]";
54      }
55  
56  }