TacticalPlanner.java

  1. package org.opentrafficsim.core.gtu.plan.tactical;

  2. import org.djunits.value.vdouble.scalar.Time;
  3. import org.opentrafficsim.base.parameters.ParameterException;
  4. import org.opentrafficsim.base.parameters.ParameterTypeClass;
  5. import org.opentrafficsim.core.gtu.GTU;
  6. import org.opentrafficsim.core.gtu.GTUException;
  7. import org.opentrafficsim.core.gtu.perception.Perception;
  8. import org.opentrafficsim.core.gtu.plan.operational.OperationalPlan;
  9. import org.opentrafficsim.core.gtu.plan.operational.OperationalPlanException;
  10. import org.opentrafficsim.core.network.NetworkException;

  11. import nl.tudelft.simulation.language.d3.DirectedPoint;

  12. /**
  13.  * Tactical planners generate operational plans that are in line with reaching the goals of the strategical plan. The modeler is
  14.  * totally free how the tactical planners are generated. Usually there is one tactical planner at work, but it is of course
  15.  * possible to have multiple parallel planners that assess the situation and an overarching tactical planner that acts as a
  16.  * tie-breaker. Alternatively, a single tactical planner is activated depending on the situation. Suppose we drive on a
  17.  * multi-lane stretch of road. The tactical planner can use the headway and lane change algorithms to generate the right
  18.  * operational plans (movements). When the GTU nears a crossing, another tactical planner can be activated that takes care of
  19.  * going left, straight or right (based on a consultation of the strategical plan) and for providing a safe passage of the
  20.  * crossing. After the crossing, the standard headway and lane-change tactical planner take over.<br>
  21.  * The operational plans that the tactical planners generate can have a very different duration. In case of a standard headway
  22.  * and lane change algorithm with a time step of 0.5 seconds, each operational plan can take 0.5 seconds. Alternatively,
  23.  * operational plans can have a very different duration, depending on the situation. When changing lanes, the complete movement
  24.  * to the other lane can be one operational plan. When it is not busy, and the GTU can move for 5 seconds without problems, the
  25.  * operational plan can take 5 seconds. Based on external stimuli (for which the Perception unit of the GTU is responsible),
  26.  * operational plans can always be interrupted.
  27.  * <p>
  28.  * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  29.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  30.  * </p>
  31.  * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
  32.  * initial version Nov 14, 2015 <br>
  33.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  34.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  35.  * @param <G> GTU type
  36.  * @param <P> perception type
  37.  */
  38. public interface TacticalPlanner<G extends GTU, P extends Perception<G>>
  39. {

  40.     /** Parameter type for tactical planner. */
  41.     @SuppressWarnings("rawtypes")
  42.     ParameterTypeClass<TacticalPlanner> TACTICAL_PLANNER =
  43.             new ParameterTypeClass<>("tac.plan.", "Tactical planner", ParameterTypeClass.getValueClass(TacticalPlanner.class));

  44.     /**
  45.      * Returns the GTU.
  46.      * @return GTU
  47.      */
  48.     G getGtu();

  49.     /**
  50.      * generate an operational plan, for now or for in the future.
  51.      * @param startTime Time; the time from which the new operational plan has to be operational
  52.      * @param locationAtStartTime DirectedPoint; the location of the GTU at the start time of the new plan
  53.      * @return a new operational plan
  54.      * @throws OperationalPlanException when there is a problem planning a path in the network
  55.      * @throws GTUException when there is a problem with the state of the GTU when planning a path
  56.      * @throws NetworkException when there is a problem with the network on which the GTU is driving
  57.      * @throws ParameterException when there is a problem with a parameter
  58.      */
  59.     OperationalPlan generateOperationalPlan(Time startTime, DirectedPoint locationAtStartTime)
  60.             throws OperationalPlanException, GTUException, NetworkException, ParameterException;

  61.     /** @return the perception unit belonging to this tactical planner. */
  62.     P getPerception();

  63. }