Class TrainsEnvironment
Train class). Supports @TrainRoute
calculation consider maneuvers, non-moving trains blocking traffic, as well
as reserved tracks.. Trains can live only in this type of environments.- Author:
- Andrey Korotin
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doublefinal doubleFields inherited from class com.amalgamasimulation.graphagent.LongAgentsEnvironment
arcsToSeizingAgents, arcsToWaitingAgentsFields inherited from class com.amalgamasimulation.graphagent.GraphEnvironment
agents, barrierArcsCache, barrierArcsEnabled, cachedMinTreesWithAgents, cachedMinTreesWithoutAgents, cachedShortestPathsWeights, cachedShortestPathsWithAgents, cachedShortestPathsWithoutAgents, callbackPositionsEnabled, collisionsTrackingEnabled, graph, minTreeCacheEnabled, pathsCacheEnabled, pathsCalculated, pathsCalculatedFromDijkstra, pathsCalculatedFromTree, pathsGotFromCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new graph arc between the nodes with the specified values.Creates two new graph arcs (one forward and one backward) between the nodes with the specified values.Creates a new graph node with the specified node value and adds it to the graph.addRailNode(RailNode railNode) Adds an existingRailNodeto the rail graph.addRailNode(String name, Point point) Creates a newRailNodewith the given name and position, adds it to the graph, and returns the created node.addRailTrack(RailNode sourceNode, RailNode destNode, String name, Polyline forwardPolyline) booleandoublecalculateArcWeight(RailArc arcValue, LongAgentWeightKey longAgentWeightKey) Calculates the weight of traversing the specifiedRailArc.doublecalculatePartialArcWeight(RailArc arcValue, double startAbsOffset, double endAbsOffset, Set<RailArc> prohibitedArcs, Predicate<Train> considerTrainsPredicate) Calculates the weight of a partial arc segment between the specified absolute offsets.calculateRoute(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, double beginTime, double velocity) Calculates a route for the specifiedTrainfrom a source position to a destination position.calculateRoute(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, List<RailNode> visitNodes, double beginTime, double velocity) Calculates a route for the specifiedTrainfrom a source position to a destination position.calculateRoute(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, BiPredicate<RailTrack, Object> considerBookedTracks, Predicate<Train> considerTrainsPredicate, Set<RailArc> prohibitedArcs, List<RailNode> visitNodes, double beginTime, double velocity) Calculates a route for the specifiedTrainfrom a source position to a destination position.calculateRouteOrBarrierArcs(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, double beginTime, double velocity) Calculates a route and barriers arcs for the specifiedTrainfrom a source position to a destination position.calculateRouteOrBarrierArcs(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, List<RailNode> visitNodes, double beginTime, double velocity) Calculates a route and barriers arcs for the specifiedTrainfrom a source position to a destination position.createNewRailNode(String name, Point point) Creates a newRailNodeat the specified point with the given name.createNewRailTrack(String name, Graph<RailNode, RailArc>.Arc forwardArc, Graph<RailNode, RailArc>.Arc backwardArc) Creates a newRailTrackwith the specified name and connecting arcs.createNewTrain(List<? extends RailCar> cars) Creates a newTraincomposed of the specified list of rail cars.static doubleCalculates the angle (in radians) between two consecutive arcs.doublegetArcWeight(RailArc arcValue, LongAgentWeightKey longAgentWeightKey) Returns the weight of the specified arc used when calculating the shortest paths for agents' movements.protected doublegetContextLength(com.amalgamasimulation.trains.TrainsEnvironment.ContextRecord context, double agentLengthBeforeDestNode, double agentLength, boolean isIncludeArcAfterNode) protected doublegetEndMovementTime(List<Graph<RailNode, RailArc>.Arc> arcs, double agentLengthBeforeDestNode, double beginTime, double velocity, double agentLength, Graph<RailNode, RailArc>.Arc beforePathSourceArc, boolean isIncludeArcAfterNode, Graph<RailNode, RailArc>.Node destNode, LongAgentWeightKey weighterKey) doublegetPartialArcWeight(RailArc arcValue, double startAbsOffset, double endAbsOffset, double startRelOffset, double endRelOffset, LongAgentWeightKey longAgentWeightKey) Returns the weight of the fragment of the specified arc.getSharpTurnOffsets(Polyline polyline, double sharpTurnLength, double minHeadingDifferenceOfSharpTurn) Identifies sections of a polyline that contain sharp turns.getShortestPath(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition) getShortestPath(GeometricGraphPosition<RailNode, RailArc> sourcePosition, Predicate<Graph<RailNode, RailArc>.Node> destNodeIndicator) getShortestPath(RailNode sourceNodeValue, RailNode destNodeValue) protected doublegetStartMovementTime(com.amalgamasimulation.trains.TrainsEnvironment.ContextRecord context, double agentLengthBeforeDestNode, double beginTime, double velocity, double agentLength, Graph<RailNode, RailArc>.Arc beforePathSourceArc, boolean isIncludeArcAfterNode, Graph<RailNode, RailArc>.Node destNode, LongAgentWeightKey weighterKey) booleanDetermines whether the corner formed by two consecutive arcs is a sharp angle.booleanChecks whether caching of the paths is enabled.protected IntervalSetshiftIntervalSet(IntervalSet intervalSet, double shift) Methods inherited from class com.amalgamasimulation.graphagent.LongAgentsEnvironment
getAgentsOverlay, getNodeWeight, getShortestPath, onReleasedArcEntrance, onSeizedArcEntrance, tryEnterArc, weightKeyMethods inherited from class com.amalgamasimulation.graphagent.GraphEnvironment
addAgentInternal, calculatePathWeight, clearCache, getAgents, getArcs, getArcValues, getClosestNodes, getClosestNodes, getClosestNodes, getClosestNodes, getClosestNodes, getClosestNodes, getClosestNodes, getClosestNodes, getClosestNodes, getCurrentCacheFactor, getCurrentDijsktraFactor, getDestsAndWeights, getGraph, getGraphArc, getGraphNode, getNodes, getNodeValues, getSameOrReverseArcPath, getShortestPath, getShortestPath, getShortestPath, getShortestPathBetweenNodesInternal, getShortestPathToClosest, getSourcesAndWeights, isCallbackPositionsEnabled, isCollisionsTrackingEnabled, onArcWeightChanged, removeAgentInternal, tryGetZeroLengthPathBetweenAdjacentPositions
-
Field Details
-
considerBookedTracks
-
prohibitedArcs
-
prohibitedNodes
-
OCCUPIED_TRACK_WEIGHT
public final double OCCUPIED_TRACK_WEIGHT- See Also:
-
REVERSION_GAP
public final double REVERSION_GAP- See Also:
-
considerTrainsPredicate
-
-
Constructor Details
-
TrainsEnvironment
public TrainsEnvironment()
-
-
Method Details
-
pathsCacheEnabled
public boolean pathsCacheEnabled()Description copied from class:GraphEnvironmentChecks whether caching of the paths is enabled. Enabling paths cache increases the speed of modeling but must be used with caution when the weight of nodes or arcs change as the simulation time goes. In this case, it is still possible to use paths caching butGraphEnvironment.clearCache()method must be called when the weights of nodes or arcs change.Paths cache can be enabled or disabled in constructor of this class.
- Overrides:
pathsCacheEnabledin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey> - Returns:
trueif caching of the paths is enabled,falseotherwise
-
createNewTrain
Creates a newTraincomposed of the specified list of rail cars.This method is intended to be overridden by subclasses to provide a proper implementation for creating trains. The default implementation throws a
RuntimeException.- Parameters:
cars- the list ofRailCars that make up the new train- Returns:
- a new
Traininstance composed of the given cars - Throws:
RuntimeException- always, unless overridden in a subclass
-
createNewRailTrack
public RailTrack createNewRailTrack(String name, Graph<RailNode, RailArc>.Arc forwardArc, Graph<RailNode, RailArc>.Arc backwardArc) Creates a newRailTrackwith the specified name and connecting arcs. -
createNewRailNode
Creates a newRailNodeat the specified point with the given name. -
getArcWeight
Description copied from class:GraphEnvironmentReturns the weight of the specified arc used when calculating the shortest paths for agents' movements. Can be overridden in subclasses. The default implementation returns the length of the specified arc, i.e.:return arcValue.getLength();- Overrides:
getArcWeightin classLongAgentsEnvironment<RailNode,RailArc, LongAgentWeightKey> - Parameters:
arcValue- specified arclongAgentWeightKey- an additional parameter used to parameterize the calculation if necessary. For example, can be agent if the paths should be calculated differently for each agent- Returns:
- weight of this arc, must be non-negative
-
getPartialArcWeight
public double getPartialArcWeight(RailArc arcValue, double startAbsOffset, double endAbsOffset, double startRelOffset, double endRelOffset, LongAgentWeightKey longAgentWeightKey) Description copied from class:GraphEnvironmentReturns the weight of the fragment of the specified arc. The fragment of the arc is defined by absolute and relative offsets of its beginning and end.Overriding this method allows users, for example, to make certain fragments of arcs less preferable or forbidden for use in path finding.
The default implementation is to return the weight of the fragment, i.e.:
return getArcWeight(arcValue, weightKey) * Utils.zidz(endAbsOffset - startAbsOffset, arcValue.getLength());For more information about absolute and relative offsets, see documentation of
Polylineclass. See how the total weight of the arc is calculated:- Overrides:
getPartialArcWeightin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey> - Parameters:
arcValue- specified arcstartAbsOffset- absolute offset of the fragment's beginningendAbsOffset- absolute offset of the fragment's endstartRelOffset- relative offset of the fragment's beginningendRelOffset- relative offset of the fragment's endlongAgentWeightKey- an additional parameter used to parameterize the calculation if necessary. For example, can be agent if the paths should be calculated differently for each agent- Returns:
- weight of the fragment of the specified arc, must be non-negative
-
barrierArcsCacheEnabled
public boolean barrierArcsCacheEnabled()- Overrides:
barrierArcsCacheEnabledin classLongAgentsEnvironment<RailNode,RailArc, LongAgentWeightKey>
-
isAngleSharp
public boolean isAngleSharp(Graph<RailNode, RailArc>.Arc prevArc, Graph<RailNode, RailArc>.Arc nextArc) Determines whether the corner formed by two consecutive arcs is a sharp angle.The angle is considered sharp if it is greater than or equal to
SHARP_CORNER_THRESHOLD. -
getAngleBetweenArcs
public static double getAngleBetweenArcs(Graph<RailNode, RailArc>.Arc prevArc, Graph<RailNode, RailArc>.Arc nextArc) Calculates the angle (in radians) between two consecutive arcs.The angle is computed using the last segment of the previous arc and the first segment of the next arc, based on their direction vectors.
-
getSharpTurnOffsets
public static List<Pair<Double,Double>> getSharpTurnOffsets(Polyline polyline, double sharpTurnLength, double minHeadingDifferenceOfSharpTurn) Identifies sections of a polyline that contain sharp turns.A turn is considered sharp if the absolute heading difference between consecutive segments exceeds the specified minHeadingDifferenceOfSharpTurn. For each detected sharp turn, the method returns a pair of offsets defining a segment of the polyline that should be considered for special handling (e.g., slowing down a train).
- Parameters:
polyline- thePolylineto analyze for sharp turnssharpTurnLength- the length before and after the turning point to include in the sharp turn segmentminHeadingDifferenceOfSharpTurn- the minimum heading difference (in radians or degrees, consistent withGeometryUtil.getAbsHeadingDifference(double, double)) between consecutive segments to consider a turn sharp- Returns:
- a list of
Pairs, where each pair contains:- the beginning offset of the sharp turn segment along the polyline
- the ending offset of the sharp turn segment along the polyline
-
addRailNode
Creates a newRailNodewith the given name and position, adds it to the graph, and returns the created node. -
addRailTrack
public RailTrack addRailTrack(RailNode sourceNode, RailNode destNode, String name, Polyline forwardPolyline) Adds a newRailTrackbetween the specified source and destination nodes, using the given forwardPolyline. A backward polyline is automatically created as the reversed version of the forward polyline.This method validates that the nodes exist in the graph and that the polyline has at least two points and non-zero length. It creates forward and backward
RailArcs, links them as reverse arcs, adds them to the graph, and returns a newRailTrackrepresenting the connection.- Parameters:
sourceNode- the sourceRailNodefor the trackdestNode- the destinationRailNodefor the trackname- the name of the rail trackforwardPolyline- thePolylinerepresenting the forward direction of the track- Returns:
- the newly created
RailTrackconnecting the source and destination nodes - Throws:
RuntimeException- if the polyline is null, has fewer than 2 points, or has zero length, or if either node is null or not present in the graph
-
addRailNode
Adds an existingRailNodeto the rail graph.The method checks that the node is not null and has not already been added to the graph.
- Parameters:
railNode- theRailNodeto add- Returns:
- the added
RailNode - Throws:
NullPointerException- ifrailNodeis nullRuntimeException- if the node is already present in the graph
-
addNode
Description copied from class:GraphEnvironmentCreates a new graph node with the specified node value and adds it to the graph.- Overrides:
addNodein classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey> - Parameters:
railNode- value of the node being added- Returns:
Graph.Nodeinstance that was created and added to the graph
-
addArc
Description copied from class:GraphEnvironmentCreates a new graph arc between the nodes with the specified values. Assigns the specified value to the created arc and adds it to the graph.- Overrides:
addArcin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey> - Parameters:
n1- value of the source noden2- value of the destination nodea- value of the arc being added- Returns:
Graph.Arcinstance that was created and added to the graph, ornullif no source or destination node with the specified values were found
-
addArc
public Pair<Graph<RailNode,RailArc>.Arc, addArcGraph<RailNode, RailArc>.Arc> (RailNode n1, RailNode n2, RailArc a1, RailArc a2) Description copied from class:GraphEnvironmentCreates two new graph arcs (one forward and one backward) between the nodes with the specified values. Assigns the specified values to the created arcs and adds them to the graph.- Overrides:
addArcin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey> - Parameters:
n1- value of the source node of the forward arcn2- value of the destination node of the forward arca1- value of the forward arc being addeda2- value of the reverse arc being added- Returns:
- a
PairofGraph.Arcinstances that were created and added to the graph, ornullif no source or destination node with the specified values were found
-
calculatePartialArcWeight
public double calculatePartialArcWeight(RailArc arcValue, double startAbsOffset, double endAbsOffset, Set<RailArc> prohibitedArcs, Predicate<Train> considerTrainsPredicate) Calculates the weight of a partial arc segment between the specified absolute offsets.The base weight equals the length of the segment (
endAbsOffset - startAbsOffset), but it may be replaced byOCCUPIED_TRACK_WEIGHTif the arc is either explicitly prohibited or overlaps with other agents (e.g., trains) according to the specified predicate.When the arc is considered occupied, it is added to
barrierArcs.- Parameters:
arcValue- theRailArcwhose segment weight is being calculatedstartAbsOffset- the starting absolute offset along the arcendAbsOffset- the ending absolute offset along the arcprohibitedArcs- a set of arcs that are prohibited for traversalconsiderTrainsPredicate- a predicate determining whichTrains should be considered when checking for overlapping non-moving agents- Returns:
- the calculated segment weight — either the physical length of the
segment or
OCCUPIED_TRACK_WEIGHTif the arc is blocked
-
calculateArcWeight
Calculates the weight of traversing the specifiedRailArc.The base weight is the physical length of the arc’s polyline. If the arc is in the set of prohibited arcs or if there are trains on the corresponding track that must be considered, the arc is marked as a barrier and the weight is replaced with
OCCUPIED_TRACK_WEIGHT.- Parameters:
arcValue- theRailArcwhose weight is being calculatedlongAgentWeightKey- a key representing the agent for which weight is considered; may be used in custom weighting logic- Returns:
- the calculated arc weight — either the polyline length or
OCCUPIED_TRACK_WEIGHTif the arc is blocked
-
getShortestPath
public AgentGraphPath<RailNode,RailArc> getShortestPath(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition) - Overrides:
getShortestPathin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey>
-
getShortestPath
public AgentGraphPath<RailNode,RailArc> getShortestPath(GeometricGraphPosition<RailNode, RailArc> sourcePosition, Predicate<Graph<RailNode, RailArc>.Node> destNodeIndicator) - Overrides:
getShortestPathin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey>
-
getShortestPath
public AgentGraphPath<RailNode,RailArc> getShortestPath(Graph<RailNode, RailArc>.Node sourceNode, Graph<RailNode, RailArc>.Node destNode) - Overrides:
getShortestPathin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey>
-
getShortestPath
public AgentGraphPath<RailNode,RailArc> getShortestPath(RailNode sourceNodeValue, RailNode destNodeValue) - Overrides:
getShortestPathin classGraphEnvironment<RailNode,RailArc, LongAgentWeightKey>
-
calculateRoute
public TrainRoute calculateRoute(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, double beginTime, double velocity) Calculates a route for the specifiedTrainfrom a source position to a destination position.The route calculation considers booked tracks, prohibited arcs, and necessary nodes to visit. Arcs that are blocked or overlap with non-moving trains according to the provided predicates are marked as barriers and influence the route selection.
- Parameters:
sourcePosition- the starting position in the geometric graphdestPosition- the destination position in the geometric graphtrain- theTrainfor which the route is being calculatedconsiderBookedTracks- whether booked tracks should be considered as obstaclesconsiderTrainsPredicate- whether non-moving trains should be considered as obstaclesprohibitedArcs- a set ofRailArcs that are forbidden for the trainbeginTime- the starting time for the route calculationvelocity- the velocity of the train, used for timing along the route- Returns:
- a
TrainRouterepresenting the calculated path from source to destination
-
calculateRouteOrBarrierArcs
public Pair<TrainRoute,List<RailArc>> calculateRouteOrBarrierArcs(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, List<RailNode> visitNodes, double beginTime, double velocity) Calculates a route and barriers arcs for the specifiedTrainfrom a source position to a destination position.The route calculation considers booked tracks, prohibited arcs, and necessary nodes to visit. Arcs that are blocked or overlap with non-moving trains according to the provided predicates are marked as barriers and influence the route selection.
- Parameters:
sourcePosition- the starting position in the geometric graphdestPosition- the destination position in the geometric graphtrain- theTrainfor which the route is being calculatedconsiderBookedTracks- whether booked tracks should be considered as obstaclesconsiderTrainsPredicate- whether non-moving trains should be considered as obstaclesprohibitedArcs- a set ofRailArcs that are forbidden for the trainvisitNodes- a list ofRailNodes that the route must visit in the specified orderbeginTime- the starting time for the route calculationvelocity- the velocity of the train, used for timing along the route- Returns:
- a
Paircontaining:- the calculated
TrainRoute, ornullif no route could be found - a list of
RailArcs which prevent the route from being found
- the calculated
-
calculateRouteOrBarrierArcs
public Pair<TrainRoute,List<RailArc>> calculateRouteOrBarrierArcs(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, double beginTime, double velocity) Calculates a route and barriers arcs for the specifiedTrainfrom a source position to a destination position.The route calculation considers booked tracks, prohibited arcs, and necessary nodes to visit. Arcs that are blocked or overlap with non-moving trains according to the provided predicates are marked as barriers and influence the route selection.
- Parameters:
sourcePosition- the starting position in the geometric graphdestPosition- the destination position in the geometric graphtrain- theTrainfor which the route is being calculatedconsiderBookedTracks- whether booked tracks should be considered as obstaclesconsiderTrainsPredicate- whether non-moving trains should be considered as obstaclesprohibitedArcs- a set ofRailArcs that are forbidden for the trainbeginTime- the starting time for the route calculationvelocity- the velocity of the train, used for timing along the route- Returns:
- a
Paircontaining:- the calculated
TrainRoute, ornullif no route could be found - a list of
RailArcs which prevent the route from being found
- the calculated
-
calculateRoute
public TrainRoute calculateRoute(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, boolean considerBookedTracks, boolean considerTrainsPredicate, Set<RailArc> prohibitedArcs, List<RailNode> visitNodes, double beginTime, double velocity) Calculates a route for the specifiedTrainfrom a source position to a destination position.The route calculation considers booked tracks, prohibited arcs, and necessary nodes to visit. Arcs that are blocked or overlap with non-moving trains according to the provided predicates are marked as barriers and influence the route selection.
- Parameters:
sourcePosition- the starting position in the geometric graphdestPosition- the destination position in the geometric graphtrain- theTrainfor which the route is being calculatedconsiderBookedTracks- whether booked tracks should be considered as obstaclesconsiderTrainsPredicate- whether non-moving trains should be considered as obstaclesprohibitedArcs- a set ofRailArcs that are forbidden for the trainvisitNodes- a list ofRailNodes that the route must visit in the specified orderbeginTime- the starting time for the route calculationvelocity- the velocity of the train, used for timing along the route- Returns:
- a
TrainRouterepresenting the calculated path from source to destination
-
calculateRoute
public TrainRoute calculateRoute(GeometricGraphPosition<RailNode, RailArc> sourcePosition, GeometricGraphPosition<RailNode, RailArc> destPosition, Train train, BiPredicate<RailTrack, Object> considerBookedTracks, Predicate<Train> considerTrainsPredicate, Set<RailArc> prohibitedArcs, List<RailNode> visitNodes, double beginTime, double velocity) Calculates a route for the specifiedTrainfrom a source position to a destination position.The route calculation considers booked tracks, prohibited arcs, and necessary nodes to visit. Arcs that are blocked or overlap with non-moving trains according to the provided predicates are marked as barriers and influence the route selection.
- Parameters:
sourcePosition- the starting position in the geometric graphdestPosition- the destination position in the geometric graphtrain- theTrainfor which the route is being calculatedconsiderBookedTracks- aBiPredicateto determine which booked tracks should be treated as occupied; the first argument is aRailTrack, the second is the booker objectconsiderTrainsPredicate- aPredicatethat determines which non-moving trains should be considered as obstacles; only trains for which this predicate returnstrueare consideredprohibitedArcs- a set ofRailArcs that are forbidden for the movingvisitNodes- a list ofRailNodes that the route must visit, in the specified orderbeginTime- the starting time for the route calculationvelocity- the velocity of the train, used for timing along the route- Returns:
- a
TrainRouterepresenting the calculated path from source to destination
-
getStartMovementTime
protected double getStartMovementTime(com.amalgamasimulation.trains.TrainsEnvironment.ContextRecord context, double agentLengthBeforeDestNode, double beginTime, double velocity, double agentLength, Graph<RailNode, RailArc>.Arc beforePathSourceArc, boolean isIncludeArcAfterNode, Graph<RailNode, RailArc>.Node destNode, LongAgentWeightKey weighterKey) -
getContextLength
protected double getContextLength(com.amalgamasimulation.trains.TrainsEnvironment.ContextRecord context, double agentLengthBeforeDestNode, double agentLength, boolean isIncludeArcAfterNode) -
getEndMovementTime
protected double getEndMovementTime(List<Graph<RailNode, RailArc>.Arc> arcs, double agentLengthBeforeDestNode, double beginTime, double velocity, double agentLength, Graph<RailNode, RailArc>.Arc beforePathSourceArc, boolean isIncludeArcAfterNode, Graph<RailNode, RailArc>.Node destNode, LongAgentWeightKey weighterKey) -
shiftIntervalSet
-