Interface IBackupElementConnector
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
DefaultFlatEarthAverageSpeedBackupElementConnector
The Interface IBackupElementConnector which is used if the
INodeEdgeConnector
if a requested connection cannot be found. By default the DefaultFlatEarthAverageSpeedBackupElementConnector
is used.
Implementation example - Setting a custom connector:
INodeEdgeConnector connector = new NodeEdgeConnector();
connector.setBackupElementConnector(new MyResourceDependedtBackupElementConnector(true));
opti.setNodeConnector(connector);
- Since:
- 17/10/2018
- Version:
- 09/09/2019
- Author:
- DNA
-
Method Summary
Modifier and TypeMethodDescriptionjavax.measure.Quantity<javax.measure.quantity.Length>
getElement2ElementDistance
(String fromElementId, double fromElementLon, double fromElementLat, String toElementId, double toElementLon, double toElementLat, IResource visitor) Calculates the distance between twoIOptimizationElement
defined by their unique id.getElement2ElementDuration
(String fromElementId, String toElementId, double distanceMeter, IResource visitor) Calculates the driving duration between twoIOptimizationElement
defined by their unique id.boolean
Every time a connection is extracted the driving time (duration) between two elements can be a function of the visitors average speed.
-
Method Details
-
getElement2ElementDistance
javax.measure.Quantity<javax.measure.quantity.Length> getElement2ElementDistance(String fromElementId, double fromElementLon, double fromElementLat, String toElementId, double toElementLon, double toElementLat, IResource visitor) Calculates the distance between twoIOptimizationElement
defined by their unique id. This method is called by theINodeEdgeConnector
in case the requested connection is not existing. This method can be overridden in case a custom connector is used. The defaultDefaultFlatEarthAverageSpeedBackupElementConnector
has an implementation of the method.- Parameters:
fromElementId
- the string ID from the start elementfromElementLon
- the double longitude from the start elementfromElementLat
- the double latitude from the start elementtoElementId
- the string ID goal elementtoElementLon
- the double longitude from the target elementtoElementLat
- the double latitude from the target elementvisitor
- the iResource that is giving service to both Nodes on that Route- Returns:
- the element too element distance
-
getElement2ElementDuration
Duration getElement2ElementDuration(String fromElementId, String toElementId, double distanceMeter, IResource visitor) Calculates the driving duration between twoIOptimizationElement
defined by their unique id. This method is called by theINodeEdgeConnector
in case the requested connection is not existing. This method can be overridden in case a custom connector is used. The defaultDefaultFlatEarthAverageSpeedBackupElementConnector
has an implementation of the method.- Parameters:
fromElementId
- the string ID from the start elementtoElementId
- the string ID from the target elementdistanceMeter
- the double distance metervisitor
- the iResource that is giving service to both Nodes on that Route- Returns:
- the element too element duration
-
isRecalculateElement2ElementDuration
boolean isRecalculateElement2ElementDuration()Every time a connection is extracted the driving time (duration) between two elements can be a function of the visitors average speed. However, in case in which all visitors have the same average speed (or the difference is negligible) there is no recalculation necessary. However, in the final optimization result driving durations are presented with their actual average speeds.- Returns:
- true, if is recalculate element-element duration
-