Altruistic.java

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

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

  5. /**
  6.  * The altruistic driver changes lane when that is beneficial for all drivers.
  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://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
  12.  */
  13. public class Altruistic extends AbstractLaneChangeModel
  14. {
  15.     /** {@inheritDoc} */
  16.     @Override
  17.     public final Acceleration applyDriverPersonality(final DualAccelerationStep accelerationSteps)
  18.     {
  19.         // The unit of the result is the acceleration unit of the leader acceleration.
  20.         // Discussion. The altruistic driver personality in Treiber adds two accelerations together. This reduces the
  21.         // "sensitivity" for keep lane, keep right and follow route incentives.
  22.         // This implementation returns the average of the two in order to avoid this sensitivity problem.
  23.         AccelerationUnit unit = accelerationSteps.getLeaderAcceleration().getDisplayUnit();
  24.         return new Acceleration((accelerationSteps.getLeaderAcceleration().getInUnit()
  25.                 + accelerationSteps.getFollowerAcceleration().getInUnit(unit)) / 2, unit);
  26.     }

  27.     /** {@inheritDoc} */
  28.     @Override
  29.     public final String getName()
  30.     {
  31.         return "Altruistic";
  32.     }

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

  39.     /** {@inheritDoc} */
  40.     @Override
  41.     public final String toString()
  42.     {
  43.         return "Altruistic []";
  44.     }

  45. }