Class PillarTimeWindowGeoNode

All Implemented Interfaces:
IOptimizationElement, IPillarTimeWindowGeoNode, INode, IPillarNode, Serializable

public class PillarTimeWindowGeoNode extends TimeWindowGeoNode implements IPillarTimeWindowGeoNode
A TimeWindowGeoNode which, if not reached in time, will be skipped entirely by unassigning it. PillarTimeWindowGeoNode(String, double, double, IOpeningHours, Duration) is the normal constructor. PillarTimeWindowGeoNode(String, double, double, IOpeningHours, Duration, boolean) includes the option that the work at the PillarTimeWindowGeoNode has to be done within the OpeningHours.
Since:
03/08/2019
Version:
14/08/2019
Author:
DNA
See Also:
  • Constructor Details

    • PillarTimeWindowGeoNode

      public PillarTimeWindowGeoNode(String nodeId, double latitude, double longitude, IOpeningHours openingHour)
      The constructor for the PillarTimeWindowGeoNode, which is a TimeWindowGeoNode that if not reached in time, will be skipped entirely. If a visit duration is supposed to be set, please use PillarTimeWindowGeoNode(String, double, double, IOpeningHours, Duration).

      Implementation example:

      
       // Defining opening hours
       OpeningHours openingHours =
                   new OpeningHours(ZonedDateTime.of(2020, MAY.getValue(), 6, 14, 0, 0, 0, ZoneId.of("Europe/Berlin")),
                           ZonedDateTime.of(2020, MAY.getValue(), 6, 21, 0, 0, 0, ZoneId.of("Europe/Berlin")));
      
      
       // Defining an (optional) constraint IConstraint typeConstraint = new TypeConstraint();
       ((TypeConstraint) typeConstraint).addType("plumbing"); typeConstraint.setIsHard(true);
      
       PillarTimeWindowGeoNode aachen =
       new PillarTimeWindowGeoNode("Aachen", 50.775346, 6.083887, openingHours);
       aachen.addConstraint(typeConstraint);
       this.addElement(aachen);
       
      Parameters:
      nodeId - the string node ID
      latitude - the double latitude of the PillarTimeWindowGeoNode
      longitude - the double longitude of the PillarTimeWindowGeoNode
      openingHour - the IOpeninghours
    • PillarTimeWindowGeoNode

      public PillarTimeWindowGeoNode(String nodeId, com.dna.jopt.config.types.Position pos, IOpeningHours openingHour)
    • PillarTimeWindowGeoNode

      public PillarTimeWindowGeoNode(String nodeId, double latitude, double longitude, IOpeningHours openingHour, Duration visitDuration)
      The constructor for the PillarTimeWindowGeoNode, which is a TimeWindowGeoNode that if not reached in time, will be skipped entirely. If the work at the PillarTimeWindowGeoNode has to be finished within the IDutyHours, please use PillarTimeWindowGeoNode(String, double, double, IOpeningHours, Duration, boolean).

      Implementation example

      
       // Defining opening hours
       OpeningHours openingHours =
                   new OpeningHours(ZonedDateTime.of(2020, MAY.getValue(), 6, 14, 0, 0, 0, ZoneId.of("Europe/Berlin")),
                           ZonedDateTime.of(2020, MAY.getValue(), 6, 21, 0, 0, 0, ZoneId.of("Europe/Berlin")));
      
      
       // Defining an (optional) constraint IConstraint typeConstraint = new TypeConstraint();
       ((TypeConstraint) typeConstraint).addType("plumbing"); typeConstraint.setIsHard(true);
      
       Duration visitDuration = Duration.ofMinutes(20);
      
       PillarTimeWindowGeoNode aachen =
       new PillarTimeWindowGeoNode("Aachen", 50.775346, 6.083887, openingHours, visitDuration);
       aachen.addConstraint(typeConstraint);
       this.addElement(aachen);
       
      Parameters:
      nodeId - the string node ID
      latitude - the double latitude of the PillarTimeWindowGeoNode
      longitude - the double longitude of the PillarTimeWindowGeoNode
      openingHour - the IOpeninghours
      visitDuration - the duration visitduration that the work needs in order to be done
    • PillarTimeWindowGeoNode

      public PillarTimeWindowGeoNode(String nodeId, com.dna.jopt.config.types.Position pos, IOpeningHours openingHour, Duration visitDuration)
    • PillarTimeWindowGeoNode

      public PillarTimeWindowGeoNode(String nodeId, double latitude, double longitude, IOpeningHours openingHour, Duration visitDuration, boolean isDutyHoursIncludeVisitDuration)
      The constructor for the PillarTimeWindowGeoNode, which is a TimeWindowGeoNode that if not reached in time, will be skipped entirely. In the other constructors the work has to be started but not necessarily finished within the IDutyHours. If isDutyHoursIncludeVisitDuration is set to true, the work has to be started and finished within the DutyHours.

      Implementation example

      
       // Defining opening hours
       OpeningHours openingHours =
                   new OpeningHours(ZonedDateTime.of(2020, MAY.getValue(), 6, 14, 0, 0, 0, ZoneId.of("Europe/Berlin")),
                           ZonedDateTime.of(2020, MAY.getValue(), 6, 21, 0, 0, 0, ZoneId.of("Europe/Berlin")));
      
      
       // Defining an (optional) constraint IConstraint typeConstraint = new TypeConstraint();
       ((TypeConstraint) typeConstraint).addType("plumbing"); typeConstraint.setIsHard(true);
      
       Duration visitDuration = Duration.ofMinutes(20);
      
       PillarTimeWindowGeoNode aachen =
       new PillarTimeWindowGeoNode("Aachen", 50.775346, 6.083887, openingHours, visitDuration, true);
       aachen.addConstraint(typeConstraint);
       this.addElement(aachen);
       
      Parameters:
      nodeId - the string node ID
      latitude - the double latitude of the PillarTimeWindowGeoNode
      longitude - the double longitude of the PillarTimeWindowGeoNode
      openingHour - the iOpeningHours
      visitDuration - the duration visitDuration that the work needs
      isDutyHoursIncludeVisitDuration - the boolean whether the visitDuration if the work has to be done within the DutyHours
    • PillarTimeWindowGeoNode

      public PillarTimeWindowGeoNode(String nodeId, com.dna.jopt.config.types.Position pos, IOpeningHours openingHour, Duration visitDuration, boolean isDutyHoursIncludeVisitDuration)
  • Method Details

    • isTimeAdjustableAnchor

      public boolean isTimeAdjustableAnchor()
      Description copied from interface: IPillarNode
      Checks isTimeAdjustableAnchor. If yes, then the Pillar is allowed to change time a bit if the Route start is moving as well. The default value is false.
      Specified by:
      isTimeAdjustableAnchor in interface IPillarNode
      Returns:
      the state of isTimeAdjustableAnchor
    • isOverwritingRouteStart

      public boolean isOverwritingRouteStart()
      Description copied from interface: IPillarTimeWindowGeoNode
      Checks if this IPillarNode overrides the Route start, turning it into an AnchorNode.
      Specified by:
      isOverwritingRouteStart in interface IPillarTimeWindowGeoNode
      Returns:
      if the node is overwriting the route start
    • isOverwritingRouteTermination

      public boolean isOverwritingRouteTermination()
      Description copied from interface: IPillarTimeWindowGeoNode
      Checks if the ILogicEntityRoute has to end at this AnchorNode.

      If a job has to be done at this AnchorPillar, then another Pillar has to be added again.

      Specified by:
      isOverwritingRouteTermination in interface IPillarNode
      Specified by:
      isOverwritingRouteTermination in interface IPillarTimeWindowGeoNode
      Returns:
      whether the node is overwriting route termination
    • attachResource

      public void attachResource(IResource mandatoryVisitor)
      Description copied from interface: IPillarNode
      Attaching the mandatoryVisitor as the visiting resource will be treated as a hard constraint if a mandatoryVisitor was set using this method.

      Throws an IllegalStateException if a mandatoryVisitor has already been attached

      Specified by:
      attachResource in interface IPillarNode
      Parameters:
      mandatoryVisitor - the Resource to attach to the Pillarnode
    • detachResourceConstraints

      public void detachResourceConstraints()
      Description copied from interface: INode
      Removes all IConstraint. This method is used internally.
      Specified by:
      detachResourceConstraints in interface INode
      Overrides:
      detachResourceConstraints in class AbstractNode
    • getLastKnownAsRouteStart

      public boolean getLastKnownAsRouteStart()
      Description copied from interface: IPillarTimeWindowGeoNode
      Gets the last known as route start.
      Specified by:
      getLastKnownAsRouteStart in interface IPillarTimeWindowGeoNode
      Returns:
      the last known as route start
    • getLastKnownAsRouteTermination

      public boolean getLastKnownAsRouteTermination()
      Specified by:
      getLastKnownAsRouteTermination in interface IPillarNode
    • detachResourceConstraints

      public void detachResourceConstraints(String resId)
      Description copied from interface: INode
      Removes the IResource with the given resId from the IConstraint that are IConstraintResource. This method is used internally.
      Specified by:
      detachResourceConstraints in interface INode
      Overrides:
      detachResourceConstraints in class AbstractNode
      Parameters:
      resId - the string Resource /D
    • addConstraint

      public void addConstraint(IConstraint constraint)
      Description copied from interface: INode
      Adds a constraint which limits the Resources that can serve this Node to those that have the specific Qualification to do so.

      For further explanations and implementation examples please see TypeConstraint and TypeQualification.

      Specified by:
      addConstraint in interface INode
      Overrides:
      addConstraint in class AbstractNode
      Parameters:
      constraint - the Iconstraint to be added
    • getAttachedResourceId

      public String getAttachedResourceId()
      Description copied from interface: IPillarNode
      Gets the id of the PillarEventNode.attachedres, returns null if no resource has been attached.
      Specified by:
      getAttachedResourceId in interface IPillarNode
      Returns:
      the id of the attached resource
    • getFlavour

      Description copied from interface: IOptimizationElement
      Gets the flavour which spells out the kind of Node of the element.
      Specified by:
      getFlavour in interface IOptimizationElement
      Overrides:
      getFlavour in class TimeWindowGeoNode
      Returns:
      the flavour
    • isPillarNode

      public boolean isPillarNode()
      Description copied from interface: INode
      Checks if the node is a isPillarNode. PillarNodes will only be served if the Resource arrives on time. If the Resource is arriving too late the PillarNode will be skipped.
      Specified by:
      isPillarNode in interface INode
      Overrides:
      isPillarNode in class TimeWindowGeoNode
      Returns:
      the boolean isPillarNode
    • isResourceAttached

      public boolean isResourceAttached()
      Description copied from interface: IPillarNode
      Checks the state of attachedres.
      Specified by:
      isResourceAttached in interface IPillarNode
      Returns:
      true if an attachedResource has already ben set
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractNode
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractNode
    • setIsForcedStayNode

      public void setIsForcedStayNode(boolean isForcedStayNode)
      Description copied from interface: IPillarTimeWindowGeoNode
      Sets isForcedStayNode and AbstractNode.isStayNode to the input value.
      Specified by:
      setIsForcedStayNode in interface IPillarTimeWindowGeoNode
      Parameters:
      isForcedStayNode - the boolean to be set
    • isForcedStayNode

      public boolean isForcedStayNode()
      Description copied from interface: IPillarTimeWindowGeoNode
      Checks isForcedStayNode.
      Specified by:
      isForcedStayNode in interface IPillarTimeWindowGeoNode
      Returns:
      the value of isForcedStayNode
    • isOnlyScheduledInCompany

      public boolean isOnlyScheduledInCompany()
      Description copied from interface: IPillarNode
      Some Pillars that are scheduled are not actually jobs. Setting this to true these Pillars only need to be visited if they occur on a day that work Nodes are scheduled. The default value is false.
      Specified by:
      isOnlyScheduledInCompany in interface IPillarNode
      Returns:
      whether the Node is only scheduled in company
    • setIsOnlyScheduledInCompany

      public void setIsOnlyScheduledInCompany(boolean isOnlyScheduledInCompany)
      Description copied from interface: IPillarNode
      Sets the Pillar only to be visited of other work Nodes are scheduled that day. The default value is false.
      Specified by:
      setIsOnlyScheduledInCompany in interface IPillarNode
      Parameters:
      isOnlyScheduledInCompany - the boolean whether the Node is only scheduled in company
    • setIsSchedulableOutsideWorkingHours

      public void setIsSchedulableOutsideWorkingHours(boolean isSchedulableOutsideWorkingsHoursStart, boolean isSchedulableOutsideWorkingsHoursEnd)
      Description copied from interface: IPillarNode
      Sets the Pillar that it has to be visited by a Resource outside of her WorkingHours if IResource.setMaxPillarAfterHoursTime(Duration) is also set to true.
      Specified by:
      setIsSchedulableOutsideWorkingHours in interface IPillarNode
      Parameters:
      isSchedulableOutsideWorkingsHoursStart - the boolean if working is possible before workingHours
      isSchedulableOutsideWorkingsHoursEnd - the boolean if working is possible after workingHours
    • isSchedulableBeforeWorkingHours

      public boolean isSchedulableBeforeWorkingHours()
      Description copied from interface: IPillarNode
      Checks isSchedulableOutsideWorkingsHoursStart. The default value is false.
      Specified by:
      isSchedulableBeforeWorkingHours in interface IPillarNode
      Returns:
      whether working is possible before workingHours
    • isSchedulableAfterWorkingHours

      public boolean isSchedulableAfterWorkingHours()
      Description copied from interface: IPillarNode
      Checks isSchedulableOutsideWorkingsHoursEnd. The default value is false.
      Specified by:
      isSchedulableAfterWorkingHours in interface IPillarNode
      Returns:
      whether working is possible after workingHours
    • setIsOverwritingRouteStart

      public void setIsOverwritingRouteStart(boolean isOverwritingRouteStart, boolean isAdjustable)
      Description copied from interface: IPillarTimeWindowGeoNode
      Overwrites the Route start, forcing the IResource to visit this AnchorNode first. An AnchorNode essentially is an IPillarNode that is specifically set to start or end an ILogicEntityRoute. Any driving time or distance for the Resource between the AnchorNode and its home is not counted. An example would be a truck driver who has to park his truck in a specific truck deposit and travels on his own time to/from home.

      The boolean isAdjustable defines whether the Pillar can still be moved a bit, allowing the AnchorNode to be shifted towards the INode following it on the Route.

      Specified by:
      setIsOverwritingRouteStart in interface IPillarTimeWindowGeoNode
      Parameters:
      isOverwritingRouteStart - the boolean, if true turning the Pillar in an AnchorNode
      isAdjustable - the boolean allowing the AnchorNode to be shifted slightly
    • setIsOverwritingRouteTermination

      public void setIsOverwritingRouteTermination(boolean isOverwritingRouteTermination, boolean isAdjustable)
      Description copied from interface: IPillarNode
      Sets the Pillar to bean AnchorPillar at which the Route has to start or end. The boolean defines whether the Pillar can still be moved.
      Specified by:
      setIsOverwritingRouteTermination in interface IPillarNode
      Parameters:
      isOverwritingRouteTermination - the boolean whether it is overwriting route termination
      isAdjustable - the boolean whether it is adjustable
    • isAutoFilterProtected

      public boolean isAutoFilterProtected()
      Description copied from interface: INode
      Checks if the Node is protected from being filtered.
      Specified by:
      isAutoFilterProtected in interface INode
      Overrides:
      isAutoFilterProtected in class AbstractNode
      Returns:
      true if the condition allows
    • isOverwritingRouteStartOrTermination

      public boolean isOverwritingRouteStartOrTermination()
      Description copied from interface: IPillarNode
      Checks if the Pillar is an AnchorPillar in which case the Route has to start or and at said AnchorPillar. The default values are false
      Specified by:
      isOverwritingRouteStartOrTermination in interface IPillarNode
      Returns:
      the states if either the route start or the route termination is overwritten
    • isAutoTransformable2StartAnchor

      public boolean isAutoTransformable2StartAnchor()
      Description copied from interface: IPillarTimeWindowGeoNode
      Checks if this Pillar will automatically transform into an anchorNode if it is the first Pillar and cannot be reached in time..
      Specified by:
      isAutoTransformable2StartAnchor in interface IPillarTimeWindowGeoNode
      Returns:
      true if it can transform into an anchorNode
    • setAutoTransformable2StartAnchor

      public void setAutoTransformable2StartAnchor(boolean isAutoTransformable2StartAnchor)
      Description copied from interface: IPillarTimeWindowGeoNode
      When this Pillar is the first pillar and cannot be reached in time, it will automatically transform into an anchorNode if set to true.
      Specified by:
      setAutoTransformable2StartAnchor in interface IPillarTimeWindowGeoNode
      Parameters:
      isAutoTransformable2StartAnchor - the boolean, might transform into an anchorNode if true
    • setConnectionRelatedLateMargin

      public boolean setConnectionRelatedLateMargin(double connectionFator, Duration maxMargin, boolean shiftNode, boolean applyPartial)
      Description copied from interface: IPillarTimeWindowGeoNode
      Sets the connection related late margin. Margin is calculated as margin = connectionToElement*factor. If the margin is bigger than maxMargin the maxMargin is used. If shiftElement is true, the node will move to beginning of the used margin. If applyPartial is set to true, a pillar with higher lateness than what the margin could compensate is at least compensated partially. If false, no margin is applied.
      Specified by:
      setConnectionRelatedLateMargin in interface IPillarTimeWindowGeoNode
      Parameters:
      connectionFator - the connectionFactor
      maxMargin - the max margin
      shiftNode - the shift element
      applyPartial - the apply partial
      Returns:
      true, if successful
    • resetConnectionRelatedMargin

      public void resetConnectionRelatedMargin()
      Specified by:
      resetConnectionRelatedMargin in interface IPillarTimeWindowGeoNode
    • getConnectionRelatedLateMargin

      public Optional<Long> getConnectionRelatedLateMargin(long connectionMillis)
      Description copied from interface: IPillarTimeWindowGeoNode
      Gets the connection related late margin.
      Specified by:
      getConnectionRelatedLateMargin in interface IPillarTimeWindowGeoNode
      Parameters:
      connectionMillis - the connection millis
      Returns:
      the connection related late margin
    • isDoElementShiftConnectionRelatedLateMargin

      public boolean isDoElementShiftConnectionRelatedLateMargin()
      Description copied from interface: IPillarTimeWindowGeoNode
      Checks if is do element shift connection related late margin.
      Specified by:
      isDoElementShiftConnectionRelatedLateMargin in interface IPillarTimeWindowGeoNode
      Returns:
      true, if is do element shift connection related late margin
    • isApplyPartialConnectionRelatedLateMargin

      public boolean isApplyPartialConnectionRelatedLateMargin()
      Description copied from interface: IPillarTimeWindowGeoNode
      Checks if is apply partial connection related late margin.
      Specified by:
      isApplyPartialConnectionRelatedLateMargin in interface IPillarTimeWindowGeoNode
      Returns:
      true, if is apply partial connection related late margin
    • getConnectionRelatedMaxLateMargin

      public Duration getConnectionRelatedMaxLateMargin()
      Description copied from interface: IPillarTimeWindowGeoNode
      Gets the connection related max late margin.
      Specified by:
      getConnectionRelatedMaxLateMargin in interface IPillarTimeWindowGeoNode
      Returns:
      the connection related max late margin
    • getConnectionRelatedMarginFactor

      public double getConnectionRelatedMarginFactor()
      Description copied from interface: IPillarTimeWindowGeoNode
      Gets the connection related margin factor.
      Specified by:
      getConnectionRelatedMarginFactor in interface IPillarTimeWindowGeoNode
      Returns:
      the connection related margin factor