JOpt.SDK.Implementation
Class CapacityResource

java.lang.Object
  extended byJOpt.SDK.Implementation.CapacityResource
All Implemented Interfaces:
ICapacityResource, IDistanceMatrixEntry, IGeoResource, IJOptSDK, IResource

public class CapacityResource
extends java.lang.Object
implements ICapacityResource, IJOptSDK


Constructor Summary
CapacityResource()
           
CapacityResource(java.lang.String resourceId, double latitude, double longitude, double maxHours, double maxDistance, double BOS_MONDAY, double EOS_MONDAY, double BOS_TUESDAY, double EOS_TUESDAY, double BOS_WEDNESDAY, double EOS_WEDNESDAY, double BOS_THURSDAY, double EOS_THURSDAY, double BOS_FRIDAY, double EOS_FRIDAY, double BOS_SATURDAY, double EOS_SATURDAY, double BOS_SUNDAY, double EOS_SUNDAY)
          Deprecated.  
CapacityResource(java.lang.String resourceId, double latitude, double longitude, double maxHours, double maxDistance, double BOS_MONDAY, double EOS_MONDAY, double BOS_TUESDAY, double EOS_TUESDAY, double BOS_WEDNESDAY, double EOS_WEDNESDAY, double BOS_THURSDAY, double EOS_THURSDAY, double BOS_FRIDAY, double EOS_FRIDAY, double BOS_SATURDAY, double EOS_SATURDAY, double BOS_SUNDAY, double EOS_SUNDAY, java.lang.String[] nodeTypes, double[] capacity, double avgSpeed, int distanceMatrixId)
          Deprecated.  
CapacityResource(java.lang.String resourceId, double latitude, double longitude, double maxHours, double maxDistance, IWorkingHours[] workingHours)
           
CapacityResource(java.lang.String resourceId, double latitude, double longitude, double maxHours, double maxDistance, java.lang.String[] nodeTypes, double[] capacity, double avgSpeed, int distanceMatrixId)
          Deprecated.  
 
Method Summary
 void addCapacity(double capacity)
           
 void addPermittedNodeType(java.lang.String nodeType)
           
 double calculateDailyBreakAZO(double increment, long serviceTime)
           
 long calculateTimeBreak3(long curWorkingHoursEnd)
           
 double calculateWeeklyBreakAZO(double increment, long serviceTime)
           
 double calulateAZO(long traveltime, long curServiceTime)
           
 boolean checkNodeTypePermission(java.lang.String nodeType)
          check if the current resource is allowed visit a given nodeType
 double getAvgSpecificCarbonDioxideEmission()
           
 double getAvgSpecificFuelConsumption(double currentLoad)
           
 double getAvgSpeed()
           
 double[] getCapacity()
           
 double getCarbonDioxideEmissionFactor()
           
 IWorkingHours getCurrentWorkingHours()
           
 long getCurResTime()
           
 IDailyBreak getDailyBreak()
           
 java.util.HashMap getDailyWorkingHours()
          INTERNAL USE ONLY
 int getDestinationDistMatrixId()
           
 double getDestinationLatitude()
           
 double getDestinationLongitude()
           
 Matrix[] getDistanceMatrices()
           
 int getDistMatrixId()
           
 double getFixCost()
           
 int getFuelType()
           
 IMoveCost getIMoveCost()
           
 double[] getInitialLoad()
           
 ITravelDistance getITravelDistance()
           
 ITravelTimeByDistance getITravelTimeByDistance()
           
 double getLatitude()
           
 double[] getLoadBasedAvgSpecificFuelConsumption()
           
 double getLongitude()
           
 double getMaxDailyHours()
           
 double getMaxDistance()
           
 double getMaxHours()
           
 double getMaxWeeklyHours()
           
 double getPerHourCost()
           
 double getPerKilometerCost()
           
 java.lang.String[] getPermittedNodeTypes()
           
 java.lang.String getResourceId()
           
 java.util.HashMap getServiceTimePointer()
           
 double getTimeBreak()
           
 Matrix[] getTimeMatrices()
           
 double getTimeMatrixFactor()
           
 IWorkingHours getWorkingHours(int i)
           
 void incCurResTime(long increment)
           
 void incrementDailyAZO(double increment)
           
 void incrementWeeklyAZO(double increment)
           
 void IncWorkingHours()
           
 void incWorkingHoursToNextNearest()
           
 boolean isActive()
           
 boolean isAlternateDestination()
           
 boolean isEmptyAtEndOfRoute()
           
 double matrixLookup(int id, long curTime)
           
 void resetBOS()
           
 void resetDailyAZO()
           
 void resetWeeklyAZO()
           
 void setActive(boolean active)
           
 void setAlternateDestination(boolean alternateDestination)
           
 void setAvgSpecificFuelConsumption(double avgFuelConsumptionPer100km)
           
 void setAvgSpeed(double avgSpeed)
           
 void setCost(double fixCost, double perHourCost, double perKilometerCost)
          Define specific cost for each vehicle.
 void setCurResTime(long curResTime)
           
 void setDailyBreak(IDailyBreak dailyBreak)
          Add a daily break to this resource.
 void setDailyWorkingHours(java.util.HashMap dailyWorkingHours)
          INTERNAL USE ONLY
 void setDestinationDistMatrixId(int entryId)
           
 void setDestinationLatitude(double destinationLatitude)
           
 void setDestinationLongitude(double destinationLongitude)
           
 void setDistanceMatrices(Matrix[] distanceMatrices)
           
 void setDistMatrixId(int distanceMatrixId)
           
 void setEmptyAtEndOfRoute(boolean emptyAtEndOfRoute)
           
 void setFixCost(double fixCost)
           
 void setFuelType(int fuelType)
           
 void setIMoveCost(IMoveCost iMoveCost)
           
 void setInitialLoad(double[] initialLoad)
           
 void setITravelDistance(ITravelDistance iTravelDistance)
           
 void setITravelTimeByDistance(ITravelTimeByDistance iTravelTimeByDistance)
           
 void setLatitude(double latitude)
           
 void setLoadBasedAvgSpecificFuelConsumption(double[] avgLoadBasedFuelConsumptionTable)
           
 void setLongitude(double longitude)
           
 void setMaxDailyHours(double maxDailyHours)
           
 void setMaxDistance(double maxDistance)
           
 void setMaxHours(double maxHours)
           
 void setMaxWeeklyHours(double maxWeeklyHours)
           
 void setPerHourCost(double perHourCost)
           
 void setPerKilometerCost(double perKilometerCost)
           
 void setResourceId(java.lang.String resourceId)
           
 void setServiceTimePointer(java.util.HashMap serviceTimePointer)
          INTERNAL USE ONLY
 void setTimeBreak(double timeBreak)
           
 void setTimeMatrices(Matrix[] timeMatrices)
           
 void setTimeMatrixFactor(double timeFactor)
           
 void setWorkingHours(IWorkingHours[] workingHours)
           
 void sleepUntilNextWorkBegin()
           
 double timeMatrixLookup(int id, long curTime)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CapacityResource

public CapacityResource(java.lang.String resourceId,
                        double latitude,
                        double longitude,
                        double maxHours,
                        double maxDistance,
                        IWorkingHours[] workingHours)

CapacityResource

public CapacityResource()

CapacityResource

public CapacityResource(java.lang.String resourceId,
                        double latitude,
                        double longitude,
                        double maxHours,
                        double maxDistance,
                        double BOS_MONDAY,
                        double EOS_MONDAY,
                        double BOS_TUESDAY,
                        double EOS_TUESDAY,
                        double BOS_WEDNESDAY,
                        double EOS_WEDNESDAY,
                        double BOS_THURSDAY,
                        double EOS_THURSDAY,
                        double BOS_FRIDAY,
                        double EOS_FRIDAY,
                        double BOS_SATURDAY,
                        double EOS_SATURDAY,
                        double BOS_SUNDAY,
                        double EOS_SUNDAY)
Deprecated.  


CapacityResource

public CapacityResource(java.lang.String resourceId,
                        double latitude,
                        double longitude,
                        double maxHours,
                        double maxDistance,
                        double BOS_MONDAY,
                        double EOS_MONDAY,
                        double BOS_TUESDAY,
                        double EOS_TUESDAY,
                        double BOS_WEDNESDAY,
                        double EOS_WEDNESDAY,
                        double BOS_THURSDAY,
                        double EOS_THURSDAY,
                        double BOS_FRIDAY,
                        double EOS_FRIDAY,
                        double BOS_SATURDAY,
                        double EOS_SATURDAY,
                        double BOS_SUNDAY,
                        double EOS_SUNDAY,
                        java.lang.String[] nodeTypes,
                        double[] capacity,
                        double avgSpeed,
                        int distanceMatrixId)
Deprecated.  


CapacityResource

public CapacityResource(java.lang.String resourceId,
                        double latitude,
                        double longitude,
                        double maxHours,
                        double maxDistance,
                        java.lang.String[] nodeTypes,
                        double[] capacity,
                        double avgSpeed,
                        int distanceMatrixId)
Deprecated.  

Method Detail

setResourceId

public void setResourceId(java.lang.String resourceId)
Specified by:
setResourceId in interface IResource
Parameters:
resourceId - set the resource's unique Id

getResourceId

public java.lang.String getResourceId()
Specified by:
getResourceId in interface IResource
Returns:
get the resource's unique Id

setLatitude

public void setLatitude(double latitude)
Specified by:
setLatitude in interface IGeoResource
Parameters:
latitude - set the geografical latitude of the resources starting point for linear distance estimation if not using a distance matrix

getLatitude

public double getLatitude()
Specified by:
getLatitude in interface IGeoResource
Returns:

setLongitude

public void setLongitude(double longitude)
Specified by:
setLongitude in interface IGeoResource
Parameters:
longitude - set the geografical longitude of the resources starting point for linear distance estimation if not using a distance matrix

getLongitude

public double getLongitude()
Specified by:
getLongitude in interface IGeoResource
Returns:

setMaxHours

public void setMaxHours(double maxHours)
Specified by:
setMaxHours in interface IResource
Parameters:
maxHours - the maximum hours [h] a route can take

getMaxHours

public double getMaxHours()
Specified by:
getMaxHours in interface IResource
Returns:
the maximum hours [h] a route can take

setMaxDistance

public void setMaxDistance(double maxDistance)
Specified by:
setMaxDistance in interface IResource
Parameters:
maxDistance - the maximum distance [km] a route can take

getMaxDistance

public double getMaxDistance()
Specified by:
getMaxDistance in interface IResource
Returns:
the maximum distance [km] a route can take

addCapacity

public void addCapacity(double capacity)
Specified by:
addCapacity in interface ICapacityResource
Parameters:
capacity - set up an arbitrary capacity vector for this resource to be matched with the corresponding load vector of a visited node by adding an arbitrary set of capacities

getCapacity

public double[] getCapacity()
Specified by:
getCapacity in interface ICapacityResource
Returns:
capacity vector

addPermittedNodeType

public void addPermittedNodeType(java.lang.String nodeType)
Specified by:
addPermittedNodeType in interface IResource
Parameters:
nodeType - (optional) one of a list of nodeTypes the resource is allowed to visit.

getPermittedNodeTypes

public java.lang.String[] getPermittedNodeTypes()
Specified by:
getPermittedNodeTypes in interface IResource

checkNodeTypePermission

public boolean checkNodeTypePermission(java.lang.String nodeType)
Description copied from interface: IResource
check if the current resource is allowed visit a given nodeType

Specified by:
checkNodeTypePermission in interface IResource
Parameters:
nodeType -
Returns:
boolean indicating whether the current resource is allowed visit a given nodeType

setDistMatrixId

public void setDistMatrixId(int distanceMatrixId)
Specified by:
setDistMatrixId in interface IDistanceMatrixEntry
See Also:
IOptimization#addDistanceMatrix()

getDistMatrixId

public int getDistMatrixId()
Specified by:
getDistMatrixId in interface IDistanceMatrixEntry
Returns:
get the entriy's unique distance matrix Id

setAvgSpeed

public void setAvgSpeed(double avgSpeed)
Specified by:
setAvgSpeed in interface IResource
Parameters:
avgSpeed - the average speed of the resource in m/s (applies if no time matrix is provided)

getAvgSpeed

public double getAvgSpeed()
Specified by:
getAvgSpeed in interface IResource
Returns:
the average speed of the resource in m/s (applies if no time matrix is provided)

resetBOS

public void resetBOS()

IncWorkingHours

public void IncWorkingHours()

getCurrentWorkingHours

public IWorkingHours getCurrentWorkingHours()

incWorkingHoursToNextNearest

public void incWorkingHoursToNextNearest()

calculateTimeBreak3

public long calculateTimeBreak3(long curWorkingHoursEnd)

sleepUntilNextWorkBegin

public void sleepUntilNextWorkBegin()

setWorkingHours

public void setWorkingHours(IWorkingHours[] workingHours)
Specified by:
setWorkingHours in interface IResource

getWorkingHours

public IWorkingHours getWorkingHours(int i)

setCost

public void setCost(double fixCost,
                    double perHourCost,
                    double perKilometerCost)
Description copied from interface: IResource
Define specific cost for each vehicle. As JOpt is a least cost router it will always try to prefer the most cost effective vehicles before others.

Specified by:
setCost in interface IResource
Parameters:
fixCost -
perHourCost -
perKilometerCost -

setFixCost

public void setFixCost(double fixCost)

getFixCost

public double getFixCost()

setPerHourCost

public void setPerHourCost(double perHourCost)

getPerHourCost

public double getPerHourCost()

setPerKilometerCost

public void setPerKilometerCost(double perKilometerCost)

getPerKilometerCost

public double getPerKilometerCost()

setMaxDailyHours

public void setMaxDailyHours(double maxDailyHours)
Specified by:
setMaxDailyHours in interface IResource
Parameters:
maxDailyHours - applies only in WEEKLY mode and defines when the resource will have to make a break until the next business day

getMaxDailyHours

public double getMaxDailyHours()
Specified by:
getMaxDailyHours in interface IResource

setMaxWeeklyHours

public void setMaxWeeklyHours(double maxWeeklyHours)
Specified by:
setMaxWeeklyHours in interface IResource
Parameters:
maxWeeklyHours - applies only in WEEKLY mode and defines when the resource will have to make a break until the next business week

getMaxWeeklyHours

public double getMaxWeeklyHours()
Specified by:
getMaxWeeklyHours in interface IResource
Returns:
maxWeeklyHours applies only in WEEKLY mode and defines when the resource will have to make a break until the next business week

setTimeBreak

public void setTimeBreak(double timeBreak)

getTimeBreak

public double getTimeBreak()

setDailyWorkingHours

public void setDailyWorkingHours(java.util.HashMap dailyWorkingHours)
Description copied from interface: IResource
INTERNAL USE ONLY

Specified by:
setDailyWorkingHours in interface IResource

getDailyWorkingHours

public java.util.HashMap getDailyWorkingHours()
Description copied from interface: IResource
INTERNAL USE ONLY

Specified by:
getDailyWorkingHours in interface IResource

calculateDailyBreakAZO

public double calculateDailyBreakAZO(double increment,
                                     long serviceTime)

calculateWeeklyBreakAZO

public double calculateWeeklyBreakAZO(double increment,
                                      long serviceTime)

calulateAZO

public double calulateAZO(long traveltime,
                          long curServiceTime)

incrementDailyAZO

public void incrementDailyAZO(double increment)

incrementWeeklyAZO

public void incrementWeeklyAZO(double increment)

resetDailyAZO

public void resetDailyAZO()

resetWeeklyAZO

public void resetWeeklyAZO()

setCurResTime

public void setCurResTime(long curResTime)

matrixLookup

public double matrixLookup(int id,
                           long curTime)

timeMatrixLookup

public double timeMatrixLookup(int id,
                               long curTime)

getCurResTime

public long getCurResTime()

incCurResTime

public void incCurResTime(long increment)

setDistanceMatrices

public void setDistanceMatrices(Matrix[] distanceMatrices)

getDistanceMatrices

public Matrix[] getDistanceMatrices()

setTimeMatrices

public void setTimeMatrices(Matrix[] timeMatrices)

getTimeMatrices

public Matrix[] getTimeMatrices()

setInitialLoad

public void setInitialLoad(double[] initialLoad)
Specified by:
setInitialLoad in interface ICapacityResource
Parameters:
initialLoad - set up an initial load (eg. load at the depot)

getInitialLoad

public double[] getInitialLoad()
Specified by:
getInitialLoad in interface ICapacityResource
Returns:
initialLoad (eg. load at the depot)

setTimeMatrixFactor

public void setTimeMatrixFactor(double timeFactor)
Specified by:
setTimeMatrixFactor in interface IResource
Parameters:
timeFactor - to affect the average driving times given in the timeMatrix. If not set the time factor is set to 1.0 by default. remark: Is in effect only in case a timeMatrix has been defined.

getTimeMatrixFactor

public double getTimeMatrixFactor()
Specified by:
getTimeMatrixFactor in interface IResource
Returns:
timeFactor that affects the average driving times given in the timeMatrix. If not set the time factor is set to 1.0 by default. remark: Is in effect only in case a timeMatrix has been defined.

setFuelType

public void setFuelType(int fuelType)
Specified by:
setFuelType in interface ICapacityResource
Parameters:
fuelType - 1 = petrol, 2 = diesel

getFuelType

public int getFuelType()
Specified by:
getFuelType in interface ICapacityResource
Returns:
fuelType 1 = petrol, 2 = diesel

setAvgSpecificFuelConsumption

public void setAvgSpecificFuelConsumption(double avgFuelConsumptionPer100km)
Specified by:
setAvgSpecificFuelConsumption in interface ICapacityResource

setLoadBasedAvgSpecificFuelConsumption

public void setLoadBasedAvgSpecificFuelConsumption(double[] avgLoadBasedFuelConsumptionTable)
Specified by:
setLoadBasedAvgSpecificFuelConsumption in interface ICapacityResource

getLoadBasedAvgSpecificFuelConsumption

public double[] getLoadBasedAvgSpecificFuelConsumption()

getAvgSpecificFuelConsumption

public double getAvgSpecificFuelConsumption(double currentLoad)
Specified by:
getAvgSpecificFuelConsumption in interface ICapacityResource
Returns:
the average fuel consumption in litre/100 km

getAvgSpecificCarbonDioxideEmission

public double getAvgSpecificCarbonDioxideEmission()
Specified by:
getAvgSpecificCarbonDioxideEmission in interface ICapacityResource

getCarbonDioxideEmissionFactor

public double getCarbonDioxideEmissionFactor()

setServiceTimePointer

public void setServiceTimePointer(java.util.HashMap serviceTimePointer)
Description copied from interface: IResource
INTERNAL USE ONLY

Specified by:
setServiceTimePointer in interface IResource

getServiceTimePointer

public java.util.HashMap getServiceTimePointer()

setActive

public void setActive(boolean active)

isActive

public boolean isActive()

setDailyBreak

public void setDailyBreak(IDailyBreak dailyBreak)
Add a daily break to this resource. Daily breaks define a timespan in which the resource will be allowed to make a break and a break time for this resource

Specified by:
setDailyBreak in interface IResource
Parameters:
dailyBreak -

getDailyBreak

public IDailyBreak getDailyBreak()
Specified by:
getDailyBreak in interface IResource
Returns:
the daily break object

setEmptyAtEndOfRoute

public void setEmptyAtEndOfRoute(boolean emptyAtEndOfRoute)

isEmptyAtEndOfRoute

public boolean isEmptyAtEndOfRoute()

setIMoveCost

public void setIMoveCost(IMoveCost iMoveCost)

getIMoveCost

public IMoveCost getIMoveCost()

setITravelDistance

public void setITravelDistance(ITravelDistance iTravelDistance)

getITravelDistance

public ITravelDistance getITravelDistance()

setITravelTimeByDistance

public void setITravelTimeByDistance(ITravelTimeByDistance iTravelTimeByDistance)

getITravelTimeByDistance

public ITravelTimeByDistance getITravelTimeByDistance()

setDestinationLatitude

public void setDestinationLatitude(double destinationLatitude)

getDestinationLatitude

public double getDestinationLatitude()

setDestinationLongitude

public void setDestinationLongitude(double destinationLongitude)

getDestinationLongitude

public double getDestinationLongitude()

setDestinationDistMatrixId

public void setDestinationDistMatrixId(int entryId)
Specified by:
setDestinationDistMatrixId in interface IGeoResource
See Also:
IOptimization#addDistanceMatrix()

getDestinationDistMatrixId

public int getDestinationDistMatrixId()
Specified by:
getDestinationDistMatrixId in interface IGeoResource
Returns:
get the entriy's unique distance matrix Id

setAlternateDestination

public void setAlternateDestination(boolean alternateDestination)

isAlternateDestination

public boolean isAlternateDestination()