Interface IResource
- All Superinterfaces:
Comparable<IBasicResource>
,IBasicResource
,IOptimizationElement
,Serializable
- All Known Implementing Classes:
CapacityResource
resources
are required to execute a schedule as returned by the IOptimization
. A resource
can be a vehicle, an employee or
an abstract working unit. A resource has different attributes like timely availability, skills
and capacity.
Implementation example:
// Define the working hours
List<IWorkingHours> workingHours = new ArrayList<IWorkingHours>();
workingHours.add(
new WorkingHours(
ZonedDateTime.of(2020, MAY.getValue(), 6, 8, 0, 0, 0, ZoneId.of("Europe/Berlin")),
ZonedDateTime.of(2020, MAY.getValue(), 6, 17, 0, 0, 0, ZoneId.of("Europe/Berlin"))));
Duration maxWorkingTime = Duration.ofHours(13);
Quantity<Length> maxDistanceKmW = Quantities.getQuantity(1200.0, KILO(METRE));
// Define the resource
CapacityResource rep1 =
new CapacityResource("Jack", 50.775346, 6.083887, maxWorkingTime, maxDistanceKmW, workingHours);
rep1.setCost(0, 1, 1);
// Adding a (optional) qualification to the resource:
IQualification typeQualification = new TypeQualification();
((TypeQualification) typeQualification).addType("plumbing");
rep1.addQualification(typeQualification);
this.addElement(rep1);
- Since:
- 30/09/2018
- Version:
- 13/08/2019
- Author:
- DNA
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.dna.jopt.member.unit.IOptimizationElement
IOptimizationElement.OptimizationElementFlavour
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCapacity
(double capacity) Deprecated.void
addConstraint
(IResourceLevelConstraint constraint) Adds anIConstraint
to theResource
so it can only give service to theNodes
that have the appropriateIQualification
.double
Gets the average CO2 emission factor.double[]
Gets the capacity of goods aResource
can carry.double[]
Gets the capacity degradation per stop.double
Sets theCapacityResource.getConnectionTimeEfficiencyFactor()
, the default value is1.0
.Gets theIConstraint
from theResource
that it is limited to.double[]
Gets the amount of a good that is already being carried by theResource
.Optional<javax.measure.Quantity<javax.measure.quantity.Length>>
Gets the maximal distance that theResource
needs to drive to the firstNode
.Optional<javax.measure.Quantity<javax.measure.quantity.Length>>
Gets the maximal distance that theResource
needs to drive to the lastNode
.Gets the maximal driving time that theResource
is supposed to drive to the firstNode
.Gets the maximal driving time that theResource
is supposed to drive to the lastNode
.Gets the amount of time in milliseconds that theResource
can be expected to drive home to its starting location in its free time.Gets themaximal pillar after hours time
in milliseconds.Gets the maximum time which theResource
can be expected to drive to the firstNode
in its private time.Gets theroute start reduction time
forIPillarNode
in milliseconds.int
Gets maximum number ofovernight stays
theResource
can do in a row.int
Gets theResources
maximum number ofovernight stays
, the default value is -1.double[]
Gets the minimal degrated capacity.int
Gets the number of defined working hours (often days) between twoovernight stays
.double
Gets the overall visit duration efficiency factor.Gets the resource depot.Gets thestay out cycle
within which the maximum number ofovernight stays
are allowed and within which the the minimumrecovery time
(days withoutovernight stays
) has to be observed.Gets the starting day of thestay out cycle
within which the maximum number ofovernight stays
are allowed and within which the the minimumrecovery time
(days withoutovernight stays
) has to be observed.double
Gets the distance threshold to be able to use anovernight stay
in meter.double
Gets the return time threshold that needs to be surpassed to be able to use anovernight stay
in seconds.javax.measure.Quantity<javax.measure.quantity.Length>
Gets the distance threshold that needs to be surpassed in order to be able to use anovernight stay
asQuantity
Length
.Gets the time threshold that needs to be surpassed in order to be able to use anovernight stay
asDuration
.Checks whether theroute start reduction time
is included in theWorkingHours
.Checks whether the potentially setroute start reduction time
can only be used for driving, not for working.Checks if aroute start reduction time
forIPillarNode
has been set.boolean
Checks whether theResource
needs to be further away from itsstarting location
than the set threshold to be able to use anovernight stay
.boolean
Checks whether theResource
needs to take longer to return to herstarting location
than the set threshold to be able to use anovernight stay
.void
setAverageCO2EmissionFactor
(double emissionFactor) Sets the average CO2 emission-factor.void
setCapacity
(double[] capacity) Sets the amount aResource
can carry of a specific good.void
setCapacity
(double[] capacity, double[] minDegratedCapacity, double[] capacityDegPerStop) Sets the capacity.void
setCapacityDegradationPerStop
(double[] capacityDegPerStop) Sets the capacity degradation per stop.void
setConnectionTimeEfficiencyFactor
(double connectionTimeEfficiencyFactor) Sets connectionTimeEfficiencyFactor, the default value is1.0
.void
setInitialLoad
(double[] initialLoad) Sets the the amount of a good that is already being carried by theResource
.void
setMaxDrivingDistanceFirstNode
(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Sets the maximal distance that theResource
needs to drive to the firstNode
.void
setMaxDrivingDistanceLastNode
(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Sets the maximal distance that theResource
needs to drive to the lastNode
.void
setMaxDrivingTimeFirstNode
(Duration maxTime) Sets the maximal driving time that theResource
is supposed to drive to the firstNode
.void
setMaxDrivingTimeLastNode
(Duration maxTime) Sets the maximal driving time that theResource
is supposed to drive to the lastNode
.boolean
setMaxFlexPreWorkingHoursDrvingTime
(Duration preWorkTime) Deprecated.please usesetMaxRouteStartReductionTime(Duration, boolean)
insteadvoid
setMaxFreePostWorkDrivingTerminationTime
(Duration nonPenalizedDrivingHomeOnOwnTimeDuration) Sets the amount of time that theResource
can be expected to drive home to its starting location in its free time.void
setMaxFreePostWorkDrivingTerminationTime
(Duration nonPenalizedDrivingHomeOnOwnTimeDuration, boolean onlyApplyOnOvertime) Sets the local max free post work driving termination time.boolean
setMaxPillarAfterHoursTime
(Duration maxPillarEndOverTime) Sets the amount of time afterWorkingHours
within which aIPillarNode
can be set.boolean
setMaxRouteStartReductionTime
(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Sets the maximum time which theResource
can be expected to drive to the firstNode
in its private time.boolean
setMaxRouteStartReductionTimePillar
(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Sets theroute start reduction time
forIPillarNode
.void
setMinimalDegratedCapacity
(double[] minDegratedCapacity) Sets the minimal degrated capacity.boolean
setOverallVisitDurationEfficiencyFactor
(double factor) Sets the overall visit duration efficiency factor.void
setReductionTimeIsIncludedInWorkingTime
(boolean isIncludedInTotalWorkingTime) Sets whether theroute start reduction time
is included in theWorkingHours
.void
setResourceDepot
(IResourceDepot depot) Sets the resource depot.void
setStayOutCycleDefinition
(Duration cycle, LocalDate cycleStart) Sets theDuration
of the cycle within which the maximum number ofovernight stays
are allowed and within which the minimumrecovery time
(WorkingHours
withoutovernight stays
) has to be observed.void
setStayOutPolicy
(double minDistanceMeter, double minTimeSeconds) Deprecated.Please usesetStayOutPolicy(Quantity, Duration)
instead.void
setStayOutPolicy
(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut, Duration minTimeForStayOut) Sets the minimal distance and time theResource
needs to be away from its starting location to be able to aovernight stay
.void
setStayOutPolicyActive
(boolean stayOutPolicyActive) Deprecated.please use the above mentioned methods insteadvoid
setStayOutPolicyReturnDistance
(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut) Sets the minimal distance aResource
needs to be away from hisstarting location
in order to be able to use anovernight stay
.void
setStayOutPolicyReturnDistanceActive
(boolean stayOutPolicyReturnDistanceActive) Sets whether theResource
needs to be further away from itsstarting location
than the set threshold to be able to use anovernight stay
.void
setStayOutPolicyReturnTime
(Duration minTimeForStayOut) Sets the minimal time aResource
would need to return to herstarting location
to be able to use anovernight stay
.void
setStayOutPolicyReturnTimeActive
(boolean stayOutPolicyReturnTimeActive) Sets whether theResource
needs to take longer to return to herstarting location
than the set threshold to be able to use anovernight stay
.void
setStaysOut
(int totalStays, int staysInRow, int minRecoverHours) Sets thetotal stays
, thestays in a row
and theminimum recovery time
of astay out cycle
.Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.dna.jopt.member.unit.resource.IBasicResource
addQualification, getAcceptableOverdistanceMeter, getAcceptableOvertimeSeconds, getAverageSpeed, getAvgSpeed, getDestinationDistMatrixId, getDestinationLatitude, getDestinationLongitude, getDestinationPosition, getFixCost, getFlexTimeMillis, getMaxDistance, getMaxHours, getMaxWorkingDistance, getMaxWorkingTime, getPerHourCost, getPerHourProductionCost, getPerKilometerCost, getQualifications, getSkillEfficiencyFactor, getStrictOverdistanceLimitMeter, getStrictOvertimeLimitSeconds, hasAlternateDestination, isEmptyAtEndOfRoute, resetAcceptableOvertime, setAcceptableOverdistance, setAcceptableOvertime, setAcceptableOvertimeSeconds, setAlternateDestination, setAvgSpeed, setAvgSpeed, setCost, setDestinationLatitude, setDestinationLongitude, setDestinationPosition, setFixCost, setFlexTime, setMaxDistance, setMaxHours, setMaxWorkingDistance, setMaxWorkingTime, setPerHourCost, setPerHourProductionCost, setPerKilometerCost, setSkillEfficiencyFactor, setStrictOverdistanceLimit, setStrictOvertimeLimit
Methods inherited from interface com.dna.jopt.member.unit.IOptimizationElement
forceSetId, getConstraintAliasId, getDistMatrixId, getDutyHours, getExtraInfo, getFlavour, getId, getLatitude, getLocationId, getLongitude, getNodeConnection, getNodeConnectionKeySet, getNodeConnections, getPosition, getPreferredHoursInteractionController, hasRealGeoLocation, putNodeConnection, putNodeConnectionFromElement, removeNodeConnection, setConstraintAliasId, setDistMatrixId, setDutyHours, setExtraInfo, setId, setLatitude, setLocationId, setLongitude, setPosition
-
Method Details
-
getCapacity
double[] getCapacity()Gets the capacity of goods aResource
can carry.For more information please see
addCapacity(double)
.- Returns:
- the double value of every member of capacity
-
addCapacity
void addCapacity(double capacity) Deprecated.Sets the amount aResource
can carry of a specific good.Several goods can be defined of which each a limited amount can be carried.
Adds the capacity.- Parameters:
capacity
- the double capacity to be added
-
setInitialLoad
void setInitialLoad(double[] initialLoad) Sets the the amount of a good that is already being carried by theResource
.For more information please see
addCapacity(double)
. If no capacity is defined, it is assumed, the initial load equals the maximal capacity.- Parameters:
initialLoad
- the double List initialLoad
-
setCapacity
void setCapacity(double[] capacity) Sets the amount aResource
can carry of a specific good.Several goods can be defined of which each a limited amount can be carried.
- Parameters:
capacity
- the new capacity
-
setCapacity
void setCapacity(double[] capacity, double[] minDegratedCapacity, double[] capacityDegPerStop) Sets the capacity.- Parameters:
capacity
- the capacityminDegratedCapacity
- the min degrated capacitycapacityDegPerStop
- the capacity deg per stop
-
getInitialLoad
double[] getInitialLoad()Gets the amount of a good that is already being carried by theResource
.For more information please see
addCapacity(double)
.- Returns:
- the double List initialLoad
-
getMaxTotalStaysOut
int getMaxTotalStaysOut()Gets theResources
maximum number ofovernight stays
, the default value is -1. In order to be able to do anovernight stay
,IWorkingHours.setIsAvailableForStay(boolean)
andINode.setIsStayNode(boolean)
have to betrue
.- Returns:
- the int totalStaysOut
-
getMaxStaysOutInRow
int getMaxStaysOutInRow()Gets maximum number ofovernight stays
theResource
can do in a row. The default value is -1. In order to be able to do anovernight stay
,IWorkingHours.setIsAvailableForStay(boolean)
andINode.setIsStayNode(boolean)
have to betrue
.- Returns:
- the int staysOutInRow
-
getMinRecoverHours
int getMinRecoverHours()Gets the number of defined working hours (often days) between twoovernight stays
. The default value is 1. In order to be able to do anovernight stay
,IWorkingHours.setIsAvailableForStay(boolean)
andINode.setIsStayNode(boolean)
have to betrue
.- Returns:
- the int minRecoverHours
-
getStayOutCycle
Gets thestay out cycle
within which the maximum number ofovernight stays
are allowed and within which the the minimumrecovery time
(days withoutovernight stays
) has to be observed. Thestay out cycle
of this method is valid for all theWorkingHours
of theResource
.For more information please see
IWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate)
. The linkedlocal stay out cycle
is only valid for theWorkingHours
it has been set tough.- Returns:
- the stay out cycle or an empty
Optional
if nostay out cycle
has been defined
-
getStayOutCycleStart
Gets the starting day of thestay out cycle
within which the maximum number ofovernight stays
are allowed and within which the the minimumrecovery time
(days withoutovernight stays
) has to be observed. Thestay out cycle
of this method is valid for all theWorkingHours
of theResource
. *For more information please see
IWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate)
. The linkedlocal stay out cycle
is only valid for theWorkingHours
it has been set tough.- Returns:
- the start of the cycle or an empty
Optional
if nostay out cycle has been defined
-
setStayOutPolicy
void setStayOutPolicy(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut, Duration minTimeForStayOut) Sets the minimal distance and time theResource
needs to be away from its starting location to be able to aovernight stay
. If this threshold is not surpassed theResource
has to return home and start from there the next day. This is treated as ahard constraint
.- Parameters:
minDistanceForStayOut
- theQuantity<Length>
minimal distance from the starting locationminTimeForStayOut
- the duration it would take to reach the starting location
-
setStayOutPolicyReturnTimeActive
void setStayOutPolicyReturnTimeActive(boolean stayOutPolicyReturnTimeActive) Sets whether theResource
needs to take longer to return to herstarting location
than the set threshold to be able to use anovernight stay
.- Parameters:
stayOutPolicyReturnTimeActive
- the boolean whether the return time threshold is active- See Also:
-
setStayOutPolicyReturnDistanceActive
void setStayOutPolicyReturnDistanceActive(boolean stayOutPolicyReturnDistanceActive) Sets whether theResource
needs to be further away from itsstarting location
than the set threshold to be able to use anovernight stay
.- Parameters:
stayOutPolicyReturnDistanceActive
- the boolean whether the return distance threshold is active- See Also:
-
isStayOutPolicyReturnTimeActive
boolean isStayOutPolicyReturnTimeActive()Checks whether theResource
needs to take longer to return to herstarting location
than the set threshold to be able to use anovernight stay
.- Returns:
- the boolean whether the return time threshold is active
- See Also:
-
isStayOutPolicyReturnDistanceActive
boolean isStayOutPolicyReturnDistanceActive()Checks whether theResource
needs to be further away from itsstarting location
than the set threshold to be able to use anovernight stay
.- Returns:
- the boolean whether the return distance threshold is active
- See Also:
-
setStayOutPolicyReturnTime
Sets the minimal time aResource
would need to return to herstarting location
to be able to use anovernight stay
. If this threshold is not surpassed theResource
has to return home and start from there the next day.- Parameters:
minTimeForStayOut
- the duration threshold within which the Resource is not allowed to use an overnight stay- See Also:
-
setStayOutPolicyReturnDistance
void setStayOutPolicyReturnDistance(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut) Sets the minimal distance aResource
needs to be away from hisstarting location
in order to be able to use anovernight stay
. If this threshold is not surpassed theResource
has to return home and start from there the next day.- Parameters:
minDistanceForStayOut
- the quantity length threshold for an overnight stay- See Also:
-
getConnectionTimeEfficiencyFactor
double getConnectionTimeEfficiencyFactor()Sets theCapacityResource.getConnectionTimeEfficiencyFactor()
, the default value is1.0
. Depending on the vehicle in use the driving time may in- or decrease.For example: Assuming a connection that has a base time of 20 minutes, a ConnectionTimeEfficiencyFactor of 0.5 would lead to a reduced time of 20*05 = 10 minutes.
- Returns:
- the double getConnectionTimeEfficiencyFactor
-
setConnectionTimeEfficiencyFactor
void setConnectionTimeEfficiencyFactor(double connectionTimeEfficiencyFactor) Sets connectionTimeEfficiencyFactor, the default value is1.0
. The input must be>= 0
, otherwise anIllegalStateException
is thrown.- Parameters:
connectionTimeEfficiencyFactor
- double to be set
-
setMaxFlexPreWorkingHoursDrvingTime
Deprecated.please usesetMaxRouteStartReductionTime(Duration, boolean)
insteadDeprecated method.- Parameters:
preWorkTime
- the duration time a resource can be expected to drive to the first node on its own time- Returns:
- false if faulty input
-
getMaxRouteStartReductionTimeMillis
Gets the maximum time which theResource
can be expected to drive to the firstNode
in its private time. Theroute start reduction time
affects all theWorkingHours
of thatResource
.The
route start reduction time
is valid for allWorkingHours
of aResource
. For more information please seesetMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Returns:
- the optional Long milliseconds of the routestart reduction time
-
isReductionTimeIncludedInWorkingTime
Checks whether theroute start reduction time
is included in theWorkingHours
. The default value isfalse
. Iffalse
andsetMaxRouteStartReductionTime(Duration, boolean)
is set totrue
the driving time to the firstNode
has to be done in theResources
private time.The
route start reduction time
is valid for allWorkingHours
of aResource
. For more information please seesetMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Returns:
- the optional with the boolean or an empty optional if no reduction time has been set
-
isReductionTimeOnlyUsedForDriving
Checks whether the potentially setroute start reduction time
can only be used for driving, not for working. Per default this is set totrue
. In this case theroute start reduction time
is valid for allWorkingHours
of thatResource
.The
route start reduction time
is valid for allWorkingHours
of aResource
. For more information please seesetMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Returns:
- the optional boolean if the time can only be used for driving, returns an empty optional if no reduction time has been set
-
getMaxRouteStartReductionTimeMillisPillar
Gets theroute start reduction time
forIPillarNode
in milliseconds.The
route start reduction time
is valid for allWorkingHours
of aResource
. For more information please seesetMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Returns:
- the optional long milliseconds, returns an empty optional if no reduction time has been set
-
isReductionTimeOnlyUsedForDrivingPillar
Checks if aroute start reduction time
forIPillarNode
has been set.For more information please see
setMaxRouteStartReductionTimePillar(Duration, boolean)
. For a method that only affects a specific set ofWorkingHours
please seeIWorkingHours.setLocalMaxRouteStartReductionTimePillar(Duration, boolean)
.- Returns:
- the optional boolean whether reduction time for pillars has been set
-
setMaxRouteStartReductionTime
boolean setMaxRouteStartReductionTime(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Sets the maximum time which theResource
can be expected to drive to the firstNode
in its private time.If the
OpeningHours
of aNode
and theWorkingHours
of aResource
start at 8 the driving time is an hour and theResource
'sroute start reduction time
is 30 Minutes theResource
will start driving towards theNode
at 7.30 (outside of itsWorkingHours
) and arrive there at 8.30.The
Boolean
defines whether theroute start reduction time
can only be used for driving or not and is usually set totrue
. TheResource
can not work in theroute start reduction time
in that case.The
route start reduction time
is valid for allWorkingHours
of aResource
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use the local methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
- Parameters:
maxRouteStartReductionTime
- the duration time the resource has to drive to work on its own timeisOnlyUsedForDriving
- if the route start reduction time can only be used for driving- Returns:
- false if reductionTime is null or negative
-
setMaxRouteStartReductionTimePillar
boolean setMaxRouteStartReductionTimePillar(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Sets theroute start reduction time
forIPillarNode
. Overwrites the setroute start reduction time
that is valid forINodes
and sets the new value forPillars
. If noroute start reduction time
has been set, sets the new value forPillars
only.The
Boolean
defines whether theroute start reduction time
can only be used for driving or not and is usually set totrue
.For more information please see
setMaxRouteStartReductionTime(Duration, boolean)
.- Parameters:
maxRouteStartReductionTime
- the duration time the resource has to drive to work on its own timeisOnlyUsedForDriving
- if the route start reduction time can only be used for driving- Returns:
- false if reductionTime is null or negative
-
setReductionTimeIsIncludedInWorkingTime
void setReductionTimeIsIncludedInWorkingTime(boolean isIncludedInTotalWorkingTime) Sets whether theroute start reduction time
is included in theWorkingHours
. The default value isfalse
. Iffalse
andsetMaxRouteStartReductionTime(Duration, boolean)
is set totrue
the driving time to the firstNode
has to be done in theResources
private time.For more information on
route start reduction time
please see the link above.- Parameters:
isIncludedInTotalWorkingTime
- the boolean whether reduction time is included in the WorkingHours
-
setMaxPillarAfterHoursTime
Sets the amount of time afterWorkingHours
within which aIPillarNode
can be set. TheResources
have to visit thisPillar
even tough it is outside ofWorkingHours
.This method sets the same time for all
WorkingHours
. If you want to set the time for a specific set ofWorkingHours
please useIWorkingHours.setLocalMaxPillarAfterHoursTime(Duration)
.- Parameters:
maxPillarEndOverTime
- the duration after WorkingHours within which a Pillar still has to be given service- Returns:
- true if the setting was accepted
-
getMaxPillarAfterHoursTime
Gets themaximal pillar after hours time
in milliseconds.For more information please see
setMaxPillarAfterHoursTime(Duration)
.- Returns:
- the optional long pillar after hours time
-
setStaysOut
void setStaysOut(int totalStays, int staysInRow, int minRecoverHours) Sets thetotal stays
, thestays in a row
and theminimum recovery time
of astay out cycle
. Theminimum recovery time
is counted in number ofWorkingHours
, which often but not necessarily are days.For more information on
stay out cycle
that is valid for allWorkingHours
of aResource
please seesetStayOutCycleDefinition(Duration, LocalDate)
. For thelocal
method that only affects specificWorkingHours
please seeIWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate)
.- Parameters:
totalStays
- the int for maximum stays outstaysInRow
- the int for maximum stays out in rowminRecoverHours
- the int for minimum number of hours at base before new stay out is allowed
-
setStayOutCycleDefinition
Sets theDuration
of the cycle within which the maximum number ofovernight stays
are allowed and within which the minimumrecovery time
(WorkingHours
withoutovernight stays
) has to be observed. Theminimum recovery time
is counted in number ofWorkingHours
, which often but not necessarily are days.Without setting the cycle the maximal number of
overnight stays
will not be refreshed and count for the full duration of theWorkingHours
. The cycle is applied to allWorkingHours
of theResource
throughout theOptimization
.If the cycle should only be applied to specific
WorkingHours
so it can change depending on the dates or days in the week (i.e. noovernight stays
on Fridays please useIWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate)
.- Parameters:
cycle
- the duration of the cyclecycleStart
- the localDate day of the cycle start
-
setStayOutPolicyActive
void setStayOutPolicyActive(boolean stayOutPolicyActive) Deprecated.please use the above mentioned methods insteadDeprecated methodSets both
setStayOutPolicyReturnDistanceActive(boolean)
andsetStayOutPolicyReturnTimeActive(boolean)
to
true
.For more information please see
setStayOutPolicy(Quantity, Duration)
.- Parameters:
stayOutPolicyActive
- the boolean whether the return distance and the return time threshold are active
-
setStayOutPolicy
Deprecated.Please usesetStayOutPolicy(Quantity, Duration)
instead.Deprecated method.Sets the minimal distance in
meter
and time inseconds
theResource
would need to return to his starting location which makes it eligible to do anovernight stay
.- Parameters:
minDistanceMeter
- the double distance threshold to be set in meterminTimeSeconds
- the double time threshold to be set in seconds
-
getStayOutPolicyMinDistance
double getStayOutPolicyMinDistance()Gets the distance threshold to be able to use anovernight stay
in meter.For more information please see
setStayOutPolicy(Quantity, Duration)
.- Returns:
- the double distance threshold in meter
-
getStayOutPolicyMinTime
double getStayOutPolicyMinTime()Gets the return time threshold that needs to be surpassed to be able to use anovernight stay
in seconds.For more information please see
setStayOutPolicy(Quantity, Duration)
.- Returns:
- the double return time threshold in seconds
-
getMaxFreePostWorkDrivingTerminationTimeMillis
Gets the amount of time in milliseconds that theResource
can be expected to drive home to its starting location in its free time.For more information please see
setMaxFreePostWorkDrivingTerminationTime(Duration)
.- Returns:
- the optional long milliseconds or an empty optional if no free post work driving termination time has been set
-
setMaxFreePostWorkDrivingTerminationTime
Sets the amount of time that theResource
can be expected to drive home to its starting location in its free time.If returning from the last
Node
to the starting location takes 1 hour and thefreePostWorkDrivingTerminationTime
is set to 40 minutes, those 40 minutes of the drive home are considered private time.This method sets the
free post work driving
for all theWorkingHours
of theResource
. If different times hove to be set for specificWorkingHours
please useIWorkingHours.setLocalMaxFreePostWorkDrivingTerminationTime(Duration)
- Parameters:
nonPenalizedDrivingHomeOnOwnTimeDuration
- the duration of the drive home that has to be done in the free time
-
setMaxFreePostWorkDrivingTerminationTime
void setMaxFreePostWorkDrivingTerminationTime(Duration nonPenalizedDrivingHomeOnOwnTimeDuration, boolean onlyApplyOnOvertime) Sets the local max free post work driving termination time. If onlyApplyOnOvertime is true, the post driving time is only utilized if the route shows overtime. Moreover, the maximal utilized time is the overtime itself (or, if lower, the postWorkingHourTimeReductionTime).- Parameters:
nonPenalizedDrivingHomeOnOwnTimeDuration
- the non penalized driving home on own time durationonlyApplyOnOvertime
- the only apply on overtime
-
isOnlyApplyFreePostWorkDrivingOnOvertime
-
getStayOutPolicyReturnTime
Duration getStayOutPolicyReturnTime()Gets the time threshold that needs to be surpassed in order to be able to use anovernight stay
asDuration
.- Returns:
- the duration of the time threshold
- See Also:
-
getStayOutPolicyReturnDistance
javax.measure.Quantity<javax.measure.quantity.Length> getStayOutPolicyReturnDistance()Gets the distance threshold that needs to be surpassed in order to be able to use anovernight stay
asQuantity
Length
.- Returns:
- the quantity length distance threshold
- See Also:
-
addConstraint
Adds anIConstraint
to theResource
so it can only give service to theNodes
that have the appropriateIQualification
.Used by
UKPostCode
.- Parameters:
constraint
- the iResourceLevelConstraint to which it will be limited
-
getConstraints
List<IResourceLevelConstraint> getConstraints()Gets theIConstraint
from theResource
that it is limited to.For more information please see
addConstraint(IResourceLevelConstraint)
.- Returns:
- the constraint of the resource
-
setMaxDrivingDistanceFirstNode
void setMaxDrivingDistanceFirstNode(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Sets the maximal distance that theResource
needs to drive to the firstNode
.- Parameters:
maxDistance
- the quantity length maximal distance to the first Node
-
getMaxDrivingDistanceFirstNode
Optional<javax.measure.Quantity<javax.measure.quantity.Length>> getMaxDrivingDistanceFirstNode()Gets the maximal distance that theResource
needs to drive to the firstNode
.- Returns:
- the optional quantity length of the distance, an empty optional if no value has been set
- See Also:
-
setMaxDrivingDistanceLastNode
void setMaxDrivingDistanceLastNode(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Sets the maximal distance that theResource
needs to drive to the lastNode
.- Parameters:
maxDistance
- the quantity length maximal distance
-
getMaxDrivingDistanceLastNode
Optional<javax.measure.Quantity<javax.measure.quantity.Length>> getMaxDrivingDistanceLastNode()Gets the maximal distance that theResource
needs to drive to the lastNode
.- Returns:
- the optional quantity length distance or an empty optional
- See Also:
-
setMaxDrivingTimeFirstNode
Sets the maximal driving time that theResource
is supposed to drive to the firstNode
.- Parameters:
maxTime
- the duration maximal time
-
getMaxDrivingTimeFirstNode
Gets the maximal driving time that theResource
is supposed to drive to the firstNode
.- Returns:
- the optional duration or an empty optional if no value has been set
- See Also:
-
setMaxDrivingTimeLastNode
Sets the maximal driving time that theResource
is supposed to drive to the lastNode
.- Parameters:
maxTime
- the duration maximal time
-
getMaxDrivingTimeLastNode
Gets the maximal driving time that theResource
is supposed to drive to the lastNode
.- Returns:
- the optional duration or an empty optional if no value has been set
- See Also:
-
setResourceDepot
Sets the resource depot.- Parameters:
depot
- the new resource depot
-
getResourceDepot
Optional<IResourceDepot> getResourceDepot()Gets the resource depot.- Returns:
- the resource depot
-
getOverallVisitDurationEfficiencyFactor
double getOverallVisitDurationEfficiencyFactor()Gets the overall visit duration efficiency factor.- Returns:
- the overall visit duration efficiency factor
-
setOverallVisitDurationEfficiencyFactor
boolean setOverallVisitDurationEfficiencyFactor(double factor) Sets the overall visit duration efficiency factor.- Parameters:
factor
- the factor- Returns:
- true, if successful
-
getMinimalDegratedCapacity
double[] getMinimalDegratedCapacity()Gets the minimal degrated capacity.- Returns:
- the minimal degrated capacity
-
getCapacityDegradationPerStop
double[] getCapacityDegradationPerStop()Gets the capacity degradation per stop.- Returns:
- the capacity degradation per stop
-
setMinimalDegratedCapacity
void setMinimalDegratedCapacity(double[] minDegratedCapacity) Sets the minimal degrated capacity.- Parameters:
minDegratedCapacity
- the new minimal degrated capacity
-
setCapacityDegradationPerStop
void setCapacityDegradationPerStop(double[] capacityDegPerStop) Sets the capacity degradation per stop.- Parameters:
capacityDegPerStop
- the new capacity degradation per stop
-
setAverageCO2EmissionFactor
void setAverageCO2EmissionFactor(double emissionFactor) Sets the average CO2 emission-factor. The default value is 0.377 [kgCO2/km]. This is approximately the emission factor of a vehicle with an average fuel consumption of 12-litre diesel per 100 km.- Parameters:
emissionFactor
- the new average CO2 emission factor
-
getAverageCO2EmissionFactor
double getAverageCO2EmissionFactor()Gets the average CO2 emission factor. The default value is 0.377 [kgCO2/km]. This is approximately the emission factor of a vehicle with an average fuel consumption of 12-litre diesel per 100 km.- Returns:
- the average CO2 emission factor
-
Resource
can carry of a specific good.