Interface INode

All Superinterfaces:
IOptimizationElement, Serializable
All Known Subinterfaces:
IPillarEventNode, IPillarExtendableNode, IPillarNode, IPillarTimeWindowGeoNode
All Known Implementing Classes:
AbstractNode, EventNode, InducedIdleEventNode, PillarEventNode, PillarExtenbdableEventNode, PillarTimeWindowGeoNode, TimeWindowGeoNode

public interface INode extends IOptimizationElement
The Interface INode. Nodes are single work orders to be performed within a schedule (IOpeningHours). Each node has different properties like skills, workload, time-window, loading restrictions. Together with IResource, Nodes build the input for the optimization run.
Since:
21/08/2018
Version:
30/09/2019
Author:
DNA
  • Method Details

    • getVisitDurationMillis

      long getVisitDurationMillis(ILogicEntityRoute ownerRoute)
      Gets the defined visit duration of a job at a Node in seconds.
      Parameters:
      ownerRoute - the owner route
      Returns:
      the long visit duration in millis.
    • hasRouteDependentVisitDuration

      boolean hasRouteDependentVisitDuration()
      Checks for route dependent visit duration.
      Returns:
      true, if successful
    • setHasRouteDependentVisitDuration

      void setHasRouteDependentVisitDuration(boolean hasRouteDependentVisitDuration)
      Sets the checks for route dependent visit duration. Keep in mind: Some internal node classes do not accept a manipulation of the visit duration.
      Parameters:
      hasRouteDependentVisitDuration - the new checks for route dependent visit duration
    • getBaseVisitDurationMillis

      long getBaseVisitDurationMillis()
      Gets the base visit duration in millis
      Returns:
      the base visit duration
    • getBaseVisitDuration

      int getBaseVisitDuration()
      Deprecated.
      Gets the base visit duration in seconds
      Returns:
      the base visit duration
    • setVisitDuration

      void setVisitDuration(int visitDuration)
      Deprecated.
      Sets the visit duration of a job at a Node in seconds.
      Parameters:
      visitDuration - the int new visit duration seconds.
    • setVisitDurationMillis

      void setVisitDurationMillis(long visitDurationMillis)
      Sets the visit duration millis.
      Parameters:
      visitDurationMillis - the new visit duration millis
    • setMinimalVisitDuration

      void setMinimalVisitDuration(Duration minimalVisitDuration)
    • getMinVisitDurationMillis

      long getMinVisitDurationMillis()
      Deprecated.
      Gets the min visit duration millis.
      Returns:
      the min visit duration millis
    • setUnassigned

      void setUnassigned(boolean unassigned)
      Sets the Node to be unassigned, meaning not part of any Route. The default value is false.

      This method es bing used internally.

      Parameters:
      unassigned - the boolean for the new unassigned
    • isUnassigned

      boolean isUnassigned()
      Checks if the node was unassigned by the INodeUnassigner. An unassigned Node is not part of any Route
      Returns:
      boolean true if the node was unassigned
    • addViolation

      void addViolation(IViolation violation)
      Adds a IViolation to Node. This method is used internally.
      Parameters:
      violation - the violation
    • getViolations

      List<IViolation> getViolations()
      Gets the IViolation of the Node. Only has a non-empty list in case a result was requested.
      Returns:
      the List<IViolation> violations
    • setFixCost

      void setFixCost(double fixCost)
      Sets the fixCost for visiting the Node. The default value of the double is 0.
      Parameters:
      fixCost - the double fixCost
    • getFixCost

      double getFixCost()
      Gets the fixCost. The default value of the double is 0.
      Returns:
      the double fixCost
    • isStayNode

      boolean isStayNode()
      Checks if the Node can be used as for an overnight stay. The default value is false.

      This allows the Resource to stay at this Node at the end of the Route instead of returning home and proceeding from there the next day. The Resource also needs IWorkingHours.getIsAvailableForStay() to be set to true in order to be able to stay there at the end of the Route.

      Returns:
      the boolean if a Resource can stay there
    • setIsStayNode

      void setIsStayNode(boolean canBeResourceStay)
      Sets Node as a possible overnight stay Node.

      This allows the Resource to stay at this Node at the end of the Route instead of returning home and proceeding from there the next day. The Resource also needs IWorkingHours.getIsAvailableForStay() to be set to true in order to be able to stay there at the end of the Route.

      Parameters:
      canBeResourceStay - if the boolean is set to true the Node can be used for overnight stays
    • isWorkNode

      @Deprecated boolean isWorkNode()
      Deprecated.
      Checks if is a Node is a work Node which is the default where a Resource has a job to do. This method is needed because it is possible to define a Node as a setIsStayNode(boolean) but not as a work Node.
      Returns:
      the boolean whether Resources can do work at this Node
    • setIsWorkNode

      @Deprecated void setIsWorkNode(boolean isWorkNode)
      Deprecated.
      Sets the Node as a work Node which is the default where a Resource has a job to do. This method is needed because it is possible to define a Node as a setIsStayNode(boolean) but not as a work Node
      Parameters:
      isWorkNode - the boolean for the workNode
    • isOfferedNode

      boolean isOfferedNode()
      Checks if the Node is a offered Node which has its own AbstractNode.individualOfferedNodeMultiplier. An offered Node usually has a higher priority to be integrated into a Route which is done by multiplying the cost for this specific Node when being missed.
      Returns:
      the boolean isOfferedNode
    • setIsOfferedNode

      void setIsOfferedNode(boolean isOfferedNode)
      Sets as a offered Node. The default value is false. When a node is marked as offered node more costs can arise when violating any of the constraints of the node. An offered Node usually has a higher priority to be integrated into a Route which is done by multiplying the cost for this specific Node when being missed.
      Parameters:
      isOfferedNode - the boolean to be set
      See Also:
    • getIndividualOfferedNodeMultiplier

      double getIndividualOfferedNodeMultiplier()
      Gets a cost multiplier for this specific Node.
      Returns:
      the double individualOfferedNodeMultiplier
    • setIndividualOfferedNodeMultiplier

      void setIndividualOfferedNodeMultiplier(double individualOfferedNodeMultiplier)
      Sets the multiplier of the cost for this specific Node. The default value is 1. When using a higher value the default costs arising from not fulfilling any constraints of the node are multiplied by this factor, therefore giving the Node a higher priority to be given service on time.
      Parameters:
      individualOfferedNodeMultiplier - the double to be set
    • setImportance

      void setImportance(int priority)
      Sets the priority/importance. The default value is 1.
      Parameters:
      priority - the int priority to be set.
    • getImportance

      int getImportance()
      Gets the priority.
      Returns:
      the int priority
    • isWaitOnEarlyArrival

      boolean isWaitOnEarlyArrival()
      Checks if the Resource, if arriving early, has to wait until the start of the IOpeningHours before being able to work. The default value is true, in which case arriving too early means idle time.
      Returns:
      the boolean waitOnEarlyArrival
    • setWaitOnEarlyArrival

      void setWaitOnEarlyArrival(boolean waitOnEarlyArrival)
      Sets whether a Resource has to wait when arriving before the IOpeningHours of the Node. The default value is true.

      When wait on early arrival is set to false, a visiting resource will start working right away. In contrast, if WaitOnEarlyArrival is set to true, a Resource will idle until a Node opens based on its defined IWorkingHours.

      Parameters:
      waitOnEarlyArrival - the boolean to be set
    • isPillarNode

      boolean isPillarNode()
      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.
      Returns:
      the boolean isPillarNode
    • addNode2NodeRelation

      void addNode2NodeRelation(INode2NodeRelation relation)
      Sets two Nodes in a Relation. A MasterNode has to be served before a RelatedNode.

      For further explanation and implementation examples please see INode2NodeRelation.

      Parameters:
      relation - the INode2NodeRelation to be added
    • getNode2NodeRelations

      List<INode2NodeRelation> getNode2NodeRelations()
      Gets the Relations of the Node.

      For further explanation and implementation examples please see INode2NodeRelation.

      Returns:
      the arraylist List<INode2NodeRelation> node2NodeRelation
    • hasFullJobLevelRelations

      boolean hasFullJobLevelRelations()
      Checks if all the data of the Node should be saved in a ILogicRouteElementDetailItem. The default value is false.

      The only other instance when this data is saved is when a ILogicRouteElementDetailItem is requested.

      Returns:
      the boolean hasFullJobLevelRelations
    • hasRelations

      boolean hasRelations()
      Checks if the Node has any Relations.

      For further explanation and implementation examples of Relations please see INode2NodeRelation

      Returns:
      the boolean hasRelations
    • addConstraint

      void addConstraint(IConstraint constraint)
      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.

      Parameters:
      constraint - the Iconstraint to be added
    • getConstraints

      List<IConstraint> getConstraints()
      Gets the Constraints which limit 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.

      Returns:
      the List<IConstraint> constraints
    • setConstraints

      void setConstraints(List<IConstraint> constraints)
      Sets the ArrayList constraints which limit the Resources that can serve this * Node to those that have the specific Qualification to do so. Cannot be null.

      For further explanations and implementation examples please see TypeConstraint and TypeQualification

      Parameters:
      constraints - the Arraylist constraints to be set
    • setLoad

      void setLoad(double[] load)
      Sets the amount of goods the Resource is getting added by visiting the Resource. Can be negative (delivering packages).
      Parameters:
      load - the double array
      See Also:
    • getLoad

      double[] getLoad()
      Gets the amount of goods the Resource is getting added by visiting the Resource. Can be negative (delivering packages).
      Returns:
      the double array loadv
      See Also:
    • setUnloadAll

      void setUnloadAll(boolean unloadAll)
      Allows the Resource to unload all its Capacity at this Node
      Parameters:
      unloadAll - the boolean to be set
      See Also:
    • isUnloadAll

      boolean isUnloadAll()
      Checks if it is possible for the Resource to unload all its Capacity at this Node.
      Returns:
      the boolean unloadAll
    • setUnloadAllDimension

      void setUnloadAllDimension(int unloadAllDimension, int totalLoadDimension)
      Allows a Resource to unload all its Capacity of a specific good ( dimension) at this Node.
      Parameters:
      unloadAllDimension - the int unloadAllDimension
      totalLoadDimension - the int totalLoadDimension
    • getUnloadAllDimension

      int getUnloadAllDimension()
      Gets if it is allowed for a Resource to unload all its Capacity of a specific good (dimension) at this Node.
      Returns:
      the int unloadAllDimension
    • getTotalLoadDimension

      int getTotalLoadDimension()
      Gets the total load of a specific good.
      Returns:
      the int totalLoadDimension
    • getAutoFilterViolationCollector

      IAutoFilterViolationAndConstrainCollector getAutoFilterViolationCollector()
      Gets the AbstractNode.myAutoFilterViolationCollector that collected all IViolation.
      Returns:
      the myAutoFilterViolationCollector
    • setAutoFilterConstraints

      void setAutoFilterConstraints(List<IAutoFilterNodeConstraint> autoFilterNodeConstraints)
      Sets a IConstraint at a Node for which it could be filtered.
      Parameters:
      autoFilterNodeConstraints - the AutoFilterViolationAndConstraintCollector to be set
    • removeConstraint

      boolean removeConstraint(IConstraint removeConstraint)
      Removes the IConstraint from this Node.
      Parameters:
      removeConstraint - the constraint to be removed
      Returns:
      the List<IConstraint> constraints that were removed
    • removeNode2NodeRelations

      boolean removeNode2NodeRelations(INode2NodeRelation removeRelation)
      Removes a INode2NodeRelation from the Node
      Parameters:
      removeRelation - the INode2NodeRelation that will be removed
      Returns:
      the relation that was removed
    • setOptimizable

      void setOptimizable(boolean isOptimizable)
      Sets if the Node can still be moved around or if it is on lockdown and is fixed.
      Parameters:
      isOptimizable - the boolean isOptimizable to be set
    • isOptimizable

      boolean isOptimizable()
      Checks isOptimizable, the default value is true.
      Returns:
      the boolean isOptimizable
    • isDutyHoursIncludesVisitDuration

      boolean isDutyHoursIncludesVisitDuration()
      Checks whether the job at the Node has to be done within the IOpeningHours or if the IResource only has to arrive and start the job within that time.
      Returns:
      the boolean isDutyHoursIncludesVisitDuration
      See Also:
    • setIsDutyHoursIncludesVisitDuration

      void setIsDutyHoursIncludesVisitDuration(boolean isDutyHoursIncludeVisitDuration)
      Sets isDutyHoursIncludesVisitDuration, if set to false, the DutyHours act as an access window in which the work has to be started. If set to true the work has to be finished within the DutyHours.
      Parameters:
      isDutyHoursIncludeVisitDuration - the boolean if the work has to be done within the Dutyhours
    • setJointVisitDuration

      void setJointVisitDuration(Duration visitDuration)
      If two or more Nodes are close to one another, the visitDuration of the Nodes after the first one can be reduced since for example less loading and unloading time is needed . Sets the reduced visitDuration for these Nodes instead of the normal visit duration.
      Parameters:
      visitDuration - the duration of the reduced visit
    • getJointVisitDuration

      int getJointVisitDuration(ILogicEntityRoute ownerRoute)
      Deprecated.
      Gets the jointVisitDuration, which is the reduced visitDuration of a Node caused by efficiency effects since several Nodes close to one another.
      Parameters:
      ownerRoute - the owner route
      Returns:
      the joint visit duration
    • getJointVisitDurationMillis

      long getJointVisitDurationMillis(ILogicEntityRoute ownerRoute)
      Gets the AbstractNode.getJointVisitDurationMillis(com.dna.jopt.member.bucket.route.ILogicEntityRoute), which is the reduced visitDuration of a Node caused by efficiency effects since several Nodes close to one another.
      Parameters:
      ownerRoute - the owner route
      Returns:
      the joint visit duration
    • isUseJointVisitDuration

      boolean isUseJointVisitDuration()
      Checks if there are beneficial effects of a reduced visitDuration since several Nodes are close to one another. The default value is false.

      Will be set to true by setJointVisitDuration(Duration).

      Returns:
      the boolean if visitDuration is reduced
    • setIsCausingIdleTimeCost

      void setIsCausingIdleTimeCost(boolean isCausingIdleTimeCost)
      Sets isCausingIdleTimeCost, the default value is true. When isWaitOnEarlyArrival() is true, a resource can generate idle time at a node. However, in a partially loaded optimization (so the amount of available working time of the resources is much higher than the required working time at the nodes) with tight IOpeningHours of the nodes, a lot of idle time can arise, as resources have to wait till nodes are opening and have nothing else to do. This can lead to bad optimization results, as the optimizer tries to avoid idle time and whitespace.

      By setting isCausingIdleTimeCost to false, idle time at this node does not generate cost.

      Parameters:
      isCausingIdleTimeCost - the boolean to be set
    • isCausingIdleTimeCost

      boolean isCausingIdleTimeCost()
      Checks if the Node can cause idle time. If set to false the Node still causes idle time but at no cost. The default value is true.
      Returns:
      the boolean isCausingIdleTimeCost
    • setIsOptional

      void setIsOptional(boolean isOptional)
      Sets the Node as an optional Node. The Resource can go to one of many optional Nodes to do a task (for example dump waste, get new packets to deliver) but does not have to go to a specific optional Node.
      Parameters:
      isOptional - the boolean to set the Node as an optional Node
    • isOptional

      boolean isOptional()
      Checks if it is an optional Node one of which the Resource may visit in order to further be able to do its job (for example a waste dump or a packet station.The default value is false.
      Returns:
      the boolean to be checked
    • setNodeColor

      void setNodeColor(INodeColor color)
      Sets the INodeColor to the Node by adding a NodeColorCapacityItem. By using IWorkingHours.addNodeColorCapacity(NodeColorCapacityItem) it limits 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. The default value is NodeColors.DEFAULT.
      Parameters:
      color - the iNodeColor
    • getNodeColor

      INodeColor getNodeColor()
      Gets the INodeColor of the Node.

      For more information please see setNodeColor(INodeColor).

      Returns:
      the iNodeColor
    • isAutoFilterProtected

      boolean isAutoFilterProtected()
      Checks if the Node is protected from being filtered.
      Returns:
      true if the condition allows
    • setMinAutoFilterProtectedExecutions

      void setMinAutoFilterProtectedExecutions(int numProtectedExecutions)
      Sets a number of iterations of the Optimizer in which the Node is protected from being filtered by the IAutoNodeFilter.
      Parameters:
      numProtectedExecutions - the int value
    • decrementCurrentAutoFilterProtectedExecutions

      int decrementCurrentAutoFilterProtectedExecutions()
      The number of iterations the Node is still protected from being autofiltered.
      Returns:
      the int numCurrentProtectedExecutions
    • getCurrentLeftAutoFilterProtectedExecutions

      int getCurrentLeftAutoFilterProtectedExecutions()
      Gets the AbstractNode.numCurrentProtectedExecutions, the default value is 0.
      Returns:
      the
    • detachResourceConstraints

      void detachResourceConstraints()
      Removes all IConstraint. This method is used internally.
    • detachResourceConstraints

      void detachResourceConstraints(String resId)
      Removes the IResource with the given resId from the IConstraint that are IConstraintResource. This method is used internally.
      Parameters:
      resId - the string Resource /D
    • getLastKnownAttachedAndRemovedResIds

      List<String> getLastKnownAttachedAndRemovedResIds()
    • addQualification

      void addQualification(IQualification qualification)
      Adds a IQualification to the Resource, which means that by adding a IConstraint to the INode, they are limited to which Nodes they can give service.

      Used in UKPostCodeConstraint.

      Parameters:
      qualification - the iQualification that is to be added
    • getQualifications

      Map<Class<? extends IQualification>,IQualification> getQualifications()
      Gets the IQualification of the Resource.
      Returns:
      the node qualifications
      See Also:
    • addSubsequentSlaveNode

      void addSubsequentSlaveNode(INode node)
      Adds a subsequent slave node, which need to be visited in direct succession. The slave node should not be added directly to the optimization.
      Parameters:
      node - the subsequent slave node
    • addSubsequentSlaveNodes

      void addSubsequentSlaveNodes(List<INode> nodes)
      Adds a list of subsequent slave nodes, which need to be visited in direct succession. The slave nodes should not be added directly to the optimization.
      Parameters:
      nodes - the subsequent slave nodes
    • getSubsequentSlaveNodes

      List<INode> getSubsequentSlaveNodes()
    • resetSubsequentSlaveNodes

      void resetSubsequentSlaveNodes()
    • getOriginalDutyHours

      List<IDutyHours> getOriginalDutyHours()
    • tempSetActiveDutyHours

      void tempSetActiveDutyHours(Set<Integer> tempActivateIndicesSet)
    • resetDutyHoursTempActivation

      void resetDutyHoursTempActivation()
    • setNodeDepot

      void setNodeDepot(INodeDepot depot)
    • getNodeDepot

      Optional<INodeDepot> getNodeDepot()
    • detachNodeRelations

      void detachNodeRelations()
    • setWaitOnEarlyArrivalFirstNode

      void setWaitOnEarlyArrivalFirstNode(boolean waitOnEarlyArrival)
    • isWaitOnEarlyArrivalFirstNode

      boolean isWaitOnEarlyArrivalFirstNode()
    • setFirstNodeInRouteImportance

      void setFirstNodeInRouteImportance(int importance)
    • getFirstNodeInRouteImportance

      int getFirstNodeInRouteImportance()
    • setLastNodeInRouteImportance

      void setLastNodeInRouteImportance(int importance)
    • getLastNodeInRouteImportance

      int getLastNodeInRouteImportance()
    • setLockdownTime

      void setLockdownTime(long lockdowntime)
    • getLockdownTime

      Optional<Long> getLockdownTime()
    • getBaseJointVisitDuration

      @Deprecated int getBaseJointVisitDuration()
      Deprecated.
    • getBaseJointVisitDurationMillis

      long getBaseJointVisitDurationMillis()
    • setOptimizable

      void setOptimizable(boolean isOptimizable, boolean forceKeepLockdownTime)
    • isReturnStart

      boolean isReturnStart()
    • setIsReturnStart

      boolean setIsReturnStart(Duration stayAtStartDuration)
    • getStayAtStartDuration

      Duration getStayAtStartDuration()
    • resetLockdownTime

      void resetLockdownTime()
    • tempIncreaseImplausibleScore

      void tempIncreaseImplausibleScore()
    • getTempImplausibleScore

      int getTempImplausibleScore()
    • setAllowMoveToReduceFlexTime

      void setAllowMoveToReduceFlexTime(boolean allowMoveToReduceFlexTime)
    • isAllowMoveToReduceFlexTime

      boolean isAllowMoveToReduceFlexTime()