TacticalPlanner.java

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

  2. import org.djunits.value.vdouble.scalar.Time;
  3. import org.djutils.draw.point.OrientedPoint2d;
  4. import org.opentrafficsim.base.parameters.ParameterException;
  5. import org.opentrafficsim.base.parameters.ParameterTypeClass;
  6. import org.opentrafficsim.core.gtu.Gtu;
  7. import org.opentrafficsim.core.gtu.GtuException;
  8. import org.opentrafficsim.core.gtu.perception.Perception;
  9. import org.opentrafficsim.core.gtu.plan.operational.OperationalPlan;
  10. import org.opentrafficsim.core.network.NetworkException;

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

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

  41.     /**
  42.      * Returns the GTU.
  43.      * @return GTU
  44.      */
  45.     G getGtu();

  46.     /**
  47.      * generate an operational plan, for now or for in the future.
  48.      * @param startTime the time from which the new operational plan has to be operational
  49.      * @param locationAtStartTime the location of the GTU at the start time of the new plan
  50.      * @return a new operational plan
  51.      * @throws GtuException when there is a problem with the state of the GTU when planning a path
  52.      * @throws NetworkException when there is a problem with the network on which the GTU is driving
  53.      * @throws ParameterException when there is a problem with a parameter
  54.      */
  55.     // @docs/06-behavior/tactical-planner.md
  56.     OperationalPlan generateOperationalPlan(Time startTime, OrientedPoint2d locationAtStartTime)
  57.             throws GtuException, NetworkException, ParameterException;

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

  60. }