public interface IWorkingHours extends IDutyHours
IWorkingHours
. WorkingHours
are the schedule in which the
work orders of a specific resources
have to be performed. Through WorkingHours
a resources
can have a different schedule for each day, be allowed to stay
over night and have its total working time limited.
IWorkingHours
and IOpeningHours
are both extend IDutyHours
, however
IWorkingHour
does have improved functionality, IOpeningHours
does not.
Implementation example:
List<IWorkingHours> workingHours = new ArrayList<IWorkingHours>();
workingHours.add(
new WorkingHours(
ZonedDateTime.of(2020, MAY, 6, 8, 0, 0, 0, ZoneId.of("Europe/Berlin")),
ZonedDateTime.of(2020, MAY, 6, 17, 0, 0, 0, ZoneId.of("Europe/Berlin"))));
IDutyHours.DutyHoursFlavour
Modifier and Type | Method and Description |
---|---|
boolean |
addConnectionHook(ReducedNodeEdgeConnectorItem item) |
void |
addConstraint(IMultiWorkingHoursLevelConstraint wohLevelConstraint) |
void |
addConstraint(IWorkingHoursLevelConstraint wohLevelConstraint)
Adds a
Constraint to the WorkingHours so only Resources with that
specific Qualification will be able to serve the Nodes to which those WorkingHours are applied. |
void |
addNodeColorCapacity(NodeColorCapacityItem item)
Adds a certain
INodeColor to the Resource . |
void |
addQualification(IQualification qualification)
Adds a
IQualification to the IWorkingHours , which means that by adding a IConstraint to the INode , they are limited to which Nodes they can give
service. |
IWorkingHours |
copy()
Returns a copy of
WorkingHours(this.getBegin(), this.getEnd(), this.getZoneId()) and
invokes WorkingHours.takeOverProperties(com.dna.jopt.member.unit.hours.IWorkingHours, com.dna.jopt.member.unit.hours.IWorkingHours) to also copy the properties. |
Optional<NodeColorCapacityItem> |
getColorCapacityItemByColorCode(int colorCode)
Gets the
NodeColorCapacityItem which limit the amount of Color coded Nodes a Resource can give service to. |
Optional<ReducedNodeEdgeConnectorItem> |
getConnectionHook(String toId) |
Optional<Map<String,ReducedNodeEdgeConnectorItem>> |
getConnectionHooks() |
List<IWorkingHoursLevelConstraint> |
getConstraints()
Gets the
Constraints set on the IResource . |
boolean |
getIsAvailableForStay()
Gets if the
Resource is allowed to do an overnight stay . |
Optional<Long> |
getLocalFlexTimeMillis()
Gets the
localFlexTime in milliseconds. |
Optional<Long> |
getLocalMaxFreePostWorkDrivingTerminationTimeMillis()
Gets the
freePostWorkDrivingTerminationTime in milliseconds. |
Optional<Long> |
getLocalMaxPillarAfterHoursTime()
Gets the
localMaxPillarAfterHoursTime of IPillarNode in milliseconds. |
Optional<Long> |
getLocalMaxRouteStartReductionTimeMillis()
Gets the
localMaxRouteStartReductionTime in milliseconds. |
Optional<Long> |
getLocalMaxRouteStartReductionTimeMillisPillar()
Gets the
localMaxRouteStartReductionTime for IPillarNode in milliseconds. |
Optional<Duration> |
getLocalStayOutCycle()
Gets the
Duration of the potential local stayout cycle . |
Optional<LocalDate> |
getLocalStayOutCycleStart()
Gets the start of the local
stayout cycle . |
double |
getMaxDistanceKm()
Gets the
WorkingHours.maxDistance , which is the maximal distance in km a Resource is allowed to travel without a IViolation
per day. |
double |
getMaxHours()
Gets maximum number of hours a
Resource is allowed to work per day in hours . |
List<IMultiWorkingHoursLevelConstraint> |
getMultiConstraints() |
Map<Integer,NodeColorCapacityItem> |
getNodeColorCapacityMap()
Gets the a
Map of the NodeColorCapacity . |
Set<Integer> |
getPresentColorCodes()
Gets the
INodeColor that are in use. |
Map<Class<? extends IQualification>,IQualification> |
getQualifications()
Gets the
IQualification of the IWorkingHours . |
Optional<IResourceDepot> |
getResourceDepot() |
Optional<Long> |
getRouteStartShiftMillisHook() |
boolean |
hasHook() |
boolean |
isClosedRoute()
Checks if the route is closed or not, the default value is
false . |
Optional<Boolean> |
isLocalOnlyApplyFreePostWorkDrivingOnOvertime() |
Optional<Boolean> |
isLocalReductionTimeIncludedInWorkingTime()
Checks whether the
localMaxRouteStartReductionTime is included in the WorkingHours . |
Optional<Boolean> |
isLocalReductionTimeOnlyUsedForDriving()
Checks whether the potentially set
localMaxRouteStartReductionTime can only be used for
driving, not for working. |
Optional<Boolean> |
isLocalReductionTimeOnlyUsedForDrivingPillar()
Checks whether the potentially set
localMaxRouteStartReductionTime for IPillarNode can only be used for driving, not for working. |
boolean |
isNodeColorCodingInUse()
Checks if any
INodeColor has been set through the use of
a NodeColorCapacityItem . |
boolean |
setConnectionHooks(Map<String,ReducedNodeEdgeConnectorItem> map) |
void |
setIsAvailableForStay(boolean isAvailableForStay)
Sets if the
Resource is allowed for an overnight stay instead of returning to
the starting location. |
void |
setIsClosedRoute(boolean isClosedRoute)
Sets the
Route to a closed Route . |
boolean |
setLocalFlexTime(Duration idleTimeReductionTime)
Sets the amount of time a
Resource can be expected to start working later and stay
longer at work if needed. |
boolean |
setLocalMaxFreePostWorkDrivingTerminationTime(Duration postWorkingHourTimeReductionTime)
Sets the amount of time the
Resource can be expected to drive home to its starting
location in its free time. |
boolean |
setLocalMaxFreePostWorkDrivingTerminationTime(Duration postTimeReductionTime,
boolean onlyApplyOnOvertime)
Sets the local max free post work driving termination time.
|
boolean |
setLocalMaxPillarAfterHoursTime(Duration maxPillarEndOverTime)
Sets the amount of time after
WorkingHours within which a IPillarNode can be set. |
boolean |
setLocalMaxRouteStartReductionTime(Duration maxRouteStartReductionTime,
boolean isOnlyUsedForDriving)
Sets the maximum time which the
Resource can be expected to drive to the first Node in its private time. |
boolean |
setLocalMaxRouteStartReductionTimePillar(Duration maxRouteStartReductionTime,
boolean isOnlyUsedForDriving)
Sets the
localMaxRouteStartReductionTime for IPillarNode . |
void |
setLocalReductionTimeIsIncludedInWorkingTime(boolean isIncludedInTotalWorkingTime)
Sets whether the
localMaxRouteStartReductionTime is included in the WorkingHours . |
void |
setLocalStayOutCycleDefinition(Duration cycle,
LocalDate cycleStart)
Sets the
Duration of the cycle within which the maximum number of overnight
stays are allowed and within which the minimum recovery time (WorkingHours
without overnight stays ) has to be observed. |
void |
setMaxDistance(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance)
Sets the maximal distance that a
Resource is allowed to travel per day, cannot be null. |
void |
setMaxHours(Duration maxWorkingTime)
Deprecated.
please use
setMaxWorkingTime(Duration) instead |
void |
setMaxWorkingTime(Duration maxWorkingTime)
Sets the maximum number of hours a
Resource is allowed to work per day. |
void |
setResourceDepot(IResourceDepot depot) |
boolean |
setStartTimeHook(Duration routeStartTimeHookDuration) |
getFlavour, getTimeWindow, isPrefferedHour, setIsPrefferedHour
compareTo
double getMaxHours()
Resource
is allowed to work per day in hours
. By
default it is not usable and the value is -1.maxHours
.double getMaxDistanceKm()
WorkingHours.maxDistance
, which is the maximal distance in km a Resource
is allowed to travel without a IViolation
per day.maxDistance
in km. By default it is not usable and the value is -1.boolean getIsAvailableForStay()
Resource
is allowed to do an overnight stay
. The Node
also
needs INode.setIsStayNode(boolean)
set to true
so
this function can be used.
This method is specific for the set WorkingHours
and can therefore be specific for
certain days in the week (no overnight stays
on Fridays.
true
.void setIsAvailableForStay(boolean isAvailableForStay)
Resource
is allowed for an overnight stay
instead of returning to
the starting location. The Node
also needs INode.setIsStayNode(boolean)
set to true
so this
function can be used.isAvailableForStay
- boolean, the default value is true
.void setMaxWorkingTime(Duration maxWorkingTime)
Resource
is allowed to work per day.maxWorkingTime
- the maximal working time@Deprecated void setMaxHours(Duration maxWorkingTime)
setMaxWorkingTime(Duration)
insteadSets the WorkingHours.maxHours
a Resource
is allowed to work per day.
maxWorkingTime
- the double to be set for maxHours
void setMaxDistance(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance)
Resource
is allowed to travel per day, cannot be null.maxDistance
- the quantity, will be casted
to kilometrevoid setIsClosedRoute(boolean isClosedRoute)
Route
to a closed Route
. A closed Route
is a Route
where the Resource
is going to its home afterwards. An open Route
is a Route
where the Resource
is simply staying at the last Node
if OverNightStay
also has been activated or where the Resource
has to travel home outside
of the WorkingHours
. The default value is true.isClosedRoute
- the boolean if the Route is a closed RouteIBasicResource.hasAlternateDestination()
boolean isClosedRoute()
false
. A closed
Route
is a Route
where the Resource
is going to its home afterwards. An open Route
is a Route
where the Resource
is simply staying at the last Node
if OverNightStay
also has been activated or where the Resource
has to
travel home outside of the WorkingHours
. The default value is true.isClosedRoute
IBasicResource.hasAlternateDestination()
void setLocalStayOutCycleDefinition(Duration cycle, LocalDate cycleStart)
Duration
of the cycle within which the maximum number of overnight
stays
are allowed and within which the minimum recovery time
(WorkingHours
without overnight stays
) has to be observed. The recovery time
is set in IResource.setStayOutCycleDefinition(Duration, LocalDate)
.
Without setting the cycle the maximal number of overnight stays
will not be
refreshed and count for the full duration of the WorkingHours
. The cycle can be applied
to the local Resource
which means it will stay the same for this Resource
throughout the Optimization
. If like here set locally
it is only valid for this
WorkingHours
and the cycle can change depending on the dates or time in the week. It
can for example be set that no overnight stays
are allowed on Fridays.
cycle
- duration of the cyclecycleStart
- the localDate of the cycle startOptional<Duration> getLocalStayOutCycle()
Duration
of the potential local stayout cycle
.
For more information please see setLocalStayOutCycleDefinition(Duration,
LocalDate)
.
Optional<LocalDate> getLocalStayOutCycleStart()
stayout cycle
.
For more information please see setLocalStayOutCycleDefinition(Duration,
LocalDate)
.
boolean setLocalMaxRouteStartReductionTime(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving)
Resource
can be expected to drive to the first Node
in its private time.
If the OpeningHours
of a Node
and the WorkingHours
of a Resource
start at 8 the driving time is an hour and the Resource
's localMaxRouteStartReductionTime
is 30 Minutes the Resource
will start driving towards
the Node
at 7.30 (outside of its WorkingHours
) and arrive there at 8.30.
The Boolean
defines whether the localMaxRouteStartReductionTime
can only be
used for driving or not and is usually set to true
. The Resource
can not work
in the localMaxRouteStartReductionTime
in that case.
If like here set locally
the localMaxRouteStartReductionTime
is only valid
for these specific WorkingHours
.
maxRouteStartReductionTime
- the duration of the maxRouteStartReductionTimeisOnlyUsedForDriving
- the boolean whether the time can only be used for drivingboolean setLocalMaxRouteStartReductionTimePillar(Duration maxRouteStartReductionTime, boolean isOnlyUsedForDriving)
localMaxRouteStartReductionTime
for IPillarNode
. Overwrites the set localMaxRouteStartReductionTime
and sets the new value for Pillars
. If no localMaxRouteStartReductionTime
has been set, sets the new value for Pillars
only.
For more information please see setLocalMaxRouteStartReductionTime(Duration,
boolean)
.
maxRouteStartReductionTime
- the duration of the localMaxStartReductionTimePillarisOnlyUsedForDriving
- the boolean whether it is only used for drivingvoid setLocalReductionTimeIsIncludedInWorkingTime(boolean isIncludedInTotalWorkingTime)
localMaxRouteStartReductionTime
is included in the WorkingHours
. The default value is false
. If false
and setLocalMaxRouteStartReductionTime(Duration, boolean)
is set to true
the driving time
to the first Node
has to be done in the Resources
private time
For more information please see setLocalMaxRouteStartReductionTime(Duration,
boolean)
.
isIncludedInTotalWorkingTime
- the boolean whether reduction time is included in the
WorkingHoursOptional<Boolean> isLocalReductionTimeOnlyUsedForDriving()
localMaxRouteStartReductionTime
can only be used for
driving, not for working. Per default this is set to true
.
For more information please see setLocalMaxRouteStartReductionTime(Duration,
boolean)
localMaxRouteStartReductionTime
has been setOptional<Boolean> isLocalReductionTimeOnlyUsedForDrivingPillar()
localMaxRouteStartReductionTime
for IPillarNode
can only be used for driving, not for working. Per
default this is set to true
.
For more information please see setLocalMaxRouteStartReductionTime(Duration,
boolean)
and setLocalMaxRouteStartReductionTimePillar(Duration, boolean)
.
localMaxRouteStartReductionTime
has been setOptional<Boolean> isLocalReductionTimeIncludedInWorkingTime()
localMaxRouteStartReductionTime
is included in the WorkingHours
. The default value is false
. If false
and setLocalMaxRouteStartReductionTime(Duration, boolean)
is set to true
the driving time
to the first Node
has to be done in the Resources
private time
For more information please see setLocalMaxRouteStartReductionTime(Duration,
boolean)
.
localMaxRouteStartReductionTime
has been
setOptional<Long> getLocalMaxRouteStartReductionTimeMillis()
localMaxRouteStartReductionTime
in milliseconds.
For more information please see setLocalMaxRouteStartReductionTime(Duration,
boolean)
.
localMaxRouteStartReductionTime
has been
setOptional<Long> getLocalMaxRouteStartReductionTimeMillisPillar()
localMaxRouteStartReductionTime
for IPillarNode
in milliseconds.
For more information please see setLocalMaxRouteStartReductionTimePillar(Duration,
boolean)
and setLocalMaxRouteStartReductionTime(Duration, boolean)
.
localMaxRouteStartReductionTime
has been
setboolean setLocalFlexTime(Duration idleTimeReductionTime)
Resource
can be expected to start working later and stay
longer at work if needed.
If the first Node
is at 11, the Resources WorkingHours
started at 8 and the
localFlexTime
is set to 3 hours, the Resource
starts working at 11 and has to
stay 3 hours longer at work than usual. If the localFlexTime
in the above example is
set to 2 hours, the Resource
will be idle from 10-11 but it is considered working time.
idleTimeReductionTime
- the duration of the idle time reduction timeOptional<Long> getLocalFlexTimeMillis()
localFlexTime
in milliseconds.
For more information please see setLocalFlexTime(Duration)
.
localFlexTime
has been setboolean setLocalMaxFreePostWorkDrivingTerminationTime(Duration postWorkingHourTimeReductionTime)
Resource
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 the freePostWorkDrivingTerminationTime
is set to 40 minutes, those 40 minutes of the drive home
are considered private time.
This method sets the local free post work driving termination time
locally.
Therefore different times can be set for different WorkingHours
. If the time should be
valid for all the WorkingHours
of a Resource
please use IResource.setMaxFreePostWorkDrivingTerminationTime(Duration)
.
postWorkingHourTimeReductionTime
- the duration free time that needs to be used to drive
homeboolean setLocalMaxFreePostWorkDrivingTerminationTime(Duration postTimeReductionTime, boolean onlyApplyOnOvertime)
postTimeReductionTime
- the post time reduction timeonlyApplyOnOvertime
- the only apply on overtimeOptional<Boolean> isLocalOnlyApplyFreePostWorkDrivingOnOvertime()
Optional<Long> getLocalMaxFreePostWorkDrivingTerminationTimeMillis()
freePostWorkDrivingTerminationTime
in milliseconds.
For more information please see setLocalMaxFreePostWorkDrivingTerminationTime(Duration)
.
freePostWorkDrivingTerminationTime
has
been setboolean setLocalMaxPillarAfterHoursTime(Duration maxPillarEndOverTime)
WorkingHours
within which a IPillarNode
can be set. The Resources
have to visit this
Pillar
even tough it is outside of WorkingHours
.
This method in only valid for a specific set of WorkingHours
. If you want to set the
same time for all the WorkingHours
of a Pillar
please use IResource.setMaxPillarAfterHoursTime(Duration)
maxPillarEndOverTime
- the duration after WorkingHours within which a Pillar still has to
be given serviceOptional<Long> getLocalMaxPillarAfterHoursTime()
localMaxPillarAfterHoursTime
of IPillarNode
in milliseconds.
For more information please see setLocalMaxPillarAfterHoursTime(Duration)
.
IWorkingHours copy()
WorkingHours(this.getBegin(), this.getEnd(), this.getZoneId())
and
invokes WorkingHours.takeOverProperties(com.dna.jopt.member.unit.hours.IWorkingHours, com.dna.jopt.member.unit.hours.IWorkingHours)
to also copy the properties.copy
in interface IDutyHours
void addConstraint(IWorkingHoursLevelConstraint wohLevelConstraint)
Constraint
to the WorkingHours
so only Resources
with that
specific Qualification
will be able to serve the Nodes
to which those WorkingHours
are applied.
For examples see UKPostCodeQualification
and
UKPostCodeConstraint
wohLevelConstraint
- the iWorkingHoursLevelConstraint to add to the workingHoursvoid addConstraint(IMultiWorkingHoursLevelConstraint wohLevelConstraint)
List<IMultiWorkingHoursLevelConstraint> getMultiConstraints()
List<IWorkingHoursLevelConstraint> getConstraints()
Constraints
set on the IResource
.
The Resource
can only work on Nodes
within within the range of its Constraint
.
An example of its implementation is UKPostCodeConstraint
.
void addNodeColorCapacity(NodeColorCapacityItem item)
INodeColor
to the Resource
. This
way can be made sure that Nodes
with a certain Color
are not overrepresented
and can be used for white space generation.
Implementation example:
double preventivePercent = 0.2;
double contractorPercent = 0.5;
double breakfixPercent = 0.7;
workingHours.forEach(wh -> {
wh.addNodeColorCapacity(new NodeColorCapacityItem(NodeColors.PREVENTIVE,preventivePercent));
wh.addNodeColorCapacity(new NodeColorCapacityItem(NodeColors.BREAKFIX,breakfixPercent));
wh.addNodeColorCapacity(new NodeColorCapacityItem(NodeColors.CONTRACTOR,contractorPercent));
}
item
- the nodeColorCapacityItemNodeColorCapacityItem
Optional<NodeColorCapacityItem> getColorCapacityItemByColorCode(int colorCode)
NodeColorCapacityItem
which limit the amount of Color
coded Nodes
a Resource
can give service to. This way can be made sure that Nodes
with a certain Color
are not overrepresented and can be used for white space
generation.colorCode
- the int code of the colorINodeColor
boolean isNodeColorCodingInUse()
INodeColor
has been set through the use of
a NodeColorCapacityItem
.Set<Integer> getPresentColorCodes()
INodeColor
that are in use.NodeColorCapacityItem
Map<Integer,NodeColorCapacityItem> getNodeColorCapacityMap()
Map
of the NodeColorCapacity
. For more information please see INodeColor
and NodeColorCapacityItem
.void addQualification(IQualification qualification)
IQualification
to the IWorkingHours
, which means that by adding a IConstraint
to the INode
, they are limited to which Nodes
they can give
service.qualification
- the IQualification that is to be addedMap<Class<? extends IQualification>,IQualification> getQualifications()
IQualification
of the IWorkingHours
.addQualification(IQualification)
void setResourceDepot(IResourceDepot depot)
Optional<IResourceDepot> getResourceDepot()
boolean setStartTimeHook(Duration routeStartTimeHookDuration)
boolean hasHook()
boolean addConnectionHook(ReducedNodeEdgeConnectorItem item)
Optional<ReducedNodeEdgeConnectorItem> getConnectionHook(String toId)
Optional<Map<String,ReducedNodeEdgeConnectorItem>> getConnectionHooks()
boolean setConnectionHooks(Map<String,ReducedNodeEdgeConnectorItem> map)
Copyright © 2017–2023 DNA Evolutions GmbH. All rights reserved.