Class AbstractBasicCapacityResource

java.lang.Object
com.dna.jopt.member.unit.AbstractOptimizationElement
com.dna.jopt.member.unit.resource.AbstractBasicCapacityResource
All Implemented Interfaces:
IOptimizationElement, IBasicResource, Serializable, Comparable<IBasicResource>
Direct Known Subclasses:
CapacityResource

public abstract class AbstractBasicCapacityResource extends AbstractOptimizationElement implements IBasicResource
See Also:
  • Constructor Details

    • AbstractBasicCapacityResource

      protected AbstractBasicCapacityResource()
    • AbstractBasicCapacityResource

      protected AbstractBasicCapacityResource(String resourceId, double latitude, double longitude, Duration maxTime, javax.measure.Quantity<javax.measure.quantity.Length> maxDistance, List<IWorkingHours> workingHours)
    • AbstractBasicCapacityResource

      protected AbstractBasicCapacityResource(String resourceId, com.dna.jopt.config.types.Position pos, Duration maxTime, javax.measure.Quantity<javax.measure.quantity.Length> maxDistance, List<IWorkingHours> workingHours)
    • AbstractBasicCapacityResource

      @Deprecated protected AbstractBasicCapacityResource(String resourceId, double latitude, double longitude, double maxHours, double maxDistance, List<IDutyHours> workingHours)
      Deprecated.
    • AbstractBasicCapacityResource

      @Deprecated public AbstractBasicCapacityResource(String resourceId, double latitude, double longitude, double maxHours, double maxDistance, WorkingHours[] workingHours)
      Deprecated.
      Parameters:
      resourceId - the resource id
      latitude - the latitude
      longitude - the longitude
      maxHours - the max hours
      maxDistance - the max distance
      workingHours - the working hours
      Category:
      Legacy

      LEGACY CONSTRUCTOR

      Instantiates a new capacity resource.

      PLEASE DO NOT USE THIS CONSTRUCTOR ANYMORE! IT WILL BE REMOVED IN FUTURE VERSIONS

  • Method Details

    • copyWithNewId

      public static IResource copyWithNewId(IResource src, String targetId)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractOptimizationElement
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class AbstractOptimizationElement
    • setDestinationPosition

      public void setDestinationPosition(com.dna.jopt.config.types.Position destinationPosition)
      Specified by:
      setDestinationPosition in interface IBasicResource
    • getDestinationPosition

      public com.dna.jopt.config.types.Position getDestinationPosition()
      Specified by:
      getDestinationPosition in interface IBasicResource
    • setDestinationLatitude

      public void setDestinationLatitude(double destinationLatitude)
      Description copied from interface: IBasicResource
      Sets the latitude of an alternate destination (IBasicResource.setAlternateDestination(boolean)) where the IResource will stop working. The Resource will have to travel back to its starting location outside of the IWorkingHours since it will start working there and not at the alternate destination.

      An application example would be a truck driver that has to park his truck in a garage outside of the city in the evening but has to start working withing the city the next morning. The drive from the garage in the evening and getting the truck from the garage to the starting location in the morning is not considered part of the WorkingHours.

      Implementation example:

      
       CapacityResource jackTheTruckDriver =
               new CapacityResource(
                   "Jack", 50.775346, 6.083887, maxWorkingTime, maxDistanceKmW, workingHours);
      
       // Defining the alternate destination where work will end
           rep1.setDestinationLatitude(51.45);
           rep1.setDestinationLongitude(7.01667);
           rep1.setAlternateDestination(true);
           rep1.setCost(0, 1, 1);
      
           this.addElement(jackTheTruckDriver);
       
      Specified by:
      setDestinationLatitude in interface IBasicResource
      Parameters:
      destinationLatitude - the double for the alternate destination latitude
    • getDestinationLatitude

      public double getDestinationLatitude()
      Description copied from interface: IBasicResource
      Gets the latitude of an alternate destination (IBasicResource.setAlternateDestination(boolean)) where the IResource will stop working. The Resource will have to travel back to its starting location outside of the IWorkingHours since it will start working there and not at the alternate destination.

      An application example would be a truck driver that has to park his truck in a garage outside of the city in the evening but has to start working withing the city the next morning. The drive from the garage in the evening and getting the truck from the garage to the starting location in the morning is not considered part of the WorkingHours.

      Specified by:
      getDestinationLatitude in interface IBasicResource
      Returns:
      the double for the alternate destination latitude
    • setDestinationLongitude

      public void setDestinationLongitude(double destinationLongitude)
      Description copied from interface: IBasicResource
      Sets the longitude of an alternate destination (IBasicResource.setAlternateDestination(boolean)) where the IResource will stop working. The Resource will have to travel back to its starting location outside of the IWorkingHours since it will start working there and not at the alternate destination.

      An application example would be a truck driver that has to park his truck in a garage outside of the city in the evening but has to start working withing the city the next morning. The drive from the garage in the evening and getting the truck from the garage to the starting location in the morning is not considered part of the WorkingHours.

      Implementation example:

      
       CapacityResource jackTheTruckDriver =
               new CapacityResource(
                   "Jack", 50.775346, 6.083887, maxWorkingTime, maxDistanceKmW, workingHours);
      
       // Defining the alternate destination where work will end
           rep1.setDestinationLatitude(51.45);
           rep1.setDestinationLongitude(7.01667);
           rep1.setAlternateDestination(true);
           rep1.setCost(0, 1, 1);
      
           this.addElement(jackTheTruckDriver);
       
      Specified by:
      setDestinationLongitude in interface IBasicResource
      Parameters:
      destinationLongitude - the double for the alternate destination longitude
    • getDestinationLongitude

      public double getDestinationLongitude()
      Description copied from interface: IBasicResource
      Gets the longitude of an alternate destination (IBasicResource.setAlternateDestination(boolean)) where the IResource will stop working. The Resource will have to travel back to its starting location outside of the IWorkingHours since it will start working there and not at the alternate destination.

      An application example would be a truck driver that has to park his truck in a garage outside of the city in the evening but has to start working withing the city the next morning. The drive from the garage in the evening and getting the truck from the garage to the starting location in the morning is not considered part of the WorkingHours.

      Specified by:
      getDestinationLongitude in interface IBasicResource
      Returns:
      the double for the alternate destination longitude
    • setAlternateDestination

      public void setAlternateDestination(boolean hasAlternateDestination)
      Description copied from interface: IBasicResource
      Sets the hasAlternateDestination. When set to true the IResource has to stop working at this alternate destination. The Resource will have to travel back to its starting location outside of the IWorkingHours since it will start working there and not at the alternate destination.

      An application example would be a truck driver that has to park his truck in a garage outside of the city in the evening but has to start working withing the city the next morning. The drive from the garage in the evening and getting the truck from the garage to the starting location in the morning is not considered part of the WorkingHours.

      Implementation example:

      
       CapacityResource jackTheTruckDriver =
               new CapacityResource(
                   "Jack", 50.775346, 6.083887, maxWorkingTime, maxDistanceKmW, workingHours);
      
       // Defining the alternate destination where work will end
           rep1.setDestinationLatitude(51.45);
           rep1.setDestinationLongitude(7.01667);
           rep1.setAlternateDestination(true);
           rep1.setCost(0, 1, 1);
      
           this.addElement(jackTheTruckDriver);
       
      Specified by:
      setAlternateDestination in interface IBasicResource
      Parameters:
      hasAlternateDestination - the boolean hasAlternateDestination to be set
    • hasAlternateDestination

      public boolean hasAlternateDestination()
      Description copied from interface: IBasicResource
      Gets the hasAlternateDestination. When set to true the IResource has to stop working at this alternate destination. The Resource will have to travel back to its starting location outside of the IWorkingHours since it will start working there and not at the alternate destination.

      An application example would be a truck driver that has to park his truck in a garage outside of the city in the evening but has to start working withing the city the next morning. The drive from the garage in the evening and getting the truck from the garage to the starting location in the morning is not considered part of the WorkingHours.

      Specified by:
      hasAlternateDestination in interface IBasicResource
      Returns:
      the boolean hasAlternateDestination
    • setMaxHours

      @Deprecated public void setMaxHours(double maxHours)
      Deprecated.
      Description copied from interface: IBasicResource
      Deprecated method

      Sets the double maxGlobalHours, the maximum hours a route [h] can take per day.

      Specified by:
      setMaxHours in interface IBasicResource
      Parameters:
      maxHours - the double maxGlobalHours to be set
    • setMaxWorkingTime

      public void setMaxWorkingTime(Duration maxTime)
      Description copied from interface: IBasicResource
      Sets the maximum hours a IResource is allowed to work per day without throwing a Violation.
      Specified by:
      setMaxWorkingTime in interface IBasicResource
      Parameters:
      maxTime - the duration max time
    • getMaxWorkingTime

      public Duration getMaxWorkingTime()
      Description copied from interface: IBasicResource
      Gets the maximum time a IResource is allowed to be on a ILogicEntityRoute without throwing a Violation.
      Specified by:
      getMaxWorkingTime in interface IBasicResource
      Returns:
      the duration of the maximum working time
    • getMaxHours

      public double getMaxHours()
      Description copied from interface: IBasicResource
      Gets the double maxGlobalHours, the maximum hours a route [h] can take per day.
      Specified by:
      getMaxHours in interface IBasicResource
      Returns:
      the double maxGlobalHours
    • setMaxDistance

      @Deprecated public void setMaxDistance(double maxDistance)
      Deprecated.
      Description copied from interface: IBasicResource
      Sets the max distance maxGlobalDistanceKilometer in [km] that a route can take.
      Specified by:
      setMaxDistance in interface IBasicResource
      Parameters:
      maxDistance - the double to be set for maxGlobalDistanceKilometer
    • setMaxWorkingDistance

      public void setMaxWorkingDistance(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance)
      Description copied from interface: IBasicResource
      Sets the maximal distance a IResource is allowed to travel per WorkingHour without throwing a IViolation.
      Specified by:
      setMaxWorkingDistance in interface IBasicResource
      Parameters:
      maxDistance - the quantity length of the allowed max distance
    • getMaxWorkingDistance

      public javax.measure.Quantity<javax.measure.quantity.Length> getMaxWorkingDistance()
      Description copied from interface: IBasicResource
      Gets the maximum distance a IResource is allowed to take without throwing a Violation per day.
      Specified by:
      getMaxWorkingDistance in interface IBasicResource
      Returns:
      the quantity Length maximum distance
    • getMaxDistance

      public double getMaxDistance()
      Description copied from interface: IBasicResource
      Gets the max distance maxGlobalDistanceKilometer in [km] that a route can take per day.
      Specified by:
      getMaxDistance in interface IBasicResource
      Returns:
      the double maxGlobalDistanceKilometer [km] a route can take
    • setAvgSpeed

      public void setAvgSpeed(javax.measure.Quantity<javax.measure.quantity.Speed> avgSpeed)
      Description copied from interface: IBasicResource
      Sets the average speed the IResource is allowed to take.
      Specified by:
      setAvgSpeed in interface IBasicResource
      Parameters:
      avgSpeed - the quantity speed average speed
    • getAverageSpeed

      public javax.measure.Quantity<javax.measure.quantity.Speed> getAverageSpeed()
      Description copied from interface: IBasicResource
      Gets the average speed a IResource is traveling with.
      Specified by:
      getAverageSpeed in interface IBasicResource
      Returns:
      the average speed
    • setAvgSpeed

      @Deprecated public void setAvgSpeed(double avgSpeed)
      Deprecated.
      Description copied from interface: IBasicResource
      Sets the avg speed avgSpeed, the default value is 22.0 m/s.
      Specified by:
      setAvgSpeed in interface IBasicResource
      Parameters:
      avgSpeed - the double average speed of the resource in m/s (applies if no time matrix is provided)
    • getAvgSpeed

      public double getAvgSpeed()
      Description copied from interface: IBasicResource
      Gets the avg speed avgSpeed of which the default value is 22.0 m/s.
      Specified by:
      getAvgSpeed in interface IBasicResource
      Returns:
      the double average speed of the resource in m/s (applies if no time matrix is provided)
    • setCost

      public void setCost(double fixCost, double perHourCost, double perKilometerCost)
      Description copied from interface: IBasicResource
      Sets three cost factors of the resource.

      The default values are:

      fixCost: 0.0

      perHourCost: 1.0

      perKilometerCost: 1.0

      Specified by:
      setCost in interface IBasicResource
      Parameters:
      fixCost - the double for the fixCost
      perHourCost - the double cost per hour
      perKilometerCost - the double cost per kilometer
    • setFixCost

      public void setFixCost(double fixCost)
      Description copied from interface: IBasicResource
      Sets fixCost, the default value is 0.0.
      Specified by:
      setFixCost in interface IBasicResource
      Parameters:
      fixCost - the double fixCost
    • getFixCost

      public double getFixCost()
      Description copied from interface: IBasicResource
      Gets the fixCost, the default value is 0.0.
      Specified by:
      getFixCost in interface IBasicResource
      Returns:
      the double fixCost
    • setPerHourCost

      public void setPerHourCost(double perHourCost)
      Description copied from interface: IBasicResource
      Sets the perHourCost, the default value is 1.0.
      Specified by:
      setPerHourCost in interface IBasicResource
      Parameters:
      perHourCost - the double perHourCost
    • getPerHourCost

      public double getPerHourCost()
      Description copied from interface: IBasicResource
      Gets perHourCost, the default value is 1.0.
      Specified by:
      getPerHourCost in interface IBasicResource
      Returns:
      the double perHourCost
    • setPerHourProductionCost

      public void setPerHourProductionCost(double perHourProductionCost)
      Specified by:
      setPerHourProductionCost in interface IBasicResource
    • getPerHourProductionCost

      public double getPerHourProductionCost()
      Specified by:
      getPerHourProductionCost in interface IBasicResource
    • setPerKilometerCost

      public void setPerKilometerCost(double perKilometerCost)
      Description copied from interface: IBasicResource
      Sets the perKilometerCost, the default value is 1.0.
      Specified by:
      setPerKilometerCost in interface IBasicResource
      Parameters:
      perKilometerCost - the double perKilometerCost
    • getPerKilometerCost

      public double getPerKilometerCost()
      Description copied from interface: IBasicResource
      Gets perKilometerCost, the default value is 1.0.
      Specified by:
      getPerKilometerCost in interface IBasicResource
      Returns:
      the double perKilometerCost
    • hasRealGeoLocation

      public boolean hasRealGeoLocation()
      Description copied from interface: IOptimizationElement
      Returns true if the item has a real geo location. For example, an EventNode has no real geo location.
      Specified by:
      hasRealGeoLocation in interface IOptimizationElement
      Returns:
      true, if real geo location exists
    • isEmptyAtEndOfRoute

      public boolean isEmptyAtEndOfRoute()
      Description copied from interface: IBasicResource
      Checks emptyAtEndOfRoute.
      Specified by:
      isEmptyAtEndOfRoute in interface IBasicResource
      Returns:
      the boolean emptyAtEndOfRoute
    • addQualification

      public void addQualification(IQualification qualification)
      Description copied from interface: IBasicResource
      Puts the input in the HashMap qualifications, whereas the class is the key and the qualification is the value.

      A Qualification is a specific skill a Resource needs to have to give service to a Node that has a Constraint for that Qualification. Giving service to such a Node by a Resource without that Qualification will result in additional costs.

      Cannot be null.

      Specified by:
      addQualification in interface IBasicResource
      Parameters:
      qualification - the iQualification qualification
      See Also:
    • getQualifications

      public Map<Class<? extends IQualification>,IQualification> getQualifications()
      Description copied from interface: IBasicResource
      Gets qualifications, whereas the class is the key and the qualification is the value.

      A Qualification is a specific skill a Resource needs to have to give service to a Node that has a Constraint for that Qualification. Giving service to such a Node by a Resource without that Qualification will result in additional costs.

      * Cannot be null.

      Specified by:
      getQualifications in interface IBasicResource
      Returns:
      the hashmap qualifications
      See Also:
    • compareTo

      public int compareTo(IBasicResource o)
      Specified by:
      compareTo in interface Comparable<IBasicResource>
    • getSkillEfficiencyFactor

      @Deprecated public double getSkillEfficiencyFactor()
      Deprecated.
      Specified by:
      getSkillEfficiencyFactor in interface IBasicResource
      Returns:
      the double skill efficiency factor
    • setSkillEfficiencyFactor

      @Deprecated public void setSkillEfficiencyFactor(double skillEfficiencyFactor)
      Deprecated.
      Specified by:
      setSkillEfficiencyFactor in interface IBasicResource
      Parameters:
      skillEfficiencyFactor - the double for the resource's efficiency factor
    • toString

      public String toString()
      Overrides:
      toString in class AbstractOptimizationElement
    • 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
      Returns:
      the flavour
    • setAcceptableOvertimeSeconds

      @Deprecated public void setAcceptableOvertimeSeconds(double seconds)
      Deprecated.
      Description copied from interface: IBasicResource
      Deprecated method

      Sets the acceptable overtime in seconds. This does not necessarily mean that this is the maximal overtime. This is just an acceptable overtime that does not increase the total cost much. The default value is -1.

      Specified by:
      setAcceptableOvertimeSeconds in interface IBasicResource
      Parameters:
      seconds - the double for new acceptable overtime seconds
    • setAcceptableOvertime

      public void setAcceptableOvertime(Duration acceptableOvertime)
      Description copied from interface: IBasicResource
      Sets the acceptable overtime. When a Resource arrives in acceptable overtime a Violation will be thrown but the Node will not be filtered by a late Autofilter. Within acceptable overtime the costs are rising linearly, while outside of overtime they will rise exponentially.

      Arrival of the Resource within the acceptable overtime will not increase the total cost much.

      Specified by:
      setAcceptableOvertime in interface IBasicResource
      Parameters:
      acceptableOvertime - the Duration of acceptable overtime
    • resetAcceptableOvertime

      public void resetAcceptableOvertime()
      Description copied from interface: IBasicResource
      Resets the acceptableOvertimeSeconds to the default value of -1.0.
      Specified by:
      resetAcceptableOvertime in interface IBasicResource
    • getAcceptableOvertimeSeconds

      public double getAcceptableOvertimeSeconds()
      Description copied from interface: IBasicResource
      Gets the acceptable overtime in seconds. This is just an acceptable overtime that does not increase the total cost much. When a Resource arrives in acceptable overtime a Violation will be thrown but the Node will not be filtered by a late Autofilter. Within acceptable overtime the costs are rising linearly, while outside of overtime they will rise exponentially.
      Specified by:
      getAcceptableOvertimeSeconds in interface IBasicResource
      Returns:
      the double acceptableOvertimeSeconds
      See Also:
    • setStrictOvertimeLimit

      public void setStrictOvertimeLimit(Duration strictOvertimeLimit)
      Description copied from interface: IBasicResource
      Sets the strict overtime limit. This value does only have an effect if the AutoFilter with ForceFiltering is used.
      Specified by:
      setStrictOvertimeLimit in interface IBasicResource
      Parameters:
      strictOvertimeLimit - the new strict overtime limit
    • getStrictOvertimeLimitSeconds

      public double getStrictOvertimeLimitSeconds()
      Description copied from interface: IBasicResource
      Gets the strict overtime limit seconds.
      Specified by:
      getStrictOvertimeLimitSeconds in interface IBasicResource
      Returns:
      the strict overtime limit seconds
    • setAcceptableOverdistance

      public void setAcceptableOverdistance(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance)
      Specified by:
      setAcceptableOverdistance in interface IBasicResource
    • getAcceptableOverdistanceMeter

      public double getAcceptableOverdistanceMeter()
      Description copied from interface: IBasicResource
      Gets the acceptable overdistance meter.
      Specified by:
      getAcceptableOverdistanceMeter in interface IBasicResource
      Returns:
      the acceptable overdistance meter
    • setStrictOverdistanceLimit

      public void setStrictOverdistanceLimit(javax.measure.Quantity<javax.measure.quantity.Length> maxDistance)
      Description copied from interface: IBasicResource
      Sets the strict overdistance limit.
      Specified by:
      setStrictOverdistanceLimit in interface IBasicResource
      Parameters:
      maxDistance - the new strict overdistance limit
    • getStrictOverdistanceLimitMeter

      public double getStrictOverdistanceLimitMeter()
      Description copied from interface: IBasicResource
      Gets the strict overdistance limit meter.
      Specified by:
      getStrictOverdistanceLimitMeter in interface IBasicResource
      Returns:
      the strict overdistance limit meter
    • setFlexTime

      public boolean setFlexTime(Duration idleTimeReductionTime)
      Description copied from interface: IBasicResource
      Sets the flexTime in seconds. The default is 0.
      Specified by:
      setFlexTime in interface IBasicResource
      Parameters:
      idleTimeReductionTime - the duration of the flexTimeSeconds to be set
      Returns:
      true, if successful
    • getFlexTimeMillis

      public Optional<Long> getFlexTimeMillis()
      Specified by:
      getFlexTimeMillis in interface IBasicResource
    • getResourceId

      @Deprecated public String getResourceId()
      Deprecated.
      Returns:
      the resource id
      Category:
      Legacy

      Gets the resource id. Use getId() instead

    • setResourceId

      @Deprecated public void setResourceId(String id)
      Deprecated.
      Parameters:
      id - the new resource id
      Category:
      Legacy

      Sets the resource id. Use setId(String id) instead

    • setDestinationDistMatrixId

      @Deprecated public void setDestinationDistMatrixId(int distMatrixId)
      Deprecated.
      Parameters:
      distMatrixId - the new destination dist matrix id
      Category:
      Legacy

      Sets the destination dist matrix id.

    • getDestinationDistMatrixId

      @Deprecated public int getDestinationDistMatrixId()
      Deprecated.
      Description copied from interface: IBasicResource
      Deprecated method Gets the distMatrixId, the default value is -1.
      Specified by:
      getDestinationDistMatrixId in interface IBasicResource
      Returns:
      the destination dist matrix id
      Category:
      Legacy

      Gets the destination dist matrix id.

    • setWorkingHours

      @Deprecated public void setWorkingHours(WorkingHours[] workingHours)
      Deprecated.
      Parameters:
      workingHours - the new working hours
      Category:
      Legacy

      Sets the working hours.