DirectedEgoistic.java

  1. package org.opentrafficsim.road.gtu.lane.tactical.directedlanechange;

  2. import org.djunits.value.vdouble.scalar.Acceleration;
  3. import org.opentrafficsim.road.gtu.lane.perception.LanePerception;
  4. import org.opentrafficsim.road.gtu.lane.tactical.following.DualAccelerationStep;

  5. /**
  6.  * The egoistic drive changes lane when this yields is personal advantage (totally ignoring any disadvantage to others).
  7.  * <p>
  8.  * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  9.  * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  10.  * </p>
  11.  * @author <a href="https://github.com/peter-knoppers">Peter Knoppers</a>
  12.  */
  13. public class DirectedEgoistic extends AbstractDirectedLaneChangeModel
  14. {
  15.     /**
  16.      * @param perception the perception to use
  17.      */
  18.     public DirectedEgoistic(final LanePerception perception)
  19.     {
  20.         super(perception);
  21.     }

  22.     @Override
  23.     public final Acceleration applyDriverPersonality(final DualAccelerationStep accelerations)
  24.     {
  25.         // The egoistic driver only looks at the effects on him-/herself.
  26.         return accelerations.getLeaderAcceleration();
  27.     }

  28.     @Override
  29.     public final String getName()
  30.     {
  31.         return "Egoistic";
  32.     }

  33.     @Override
  34.     public final String getLongName()
  35.     {
  36.         return "Egoistic lane change model (as described by Treiber).";
  37.     }

  38.     @Override
  39.     public final String toString()
  40.     {
  41.         return "DirectedEgoistic [name=" + this.getName() + "]";
  42.     }

  43. }