Class CapacityResource
- All Implemented Interfaces:
IOptimizationElement
,IBasicResource
,IResource
,Serializable
,Comparable<IBasicResource>
IResource
is the unit in the Optimization
that is visiting the INode
and doing the work.
A CapacityResource
has a home location, indicated by the latitude
and
longitude
from which it starts ond to which it usually returns after the end of a route
.
In the constructor a maximum time
and distance
has to be specified within which
the CapacityResource
should end the route
. The IWorkingHours
specify on
which dates and at which time of the day the CapacityResource
should work. If the
CapacityResource
is scheduled to work outside of these parameters IViolation
are adding more internal cost to that route.
- Since:
- 13/08/2019
- Version:
- 13/08/2019
- Author:
- DNA
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.dna.jopt.member.unit.IOptimizationElement
IOptimizationElement.OptimizationElementFlavour
-
Field Summary
Fields inherited from class com.dna.jopt.member.unit.AbstractOptimizationElement
dutyHours
-
Constructor Summary
ConstructorDescriptionLoad *CapacityResource
(String resourceId, double latitude, double longitude, double maxHours, double maxDistance, WorkingHours[] workingHours) Deprecated.CapacityResource
(String resourceId, double latitude, double longitude, double maxHours, double maxDistance, List<IDutyHours> workingHours) Deprecated.please useCapacityResource(String, double, double, Duration, Quantity, List)
with updated parameters.CapacityResource
(String resourceId, double latitude, double longitude, Duration maxTime, javax.measure.Quantity<javax.measure.quantity.Length> maxDistance, List<IWorkingHours> workingHours) The constructor for theCapacityResource
.CapacityResource
(String resourceId, com.dna.jopt.config.types.Position pos, Duration maxTime, javax.measure.Quantity<javax.measure.quantity.Length> maxDistance, List<IWorkingHours> workingHours) -
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
.boolean
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 thegetConnectionTimeEfficiencyFactor()
, 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
.int
hashCode()
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.void
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 postTimeReductionTime, 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.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.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
.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 totalStaysOut, int staysOutInRow, int minRecoverHours) Sets thetotal stays
, thestays in a row
and theminimum recovery time
of astay out cycle
.Methods inherited from class com.dna.jopt.member.unit.resource.AbstractBasicCapacityResource
addQualification, compareTo, copyWithNewId, getAcceptableOverdistanceMeter, getAcceptableOvertimeSeconds, getAverageSpeed, getAvgSpeed, getDestinationDistMatrixId, getDestinationLatitude, getDestinationLongitude, getDestinationPosition, getFixCost, getFlavour, getFlexTimeMillis, getMaxDistance, getMaxHours, getMaxWorkingDistance, getMaxWorkingTime, getPerHourCost, getPerHourProductionCost, getPerKilometerCost, getQualifications, getResourceId, getSkillEfficiencyFactor, getStrictOverdistanceLimitMeter, getStrictOvertimeLimitSeconds, hasAlternateDestination, hasRealGeoLocation, isEmptyAtEndOfRoute, resetAcceptableOvertime, setAcceptableOverdistance, setAcceptableOvertime, setAcceptableOvertimeSeconds, setAlternateDestination, setAvgSpeed, setAvgSpeed, setCost, setDestinationDistMatrixId, setDestinationLatitude, setDestinationLongitude, setDestinationPosition, setFixCost, setFlexTime, setMaxDistance, setMaxHours, setMaxWorkingDistance, setMaxWorkingTime, setPerHourCost, setPerHourProductionCost, setPerKilometerCost, setResourceId, setSkillEfficiencyFactor, setStrictOverdistanceLimit, setStrictOvertimeLimit, setWorkingHours, toString
Methods inherited from class com.dna.jopt.member.unit.AbstractOptimizationElement
forceSetId, getConstraintAliasId, getDistMatrixId, getDutyHours, getExtraInfo, getId, getLatitude, getLocationId, getLongitude, getNodeConnection, getNodeConnectionKeySet, getNodeConnections, getPosition, getPreferredHoursInteractionController, putNodeConnection, putNodeConnectionFromElement, removeNodeConnection, setConstraintAliasId, setDistMatrixId, setDutyHours, setExtraInfo, setId, setLatitude, setLocationId, setLongitude, setPosition
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
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
-
Constructor Details
-
CapacityResource
public CapacityResource()Load * -
CapacityResource
public CapacityResource(String resourceId, double latitude, double longitude, Duration maxTime, javax.measure.Quantity<javax.measure.quantity.Length> maxDistance, List<IWorkingHours> workingHours) The constructor for theCapacityResource
.Implementation example:
Attention: Make sure that each Resource has its own independent list of WorkingHours. Further, make sure that each WorkingHour Object is also unique and is not shared in the List of another resource.Duration maxWorkingTime = Duration.ofHours(13); Quantity<Length> maxDistanceKmW = Quantities.getQuantity(1200.0, KILO(METRE)); CapacityResource rep1 = new CapacityResource( "Jack", 50.775346, 6.083887, maxWorkingTime, maxDistanceKmW, workingHours); rep1.setDestinationLatitude(51.45); rep1.setDestinationLongitude(7.01667); rep1.setAlternateDestination(true); rep1.setCost(0, 1, 1); // Adding a qualification to the resource: IQualification typeQualification = new TypeQualification(); ((TypeQualification) typeQualification).addType("plumbing"); rep1.addQualification(typeQualification); this.addElement(rep1);
- Parameters:
resourceId
- the string name of the resourcelatitude
- the double latitude of the resources home locationlongitude
- the double longitude of the resources home locationmaxTime
- the duration maximum time that could be used for workmaxDistance
- the length maximal distance the capacityResource is allowed to driveworkingHours
- the iWorkinghours within which the capacityResource operates
-
CapacityResource
public CapacityResource(String resourceId, com.dna.jopt.config.types.Position pos, Duration maxTime, javax.measure.Quantity<javax.measure.quantity.Length> maxDistance, List<IWorkingHours> workingHours) -
CapacityResource
@Deprecated public CapacityResource(String resourceId, double latitude, double longitude, double maxHours, double maxDistance, List<IDutyHours> workingHours) Deprecated.please useCapacityResource(String, double, double, Duration, Quantity, List)
with updated parameters.This is adeprecated
constructor that should not be used anymore since it is using the maximum working time as adouble
whereas the new constructor uses aDuration
. Likewise thedouble
maximal distance has been replaced byQuantity<length>
.Attention: Make sure that each Resource has its own independent list of WorkingHours. Further, make sure that each WorkingHour Object is also unique and is not shared in the List of another resource.
- Parameters:
resourceId
- resourceIdlatitude
- latitudelongitude
- longitudemaxHours
- maxHoursmaxDistance
- maxDistanceworkingHours
- workingHours
-
CapacityResource
@Deprecated public CapacityResource(String resourceId, double latitude, double longitude, double maxHours, double maxDistance, WorkingHours[] workingHours) Deprecated.please useCapacityResource(String, double, double, Duration, Quantity, List)
with updated parameters.- Parameters:
resourceId
- the resource idlatitude
- the latitudelongitude
- the longitudemaxHours
- the max hoursmaxDistance
- the max distanceworkingHours
- the working hours- Category:
- Legacy
LEGACY CONSTRUCTOR
Instantiates a new capacity resource.
PLEASE DO NOT USE THIS CONSTRUCTOR ANYMORE! IT WILL BE REMOVED IN FUTURE VERSIONS
-
-
Method Details
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractBasicCapacityResource
-
equals
- Overrides:
equals
in classAbstractBasicCapacityResource
-
setMaxPillarAfterHoursTime
Description copied from interface:IResource
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)
.- Specified by:
setMaxPillarAfterHoursTime
in interfaceIResource
- Parameters:
maxPillarEndOverTime
- the duration after WorkingHours within which a Pillar still has to be given service- Returns:
- true if the setting was accepted
-
getMaxPillarAfterHoursTime
Description copied from interface:IResource
Gets themaximal pillar after hours time
in milliseconds.For more information please see
IResource.setMaxPillarAfterHoursTime(Duration)
.- Specified by:
getMaxPillarAfterHoursTime
in interfaceIResource
- Returns:
- the optional long pillar after hours time
-
setReductionTimeIsIncludedInWorkingTime
public void setReductionTimeIsIncludedInWorkingTime(boolean isIncludedInTotalWorkingTime) Description copied from interface:IResource
Sets whether theroute start reduction time
is included in theWorkingHours
. The default value isfalse
. Iffalse
andIResource.setMaxRouteStartReductionTime(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.- Specified by:
setReductionTimeIsIncludedInWorkingTime
in interfaceIResource
- Parameters:
isIncludedInTotalWorkingTime
- the boolean whether reduction time is included in the WorkingHours
-
setMaxRouteStartReductionTime
public boolean setMaxRouteStartReductionTime(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Description copied from interface:IResource
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)
- Specified by:
setMaxRouteStartReductionTime
in interfaceIResource
- 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
public boolean setMaxRouteStartReductionTimePillar(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Description copied from interface:IResource
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
IResource.setMaxRouteStartReductionTime(Duration, boolean)
.- Specified by:
setMaxRouteStartReductionTimePillar
in interfaceIResource
- 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
-
isReductionTimeOnlyUsedForDriving
Description copied from interface:IResource
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 seeIResource.setMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Specified by:
isReductionTimeOnlyUsedForDriving
in interfaceIResource
- Returns:
- the optional boolean if the time can only be used for driving, returns an empty optional if no reduction time has been set
-
isReductionTimeIncludedInWorkingTime
Description copied from interface:IResource
Checks whether theroute start reduction time
is included in theWorkingHours
. The default value isfalse
. Iffalse
andIResource.setMaxRouteStartReductionTime(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 seeIResource.setMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Specified by:
isReductionTimeIncludedInWorkingTime
in interfaceIResource
- Returns:
- the optional with the boolean or an empty optional if no reduction time has been set
-
getMaxRouteStartReductionTimeMillis
Description copied from interface:IResource
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 seeIResource.setMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Specified by:
getMaxRouteStartReductionTimeMillis
in interfaceIResource
- Returns:
- the optional Long milliseconds of the routestart reduction time
-
isReductionTimeOnlyUsedForDrivingPillar
Description copied from interface:IResource
Checks if aroute start reduction time
forIPillarNode
has been set.For more information please see
IResource.setMaxRouteStartReductionTimePillar(Duration, boolean)
. For a method that only affects a specific set ofWorkingHours
please seeIWorkingHours.setLocalMaxRouteStartReductionTimePillar(Duration, boolean)
.- Specified by:
isReductionTimeOnlyUsedForDrivingPillar
in interfaceIResource
- Returns:
- the optional boolean whether reduction time for pillars has been set
-
getMaxRouteStartReductionTimeMillisPillar
Description copied from interface:IResource
Gets theroute start reduction time
forIPillarNode
in milliseconds.The
route start reduction time
is valid for allWorkingHours
of aResource
. For more information please seeIResource.setMaxRouteStartReductionTime(Duration, boolean)
. If aroute start reduction time
has to be valid for only one set ofWorkingHours
please use thelocal
methodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean)
.- Specified by:
getMaxRouteStartReductionTimeMillisPillar
in interfaceIResource
- Returns:
- the optional long milliseconds, returns an empty optional if no reduction time has been set
-
setMaxFreePostWorkDrivingTerminationTime
public void setMaxFreePostWorkDrivingTerminationTime(Duration nonPenalizedDrivingHomeOnOwnTimeDuration) Description copied from interface:IResource
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)
- Specified by:
setMaxFreePostWorkDrivingTerminationTime
in interfaceIResource
- Parameters:
nonPenalizedDrivingHomeOnOwnTimeDuration
- the duration of the drive home that has to be done in the free time
-
setMaxFreePostWorkDrivingTerminationTime
public void setMaxFreePostWorkDrivingTerminationTime(Duration postTimeReductionTime, boolean onlyApplyOnOvertime) Description copied from interface:IResource
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).- Specified by:
setMaxFreePostWorkDrivingTerminationTime
in interfaceIResource
- Parameters:
postTimeReductionTime
- the non penalized driving home on own time durationonlyApplyOnOvertime
- the only apply on overtime
-
isOnlyApplyFreePostWorkDrivingOnOvertime
- Specified by:
isOnlyApplyFreePostWorkDrivingOnOvertime
in interfaceIResource
-
getMaxFreePostWorkDrivingTerminationTimeMillis
Description copied from interface:IResource
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
IResource.setMaxFreePostWorkDrivingTerminationTime(Duration)
.- Specified by:
getMaxFreePostWorkDrivingTerminationTimeMillis
in interfaceIResource
- Returns:
- the optional long milliseconds or an empty optional if no free post work driving termination time has been set
-
setMaxFlexPreWorkingHoursDrvingTime
Deprecated.Description copied from interface:IResource
Deprecated method.- Specified by:
setMaxFlexPreWorkingHoursDrvingTime
in interfaceIResource
- 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
-
setStaysOut
public void setStaysOut(int totalStaysOut, int staysOutInRow, int minRecoverHours) Description copied from interface:IResource
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 seeIResource.setStayOutCycleDefinition(Duration, LocalDate)
. For thelocal
method that only affects specificWorkingHours
please seeIWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate)
.- Specified by:
setStaysOut
in interfaceIResource
- Parameters:
totalStaysOut
- the int for maximum stays outstaysOutInRow
- the int for maximum stays out in rowminRecoverHours
- the int for minimum number of hours at base before new stay out is allowed
-
setStayOutCycleDefinition
Description copied from interface:IResource
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)
.- Specified by:
setStayOutCycleDefinition
in interfaceIResource
- Parameters:
cycle
- the duration of the cyclecycleStart
- the localDate day of the cycle start
-
getMaxTotalStaysOut
public int getMaxTotalStaysOut()Description copied from interface:IResource
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
.- Specified by:
getMaxTotalStaysOut
in interfaceIResource
- Returns:
- the int totalStaysOut
-
getMaxStaysOutInRow
public int getMaxStaysOutInRow()Description copied from interface:IResource
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
.- Specified by:
getMaxStaysOutInRow
in interfaceIResource
- Returns:
- the int staysOutInRow
-
getMinRecoverHours
public int getMinRecoverHours()Description copied from interface:IResource
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
.- Specified by:
getMinRecoverHours
in interfaceIResource
- Returns:
- the int minRecoverHours
-
getStayOutCycle
Description copied from interface:IResource
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.- Specified by:
getStayOutCycle
in interfaceIResource
- Returns:
- the stay out cycle or an empty
Optional
if nostay out cycle
has been defined
-
getStayOutCycleStart
Description copied from interface:IResource
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.- Specified by:
getStayOutCycleStart
in interfaceIResource
- Returns:
- the start of the cycle or an empty
Optional
if nostay out cycle has been defined
-
setStayOutPolicyActive
Deprecated.Description copied from interface:IResource
Deprecated methodSets both
IResource.setStayOutPolicyReturnDistanceActive(boolean)
andIResource.setStayOutPolicyReturnTimeActive(boolean)
to
true
.For more information please see
IResource.setStayOutPolicy(Quantity, Duration)
.- Specified by:
setStayOutPolicyActive
in interfaceIResource
- Parameters:
stayOutPolicyActive
- the boolean whether the return distance and the return time threshold are active
-
setStayOutPolicyReturnTimeActive
public void setStayOutPolicyReturnTimeActive(boolean stayOutPolicyReturnTimeActive) Description copied from interface:IResource
Sets whether theResource
needs to take longer to return to herstarting location
than the set threshold to be able to use anovernight stay
.- Specified by:
setStayOutPolicyReturnTimeActive
in interfaceIResource
- Parameters:
stayOutPolicyReturnTimeActive
- the boolean whether the return time threshold is active- See Also:
-
isStayOutPolicyReturnTimeActive
public boolean isStayOutPolicyReturnTimeActive()Description copied from interface:IResource
Checks whether theResource
needs to take longer to return to herstarting location
than the set threshold to be able to use anovernight stay
.- Specified by:
isStayOutPolicyReturnTimeActive
in interfaceIResource
- Returns:
- the boolean whether the return time threshold is active
- See Also:
-
setStayOutPolicyReturnDistanceActive
public void setStayOutPolicyReturnDistanceActive(boolean stayOutPolicyReturnDistanceActive) Description copied from interface:IResource
Sets whether theResource
needs to be further away from itsstarting location
than the set threshold to be able to use anovernight stay
.- Specified by:
setStayOutPolicyReturnDistanceActive
in interfaceIResource
- Parameters:
stayOutPolicyReturnDistanceActive
- the boolean whether the return distance threshold is active- See Also:
-
isStayOutPolicyReturnDistanceActive
public boolean isStayOutPolicyReturnDistanceActive()Description copied from interface:IResource
Checks whether theResource
needs to be further away from itsstarting location
than the set threshold to be able to use anovernight stay
.- Specified by:
isStayOutPolicyReturnDistanceActive
in interfaceIResource
- Returns:
- the boolean whether the return distance threshold is active
- See Also:
-
setStayOutPolicy
Deprecated.Description copied from interface:IResource
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
.- Specified by:
setStayOutPolicy
in interfaceIResource
- Parameters:
minDistanceMeter
- the double distance threshold to be set in meterminTimeSeconds
- the double time threshold to be set in seconds
-
setStayOutPolicy
public void setStayOutPolicy(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut, Duration minTimeForStayOut) Description copied from interface:IResource
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
.- Specified by:
setStayOutPolicy
in interfaceIResource
- Parameters:
minDistanceForStayOut
- theQuantity<Length>
minimal distance from the starting locationminTimeForStayOut
- the duration it would take to reach the starting location
-
setStayOutPolicyReturnTime
Description copied from interface:IResource
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.- Specified by:
setStayOutPolicyReturnTime
in interfaceIResource
- Parameters:
minTimeForStayOut
- the duration threshold within which the Resource is not allowed to use an overnight stay- See Also:
-
getStayOutPolicyReturnTime
Description copied from interface:IResource
Gets the time threshold that needs to be surpassed in order to be able to use anovernight stay
asDuration
.- Specified by:
getStayOutPolicyReturnTime
in interfaceIResource
- Returns:
- the duration of the time threshold
- See Also:
-
setStayOutPolicyReturnDistance
public void setStayOutPolicyReturnDistance(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut) Description copied from interface:IResource
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.- Specified by:
setStayOutPolicyReturnDistance
in interfaceIResource
- Parameters:
minDistanceForStayOut
- the quantity length threshold for an overnight stay- See Also:
-
getStayOutPolicyReturnDistance
public javax.measure.Quantity<javax.measure.quantity.Length> getStayOutPolicyReturnDistance()Description copied from interface:IResource
Gets the distance threshold that needs to be surpassed in order to be able to use anovernight stay
asQuantity
Length
.- Specified by:
getStayOutPolicyReturnDistance
in interfaceIResource
- Returns:
- the quantity length distance threshold
- See Also:
-
getStayOutPolicyMinDistance
public double getStayOutPolicyMinDistance()Description copied from interface:IResource
Gets the distance threshold to be able to use anovernight stay
in meter.For more information please see
IResource.setStayOutPolicy(Quantity, Duration)
.- Specified by:
getStayOutPolicyMinDistance
in interfaceIResource
- Returns:
- the double distance threshold in meter
-
getStayOutPolicyMinTime
public double getStayOutPolicyMinTime()Description copied from interface:IResource
Gets the return time threshold that needs to be surpassed to be able to use anovernight stay
in seconds.For more information please see
IResource.setStayOutPolicy(Quantity, Duration)
.- Specified by:
getStayOutPolicyMinTime
in interfaceIResource
- Returns:
- the double return time threshold in seconds
-
getConnectionTimeEfficiencyFactor
public double getConnectionTimeEfficiencyFactor()Description copied from interface:IResource
Sets thegetConnectionTimeEfficiencyFactor()
, 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.
- Specified by:
getConnectionTimeEfficiencyFactor
in interfaceIResource
- Returns:
- the double getConnectionTimeEfficiencyFactor
-
setConnectionTimeEfficiencyFactor
public void setConnectionTimeEfficiencyFactor(double connectionTimeEfficiencyFactor) Description copied from interface:IResource
Sets connectionTimeEfficiencyFactor, the default value is1.0
. The input must be>= 0
, otherwise anIllegalStateException
is thrown.- Specified by:
setConnectionTimeEfficiencyFactor
in interfaceIResource
- Parameters:
connectionTimeEfficiencyFactor
- double to be set
-
addCapacity
Deprecated.Description copied from interface:IResource
Adds the capacity.- Specified by:
addCapacity
in interfaceIResource
- Parameters:
capacity
- the double capacity to be added
-
setCapacity
public void setCapacity(double[] capacity) Description copied from interface:IResource
Sets the amount aResource
can carry of a specific good.Several goods can be defined of which each a limited amount can be carried.
- Specified by:
setCapacity
in interfaceIResource
- Parameters:
capacity
- the new capacity
-
getCapacity
public double[] getCapacity()Description copied from interface:IResource
Gets the capacity of goods aResource
can carry.For more information please see
IResource.addCapacity(double)
.- Specified by:
getCapacity
in interfaceIResource
- Returns:
- the double value of every member of capacity
-
setCapacity
public void setCapacity(double[] capacity, double[] minDegratedCapacity, double[] capacityDegPerStop) Description copied from interface:IResource
Sets the capacity.- Specified by:
setCapacity
in interfaceIResource
- Parameters:
capacity
- the capacityminDegratedCapacity
- the min degrated capacitycapacityDegPerStop
- the capacity deg per stop
-
setMinimalDegratedCapacity
public void setMinimalDegratedCapacity(double[] minDegratedCapacity) Description copied from interface:IResource
Sets the minimal degrated capacity.- Specified by:
setMinimalDegratedCapacity
in interfaceIResource
- Parameters:
minDegratedCapacity
- the new minimal degrated capacity
-
getMinimalDegratedCapacity
public double[] getMinimalDegratedCapacity()Description copied from interface:IResource
Gets the minimal degrated capacity.- Specified by:
getMinimalDegratedCapacity
in interfaceIResource
- Returns:
- the minimal degrated capacity
-
setCapacityDegradationPerStop
public void setCapacityDegradationPerStop(double[] capacityDegPerStop) Description copied from interface:IResource
Sets the capacity degradation per stop.- Specified by:
setCapacityDegradationPerStop
in interfaceIResource
- Parameters:
capacityDegPerStop
- the new capacity degradation per stop
-
getCapacityDegradationPerStop
public double[] getCapacityDegradationPerStop()Description copied from interface:IResource
Gets the capacity degradation per stop.- Specified by:
getCapacityDegradationPerStop
in interfaceIResource
- Returns:
- the capacity degradation per stop
-
setInitialLoad
public void setInitialLoad(double[] initialLoad) Description copied from interface:IResource
Sets the the amount of a good that is already being carried by theResource
.For more information please see
IResource.addCapacity(double)
. If no capacity is defined, it is assumed, the initial load equals the maximal capacity.- Specified by:
setInitialLoad
in interfaceIResource
- Parameters:
initialLoad
- the double List initialLoad
-
getInitialLoad
public double[] getInitialLoad()Description copied from interface:IResource
Gets the amount of a good that is already being carried by theResource
.For more information please see
IResource.addCapacity(double)
.- Specified by:
getInitialLoad
in interfaceIResource
- Returns:
- the double List initialLoad
-
addConstraint
Description copied from interface:IResource
Adds anIConstraint
to theResource
so it can only give service to theNodes
that have the appropriateIQualification
.Used by
UKPostCode
.- Specified by:
addConstraint
in interfaceIResource
- Parameters:
constraint
- the iResourceLevelConstraint to which it will be limited
-
getConstraints
Description copied from interface:IResource
Gets theIConstraint
from theResource
that it is limited to.For more information please see
IResource.addConstraint(IResourceLevelConstraint)
.- Specified by:
getConstraints
in interfaceIResource
- Returns:
- the constraint of the resource
-
setMaxDrivingDistanceFirstNode
public void setMaxDrivingDistanceFirstNode(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Description copied from interface:IResource
Sets the maximal distance that theResource
needs to drive to the firstNode
.- Specified by:
setMaxDrivingDistanceFirstNode
in interfaceIResource
- Parameters:
maxDistance
- the quantity length maximal distance to the first Node
-
getMaxDrivingDistanceFirstNode
public Optional<javax.measure.Quantity<javax.measure.quantity.Length>> getMaxDrivingDistanceFirstNode()Description copied from interface:IResource
Gets the maximal distance that theResource
needs to drive to the firstNode
.- Specified by:
getMaxDrivingDistanceFirstNode
in interfaceIResource
- Returns:
- the optional quantity length of the distance, an empty optional if no value has been set
- See Also:
-
setMaxDrivingDistanceLastNode
public void setMaxDrivingDistanceLastNode(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Description copied from interface:IResource
Sets the maximal distance that theResource
needs to drive to the lastNode
.- Specified by:
setMaxDrivingDistanceLastNode
in interfaceIResource
- Parameters:
maxDistance
- the quantity length maximal distance
-
getMaxDrivingDistanceLastNode
public Optional<javax.measure.Quantity<javax.measure.quantity.Length>> getMaxDrivingDistanceLastNode()Description copied from interface:IResource
Gets the maximal distance that theResource
needs to drive to the lastNode
.- Specified by:
getMaxDrivingDistanceLastNode
in interfaceIResource
- Returns:
- the optional quantity length distance or an empty optional
- See Also:
-
setMaxDrivingTimeFirstNode
Description copied from interface:IResource
Sets the maximal driving time that theResource
is supposed to drive to the firstNode
.- Specified by:
setMaxDrivingTimeFirstNode
in interfaceIResource
- Parameters:
maxTime
- the duration maximal time
-
getMaxDrivingTimeFirstNode
Description copied from interface:IResource
Gets the maximal driving time that theResource
is supposed to drive to the firstNode
.- Specified by:
getMaxDrivingTimeFirstNode
in interfaceIResource
- Returns:
- the optional duration or an empty optional if no value has been set
- See Also:
-
setMaxDrivingTimeLastNode
Description copied from interface:IResource
Sets the maximal driving time that theResource
is supposed to drive to the lastNode
.- Specified by:
setMaxDrivingTimeLastNode
in interfaceIResource
- Parameters:
maxTime
- the duration maximal time
-
getMaxDrivingTimeLastNode
Description copied from interface:IResource
Gets the maximal driving time that theResource
is supposed to drive to the lastNode
.- Specified by:
getMaxDrivingTimeLastNode
in interfaceIResource
- Returns:
- the optional duration or an empty optional if no value has been set
- See Also:
-
setResourceDepot
Description copied from interface:IResource
Sets the resource depot.- Specified by:
setResourceDepot
in interfaceIResource
- Parameters:
depot
- the new resource depot
-
getResourceDepot
Description copied from interface:IResource
Gets the resource depot.- Specified by:
getResourceDepot
in interfaceIResource
- Returns:
- the resource depot
-
getOverallVisitDurationEfficiencyFactor
public double getOverallVisitDurationEfficiencyFactor()Description copied from interface:IResource
Gets the overall visit duration efficiency factor.- Specified by:
getOverallVisitDurationEfficiencyFactor
in interfaceIResource
- Returns:
- the overall visit duration efficiency factor
-
setOverallVisitDurationEfficiencyFactor
public boolean setOverallVisitDurationEfficiencyFactor(double factor) Description copied from interface:IResource
Sets the overall visit duration efficiency factor.- Specified by:
setOverallVisitDurationEfficiencyFactor
in interfaceIResource
- Parameters:
factor
- the factor- Returns:
- true, if successful
-
setAverageCO2EmissionFactor
public void setAverageCO2EmissionFactor(double emissionFactor) Description copied from interface:IResource
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.- Specified by:
setAverageCO2EmissionFactor
in interfaceIResource
- Parameters:
emissionFactor
- the new average CO2 emission factor
-
getAverageCO2EmissionFactor
public double getAverageCO2EmissionFactor()Description copied from interface:IResource
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.- Specified by:
getAverageCO2EmissionFactor
in interfaceIResource
- Returns:
- the average CO2 emission factor
-
CapacityResource(String, double, double, Duration, Quantity, List)
with updated parameters.