StrategicalPlanner.java

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

  2. import org.djunits.value.vdouble.scalar.Time;
  3. import org.opentrafficsim.base.parameters.ParameterTypeClass;
  4. import org.opentrafficsim.core.gtu.Gtu;
  5. import org.opentrafficsim.core.gtu.GtuType;
  6. import org.opentrafficsim.core.gtu.plan.tactical.TacticalPlanner;
  7. import org.opentrafficsim.core.network.Link;
  8. import org.opentrafficsim.core.network.NetworkException;
  9. import org.opentrafficsim.core.network.Node;
  10. import org.opentrafficsim.core.network.route.Route;

  11. /**
  12.  * A strategicalPlanner is the planner responsible for the overall 'mission' of the GTU, usually indicating where it needs to
  13.  * go. It operates by instantiating tactical planners to do the actual work, which is generating operational plans (paths over
  14.  * time) to follow to reach the destination that the strategical plan is aware of.
  15.  * <p>
  16.  * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  17.  * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  18.  * </p>
  19.  * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
  20.  * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
  21.  */
  22. public interface StrategicalPlanner
  23. {

  24.     /** Parameter type for strategical planner. */
  25.     ParameterTypeClass<StrategicalPlanner> STRATEGICAL_PLANNER = new ParameterTypeClass<>("strat.plan.", "Strategcial planner",
  26.             ParameterTypeClass.getValueClass(StrategicalPlanner.class));

  27.     /**
  28.      * Returns the GTU.
  29.      * @return GTU
  30.      */
  31.     Gtu getGtu();

  32.     /**
  33.      * Returns the route.
  34.      * @return route, may be null
  35.      */
  36.     Route getRoute();

  37.     /**
  38.      * Returns the origin.
  39.      * @return origin, may be null
  40.      */
  41.     Node getOrigin();

  42.     /**
  43.      * Returns the destination.
  44.      * @return destination, may be null
  45.      */
  46.     Node getDestination();

  47.     /**
  48.      * Get tactical planner for the GTU. The stratigical planner is free to dynamically change this.
  49.      * @return tactical planner
  50.      */
  51.     TacticalPlanner<?, ?> getTacticalPlanner();

  52.     /**
  53.      * Get tactical planner for the GTU. The stratigical planner is free to dynamically change this.
  54.      * @param time Time; time at which to obtain the tactical planner
  55.      * @return tactical planner
  56.      */
  57.     TacticalPlanner<?, ?> getTacticalPlanner(Time time);

  58.     /**
  59.      * Determine the next node in a network based on a current Link we are on.
  60.      * @param link Link; the link we are on
  61.      * @param gtuType GtuType; the GtuType to determine the next node for
  62.      * @return Node; the next node in the route AFTER the current link
  63.      * @throws NetworkException when no route planner is present or the final node in the current link cannot be found in the
  64.      *             route
  65.      */
  66.     default Node nextNode(final Link link, final GtuType gtuType) throws NetworkException
  67.     {
  68.         return nextLink(link, gtuType).getEndNode();
  69.     }

  70.     /**
  71.      * Determine the next link in a network based on a current Link we are on.
  72.      * @param previousLink Link; the link before the node to avoid U-turn
  73.      * @param gtuType GtuType; the GtuType to determine the next node for
  74.      * @return Link; the next link in the route AFTER the current link
  75.      * @throws NetworkException when no route planner is present or the final node in the current link cannot be found in the
  76.      *             route
  77.      */
  78.     Link nextLink(Link previousLink, GtuType gtuType) throws NetworkException;

  79. }