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.tactical.following.DualAccelerationStep; 6 7 /** 8 * The altruistic driver changes lane when that is beneficial for all drivers. 9 * <p> 10 * Copyright (c) 2013-2015 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: 1378 $, $LastChangedDate: 2015-09-03 13:38:01 +0200 (Thu, 03 Sep 2015) $, by $Author: averbraeck $, 14 * initial version 5 nov. 2014 <br> 15 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 16 */ 17 public class DirectedAltruistic extends AbstractDirectedLaneChangeModel 18 { 19 20 /** {@inheritDoc} */ 21 @Override 22 public final Acceleration applyDriverPersonality(final DualAccelerationStep accelerationSteps) 23 { 24 // The unit of the result is the acceleration unit of the leader acceleration. 25 // Discussion. The altruistic driver personality in Treiber adds two accelerations together. This reduces the 26 // "sensitivity" for keep lane, keep right and follow route incentives. 27 // This implementation returns the average of the two in order to avoid this sensitivity problem. 28 AccelerationUnit unit = accelerationSteps.getLeaderAcceleration().getUnit(); 29 return new Acceleration((accelerationSteps.getLeaderAcceleration().getInUnit() + accelerationSteps 30 .getFollowerAcceleration().getInUnit(unit)) / 2, unit); 31 } 32 33 /** {@inheritDoc} */ 34 @Override 35 public final String getName() 36 { 37 return "Altruistic"; 38 } 39 40 /** {@inheritDoc} */ 41 @Override 42 public final String getLongName() 43 { 44 return "Altruistic lane change model (as described by Treiber)."; 45 } 46 47 }