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.GTUDirectionality;
  6. import org.opentrafficsim.core.gtu.GTUType;
  7. import org.opentrafficsim.core.gtu.plan.tactical.TacticalPlanner;
  8. import org.opentrafficsim.core.network.Link;
  9. import org.opentrafficsim.core.network.LinkDirection;
  10. import org.opentrafficsim.core.network.NetworkException;
  11. import org.opentrafficsim.core.network.Node;
  12. import org.opentrafficsim.core.network.route.Route;

  13. /**
  14.  * A strategicalPlanner is the planner responsible for the overall 'mission' of the GTU, usually indicating where it needs to
  15.  * go. It operates by instantiating tactical planners to do the actual work, which is generating operational plans (paths over
  16.  * time) to follow to reach the destination that the strategical plan is aware of.
  17.  * <p>
  18.  * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
  19.  * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
  20.  * </p>
  21.  * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
  22.  * initial version Nov 14, 2015 <br>
  23.  * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
  24.  * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
  25.  */
  26. public interface StrategicalPlanner
  27. {

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

  31.     /**
  32.      * Returns the GTU.
  33.      * @return GTU
  34.      */
  35.     GTU getGtu();

  36.     /**
  37.      * Returns the route.
  38.      * @return route, may be null
  39.      */
  40.     Route getRoute();

  41.     /**
  42.      * Returns the origin.
  43.      * @return origin, may be null
  44.      */
  45.     Node getOrigin();

  46.     /**
  47.      * Returns the destination.
  48.      * @return destination, may be null
  49.      */
  50.     Node getDestination();

  51.     /**
  52.      * Get tactical planner for the GTU. The stratigical planner is free to dynamically change this.
  53.      * @return tactical planner
  54.      */
  55.     TacticalPlanner<?, ?> getTacticalPlanner();

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

  62.     /**
  63.      * Determine the next node in a network based on a current Link we are on.
  64.      * @param link Link; the link we are on
  65.      * @param direction GTUDirectionality; the direction the GTU is driving on the link
  66.      * @param gtuType GTUType; the GTUType to determine the next node for
  67.      * @return Node; the next node in the route AFTER the current link
  68.      * @throws NetworkException when no route planner is present or the final node in the current link cannot be found in the
  69.      *             route
  70.      */
  71.     Node nextNode(Link link, GTUDirectionality direction, GTUType gtuType) throws NetworkException;

  72.     /**
  73.      * Determine the next link and driving direction (with or against the design line) in a network based on a current Link we
  74.      * are on.
  75.      * @param link Link; the link we are on
  76.      * @param direction GTUDirectionality; the direction the GTU is driving on the link
  77.      * @param gtuType GTUType; the GTUType to determine the next node for
  78.      * @return LinkDirection; the next link and GTU direction in the route AFTER the current link
  79.      * @throws NetworkException when no route planner is present or the final node in the current link cannot be found in the
  80.      *             route
  81.      */
  82.     LinkDirection nextLinkDirection(Link link, GTUDirectionality direction, GTUType gtuType) throws NetworkException;

  83.     /**
  84.      * Determine the next node in a network based on a given node.
  85.      * @param node Node; the node for which we want to find the successor
  86.      * @param previousLink Link; the link before the node (needed to avoid making a U-turn)
  87.      * @param gtuType GTUType; the GTUType to determine the next node for
  88.      * @return Node; the next node in the route AFTER the current node
  89.      * @throws NetworkException when no route planner is present or the node cannot be found in the route of the GTU
  90.      */
  91.     Node nextNode(Node node, Link previousLink, GTUType gtuType) throws NetworkException;

  92.     /**
  93.      * Determine the next link and driving direction (with or against the design line) in a network based on a node and a
  94.      * driving direction of the GTU.
  95.      * @param node Node; the node for which we want to find the successor in the driving direction of the GTU
  96.      * @param previousLink Link; the link before the node to avoid U-turn
  97.      * @param gtuType GTUType; the GTUType to determine the next node for
  98.      * @return LinkDirection; the next link and GTU direction in the route AFTER the current link
  99.      * @throws NetworkException when no route planner is present or the final node in the current link cannot be found in the
  100.      *             route
  101.      */
  102.     LinkDirection nextLinkDirection(Node node, Link previousLink, GTUType gtuType) throws NetworkException;

  103. }