Class DefaultFlatEarthAverageSpeedBackupElementConnector
java.lang.Object
com.dna.jopt.member.unit.nodeedge.backupconnector.DefaultFlatEarthAverageSpeedBackupElementConnector
- All Implemented Interfaces:
IBackupElementConnector
,Serializable
public class DefaultFlatEarthAverageSpeedBackupElementConnector
extends Object
implements IBackupElementConnector
The DefaultFlatEarthAverageSpeedBackupElementConnector is the default implementation used as
IBackupElementConnector
by the INodeEdgeConnector
.
It used in case the INodeEdgeConnector
is not able to provide a requested INodeConnectorItem
between
two IOptimizationElement
.
- Since:
- Sep 17, 2019
- Version:
- Sep 17, 2019
- Author:
- Jens Richter
- See Also:
-
Constructor Summary
ConstructorDescriptionDefaultFlatEarthAverageSpeedBackupElementConnector
(boolean doRecalculateElement2ElementDuration) Instantiates a new default flat earth average speed backup element connector. -
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) Using flat place on earth formula to calculate the distance between twoIOptimizationElement
.getElement2ElementDuration
(String fromElementId, String toElementId, double distanceMeter, IResource visitor) Calculates the driving duration between twoIOptimizationElement
assuming the average resource-visitor speed.boolean
Every time a connection is extracted the driving time (duration) between two elements can be a function of the visitors average speed.
-
Constructor Details
-
DefaultFlatEarthAverageSpeedBackupElementConnector
public DefaultFlatEarthAverageSpeedBackupElementConnector(boolean doRecalculateElement2ElementDuration) Instantiates a new default flat earth average speed backup element connector. Every time a connection is extracted the driving time (duration) between two elements can be a function of the visitor. However, in case all visitors have the same average speed there is no recalculation necessary.- Parameters:
doRecalculateElement2ElementDuration
- the do recalculate element 2 element duration
-
-
Method Details
-
isRecalculateElement2ElementDuration
public boolean isRecalculateElement2ElementDuration()Description copied from interface:IBackupElementConnector
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.- Specified by:
isRecalculateElement2ElementDuration
in interfaceIBackupElementConnector
- Returns:
- true, if is recalculate element-element duration
-
getElement2ElementDistance
public javax.measure.Quantity<javax.measure.quantity.Length> getElement2ElementDistance(String fromElementId, double fromElementLon, double fromElementLat, String toElementId, double toElementLon, double toElementLat, IResource visitor) Using flat place on earth formula to calculate the distance between twoIOptimizationElement
.- Specified by:
getElement2ElementDistance
in interfaceIBackupElementConnector
- 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
- See Also:
-
getElement2ElementDuration
public Duration getElement2ElementDuration(String fromElementId, String toElementId, double distanceMeter, IResource visitor) Calculates the driving duration between twoIOptimizationElement
assuming the average resource-visitor speed.- Specified by:
getElement2ElementDuration
in interfaceIBackupElementConnector
- 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
- See Also:
-