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 TypeMethodDescriptionvoidaddCapacity(double capacity) Deprecated.voidaddConstraint(IResourceLevelConstraint constraint) Adds anIConstraintto theResourceso it can only give service to theNodesthat have the appropriateIQualification.doubleGets the average CO2 emission factor.double[]Gets the capacity of goods aResourcecan carry.double[]Gets the capacity degradation per stop.doubleSets theCapacityResource.getConnectionTimeEfficiencyFactor(), the default value is1.0.Gets theIConstraintfrom theResourcethat 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 theResourceneeds to drive to the firstNode.Optional<javax.measure.Quantity<javax.measure.quantity.Length>>Gets the maximal distance that theResourceneeds to drive to the lastNode.Gets the maximal driving time that theResourceis supposed to drive to the firstNode.Gets the maximal driving time that theResourceis supposed to drive to the lastNode.Gets the amount of time in milliseconds that theResourcecan be expected to drive home to its starting location in its free time.Gets themaximal pillar after hours timein milliseconds.Gets the maximum time which theResourcecan be expected to drive to the firstNodein its private time.Gets theroute start reduction timeforIPillarNodein milliseconds.intGets maximum number ofovernight staystheResourcecan do in a row.intGets theResourcesmaximum number ofovernight stays, the default value is -1.double[]Gets the minimal degrated capacity.intGets the number of defined working hours (often days) between twoovernight stays.doubleGets the overall visit duration efficiency factor.Gets the resource depot.Gets thestay out cyclewithin which the maximum number ofovernight staysare allowed and within which the the minimumrecovery time(days withoutovernight stays) has to be observed.Gets the starting day of thestay out cyclewithin which the maximum number ofovernight staysare allowed and within which the the minimumrecovery time(days withoutovernight stays) has to be observed.doubleGets the distance threshold to be able to use anovernight stayin meter.doubleGets the return time threshold that needs to be surpassed to be able to use anovernight stayin 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 stayasQuantityLength.Gets the time threshold that needs to be surpassed in order to be able to use anovernight stayasDuration.Checks whether theroute start reduction timeis included in theWorkingHours.Checks whether the potentially setroute start reduction timecan only be used for driving, not for working.Checks if aroute start reduction timeforIPillarNodehas been set.booleanChecks whether theResourceneeds to be further away from itsstarting locationthan the set threshold to be able to use anovernight stay.booleanChecks whether theResourceneeds to take longer to return to herstarting locationthan the set threshold to be able to use anovernight stay.voidsetAverageCO2EmissionFactor(double emissionFactor) Sets the average CO2 emission-factor.voidsetCapacity(double[] capacity) Sets the amount aResourcecan carry of a specific good.voidsetCapacity(double[] capacity, double[] minDegratedCapacity, double[] capacityDegPerStop) Sets the capacity.voidsetCapacityDegradationPerStop(double[] capacityDegPerStop) Sets the capacity degradation per stop.voidsetConnectionTimeEfficiencyFactor(double connectionTimeEfficiencyFactor) Sets connectionTimeEfficiencyFactor, the default value is1.0.voidsetInitialLoad(double[] initialLoad) Sets the the amount of a good that is already being carried by theResource.voidsetMaxDrivingDistanceFirstNode(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Sets the maximal distance that theResourceneeds to drive to the firstNode.voidsetMaxDrivingDistanceLastNode(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance) Sets the maximal distance that theResourceneeds to drive to the lastNode.voidsetMaxDrivingTimeFirstNode(Duration maxTime) Sets the maximal driving time that theResourceis supposed to drive to the firstNode.voidsetMaxDrivingTimeLastNode(Duration maxTime) Sets the maximal driving time that theResourceis supposed to drive to the lastNode.booleansetMaxFlexPreWorkingHoursDrvingTime(Duration preWorkTime) Deprecated.please usesetMaxRouteStartReductionTime(Duration, boolean)insteadvoidsetMaxFreePostWorkDrivingTerminationTime(Duration nonPenalizedDrivingHomeOnOwnTimeDuration) Sets the amount of time that theResourcecan be expected to drive home to its starting location in its free time.voidsetMaxFreePostWorkDrivingTerminationTime(Duration nonPenalizedDrivingHomeOnOwnTimeDuration, boolean onlyApplyOnOvertime) Sets the local max free post work driving termination time.booleansetMaxPillarAfterHoursTime(Duration maxPillarEndOverTime) Sets the amount of time afterWorkingHourswithin which aIPillarNodecan be set.booleansetMaxRouteStartReductionTime(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Sets the maximum time which theResourcecan be expected to drive to the firstNodein its private time.booleansetMaxRouteStartReductionTimePillar(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving) Sets theroute start reduction timeforIPillarNode.voidsetMinimalDegratedCapacity(double[] minDegratedCapacity) Sets the minimal degrated capacity.booleansetOverallVisitDurationEfficiencyFactor(double factor) Sets the overall visit duration efficiency factor.voidsetReductionTimeIsIncludedInWorkingTime(boolean isIncludedInTotalWorkingTime) Sets whether theroute start reduction timeis included in theWorkingHours.voidsetResourceDepot(IResourceDepot depot) Sets the resource depot.voidsetStayOutCycleDefinition(Duration cycle, LocalDate cycleStart) Sets theDurationof the cycle within which the maximum number ofovernight staysare allowed and within which the minimumrecovery time(WorkingHourswithoutovernight stays) has to be observed.voidsetStayOutPolicy(double minDistanceMeter, double minTimeSeconds) Deprecated.Please usesetStayOutPolicy(Quantity, Duration)instead.voidsetStayOutPolicy(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut, Duration minTimeForStayOut) Sets the minimal distance and time theResourceneeds to be away from its starting location to be able to aovernight stay.voidsetStayOutPolicyActive(boolean stayOutPolicyActive) Deprecated.please use the above mentioned methods insteadvoidsetStayOutPolicyReturnDistance(javax.measure.Quantity<javax.measure.quantity.Length> minDistanceForStayOut) Sets the minimal distance aResourceneeds to be away from hisstarting locationin order to be able to use anovernight stay.voidsetStayOutPolicyReturnDistanceActive(boolean stayOutPolicyReturnDistanceActive) Sets whether theResourceneeds to be further away from itsstarting locationthan the set threshold to be able to use anovernight stay.voidsetStayOutPolicyReturnTime(Duration minTimeForStayOut) Sets the minimal time aResourcewould need to return to herstarting locationto be able to use anovernight stay.voidsetStayOutPolicyReturnTimeActive(boolean stayOutPolicyReturnTimeActive) Sets whether theResourceneeds to take longer to return to herstarting locationthan the set threshold to be able to use anovernight stay.voidsetStaysOut(int totalStays, int staysInRow, int minRecoverHours) Sets thetotal stays, thestays in a rowand theminimum recovery timeof astay out cycle.Methods inherited from interface java.lang.Comparable
compareToMethods 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, setStrictOvertimeLimitMethods 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 aResourcecan 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 aResourcecan 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 aResourcecan 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 theResourcesmaximum 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 staystheResourcecan 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 cyclewithin which the maximum number ofovernight staysare allowed and within which the the minimumrecovery time(days withoutovernight stays) has to be observed. Thestay out cycleof this method is valid for all theWorkingHoursof theResource.For more information please see
IWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate). The linkedlocal stay out cycleis only valid for theWorkingHoursit has been set tough.- Returns:
- the stay out cycle or an empty
Optionalif nostay out cyclehas been defined
-
getStayOutCycleStart
Gets the starting day of thestay out cyclewithin which the maximum number ofovernight staysare allowed and within which the the minimumrecovery time(days withoutovernight stays) has to be observed. Thestay out cycleof this method is valid for all theWorkingHoursof theResource. *For more information please see
IWorkingHours.setLocalStayOutCycleDefinition(Duration, LocalDate). The linkedlocal stay out cycleis only valid for theWorkingHoursit has been set tough.- Returns:
- the start of the cycle or an empty
Optionalif 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 theResourceneeds to be away from its starting location to be able to aovernight stay. If this threshold is not surpassed theResourcehas 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 theResourceneeds to take longer to return to herstarting locationthan 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 theResourceneeds to be further away from itsstarting locationthan 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 theResourceneeds to take longer to return to herstarting locationthan 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 theResourceneeds to be further away from itsstarting locationthan 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 aResourcewould need to return to herstarting locationto be able to use anovernight stay. If this threshold is not surpassed theResourcehas 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 aResourceneeds to be away from hisstarting locationin order to be able to use anovernight stay. If this threshold is not surpassed theResourcehas 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 anIllegalStateExceptionis 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 theResourcecan be expected to drive to the firstNodein its private time. Theroute start reduction timeaffects all theWorkingHoursof thatResource.The
route start reduction timeis valid for allWorkingHoursof aResource. For more information please seesetMaxRouteStartReductionTime(Duration, boolean). If aroute start reduction timehas to be valid for only one set ofWorkingHoursplease use thelocalmethodIWorkingHours.setLocalMaxRouteStartReductionTime(Duration, boolean).- Returns:
- the optional Long milliseconds of the routestart reduction time
-
isReductionTimeIncludedInWorkingTime
Checks whether theroute start reduction timeis included in theWorkingHours. The default value isfalse. IffalseandsetMaxRouteStartReductionTime(Duration, boolean)is set totruethe driving time to the firstNodehas to be done in theResourcesprivate time.The
route start reduction timeis valid for allWorkingHoursof aResource. For more information please seesetMaxRouteStartReductionTime(Duration, boolean). If aroute start reduction timehas to be valid for only one set ofWorkingHoursplease use thelocalmethodIWorkingHours.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 timecan only be used for driving, not for working. Per default this is set totrue. In this case theroute start reduction timeis valid for allWorkingHoursof thatResource.The
route start reduction timeis valid for allWorkingHoursof aResource. For more information please seesetMaxRouteStartReductionTime(Duration, boolean). If aroute start reduction timehas to be valid for only one set ofWorkingHoursplease use thelocalmethodIWorkingHours.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 timeforIPillarNodein milliseconds.The
route start reduction timeis valid for allWorkingHoursof aResource. For more information please seesetMaxRouteStartReductionTime(Duration, boolean). If aroute start reduction timehas to be valid for only one set ofWorkingHoursplease use thelocalmethodIWorkingHours.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 timeforIPillarNodehas been set.For more information please see
setMaxRouteStartReductionTimePillar(Duration, boolean). For a method that only affects a specific set ofWorkingHoursplease 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 theResourcecan be expected to drive to the firstNodein its private time.If the
OpeningHoursof aNodeand theWorkingHoursof aResourcestart at 8 the driving time is an hour and theResource'sroute start reduction timeis 30 Minutes theResourcewill start driving towards theNodeat 7.30 (outside of itsWorkingHours) and arrive there at 8.30.The
Booleandefines whether theroute start reduction timecan only be used for driving or not and is usually set totrue. TheResourcecan not work in theroute start reduction timein that case.The
route start reduction timeis valid for allWorkingHoursof aResource. If aroute start reduction timehas to be valid for only one set ofWorkingHoursplease 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 timeforIPillarNode. Overwrites the setroute start reduction timethat is valid forINodesand sets the new value forPillars. If noroute start reduction timehas been set, sets the new value forPillarsonly.The
Booleandefines whether theroute start reduction timecan 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 timeis included in theWorkingHours. The default value isfalse. IffalseandsetMaxRouteStartReductionTime(Duration, boolean)is set totruethe driving time to the firstNodehas to be done in theResourcesprivate time.For more information on
route start reduction timeplease see the link above.- Parameters:
isIncludedInTotalWorkingTime- the boolean whether reduction time is included in the WorkingHours
-
setMaxPillarAfterHoursTime
Sets the amount of time afterWorkingHourswithin which aIPillarNodecan be set. TheResourceshave to visit thisPillareven 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 ofWorkingHoursplease 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 timein 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 rowand theminimum recovery timeof astay out cycle. Theminimum recovery timeis counted in number ofWorkingHours, which often but not necessarily are days.For more information on
stay out cyclethat is valid for allWorkingHoursof aResourceplease seesetStayOutCycleDefinition(Duration, LocalDate). For thelocalmethod that only affects specificWorkingHoursplease 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 theDurationof the cycle within which the maximum number ofovernight staysare allowed and within which the minimumrecovery time(WorkingHourswithoutovernight stays) has to be observed. Theminimum recovery timeis counted in number ofWorkingHours, which often but not necessarily are days.Without setting the cycle the maximal number of
overnight stayswill not be refreshed and count for the full duration of theWorkingHours. The cycle is applied to allWorkingHoursof theResourcethroughout theOptimization.If the cycle should only be applied to specific
WorkingHoursso it can change depending on the dates or days in the week (i.e. noovernight stayson 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
meterand time insecondstheResourcewould 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 stayin 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 stayin 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 theResourcecan 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 theResourcecan be expected to drive home to its starting location in its free time.If returning from the last
Nodeto the starting location takes 1 hour and thefreePostWorkDrivingTerminationTimeis set to 40 minutes, those 40 minutes of the drive home are considered private time.This method sets the
free post work drivingfor all theWorkingHoursof theResource. If different times hove to be set for specificWorkingHoursplease 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 stayasDuration.- 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 stayasQuantityLength.- Returns:
- the quantity length distance threshold
- See Also:
-
addConstraint
Adds anIConstraintto theResourceso it can only give service to theNodesthat have the appropriateIQualification.Used by
UKPostCode.- Parameters:
constraint- the iResourceLevelConstraint to which it will be limited
-
getConstraints
List<IResourceLevelConstraint> getConstraints()Gets theIConstraintfrom theResourcethat 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 theResourceneeds 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 theResourceneeds 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 theResourceneeds 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 theResourceneeds to drive to the lastNode.- Returns:
- the optional quantity length distance or an empty optional
- See Also:
-
setMaxDrivingTimeFirstNode
Sets the maximal driving time that theResourceis supposed to drive to the firstNode.- Parameters:
maxTime- the duration maximal time
-
getMaxDrivingTimeFirstNode
Gets the maximal driving time that theResourceis 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 theResourceis supposed to drive to the lastNode.- Parameters:
maxTime- the duration maximal time
-
getMaxDrivingTimeLastNode
Gets the maximal driving time that theResourceis 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
-
Resourcecan carry of a specific good.