mil.af.afit.uvr
Class HTour

java.lang.Object
  |
  +--mil.af.afit.uvr.HTour
All Implemented Interfaces:
java.lang.Cloneable

public final class HTour
extends java.lang.Object
implements java.lang.Cloneable

A tour contains a vehicle and a list of customers to visit. If it is changed, the associated HSolution object should be invalidateed.

Since:
1.0
See Also:
HOrder, HVehicle, HSolution

Field Summary
protected  HList route
           
 
Constructor Summary
HTour(HTour copyThis)
          Constructs a copy of the tour based on the passed tour.
HTour(HVehicle vehicle)
          Constructs a tour based on the given vehicle
HTour(HVehicle vehicle, HOrder[] orders)
          Constructs a tour based on the given vehicle and places the orders in the tour in the same order as in the array.
 
Method Summary
 void addHOrder(HOrder order)
          Adds the order to the end of the tour.
 java.lang.Object clone()
           
 HOrder firstHOrder()
          Returns the first order in the tour.
 int getBustedTimeWalls()
          Returns the number of busted time walls for the tour.
 int getBustedTimeWindows()
          Returns the number of busted time windows for the tour.
 double getDepartureTime()
          Returns the departure time for the tour.
 double getEstimatedArrivalTime(int i)
          Return the estimated arrival time at the order in position i.
 double getEstimatedDepartureTime(int i)
          Return the estimated departure time at the order in position i.
 double getEstimatedWaitTime(int i)
          Return the estimated wait time at the order in position i.
 HOrder getHOrderAt(int position)
          Returns the order at the positionth position.
 HVehicle getHVehicle()
          Returns the vehicle associated with the tour.
 double getReturnTime()
          Returns the estimated return time for the tour.
 double getTotalPenalty()
          Returns the penalty for the tour.
 double getTotalTravelTime()
          Returns the total travel time for the tour.
 double getTotalWaitingTime()
          Returns the waiting time for the tour.
 void insertHOrderAt(HOrder order, int position)
          Inserts the given order into position.
 void invalidate()
          Indicates that the tour costs are no longer valid.
 boolean isValid()
          Whether or not the costs and such associated with the tour are valid with respect to the latest changes.
 void removeHOrderAt(int position)
          Removes the given order from position.
 boolean serviced(int i)
          Returns true if the order has been serviced.
 int size()
          Number of orders in the tour.
 java.lang.String toString()
           
 void validateTour()
          Validate the tour.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

route

protected HList route
Constructor Detail

HTour

public HTour(HVehicle vehicle)
Constructs a tour based on the given vehicle
Parameters:
vehicle - the vehicle to associate with the tour
Since:
1.0
See Also:
HVehicle

HTour

public HTour(HVehicle vehicle,
             HOrder[] orders)
Constructs a tour based on the given vehicle and places the orders in the tour in the same order as in the array.
Parameters:
vehicle - vehicle for the tour
orders - orders to put in the array
Since:
1.0
See Also:
HVehicle, HOrder

HTour

public HTour(HTour copyThis)
Constructs a copy of the tour based on the passed tour.
Parameters:
copyThis - tour to copy
Since:
1.0
Method Detail

getHVehicle

public HVehicle getHVehicle()
Returns the vehicle associated with the tour.
Returns:
the vehicle associated with the tour.
Since:
1.0
See Also:
HVehicle

getTotalTravelTime

public final double getTotalTravelTime()
Returns the total travel time for the tour. Be sure to check isValid() to see if the value is meaningful.
Returns:
travel time
Since:
1.0

getTotalWaitingTime

public final double getTotalWaitingTime()
Returns the waiting time for the tour. Be sure to check isValid() to see if the value is meaningful.
Returns:
wait time
Since:
1.0

getTotalPenalty

public final double getTotalPenalty()
Returns the penalty for the tour. Be sure to check isValid() to see if the value is meaningful. The penalty should be in the same units as time.
Returns:
penalty
Since:
1.0

getBustedTimeWindows

public final int getBustedTimeWindows()
Returns the number of busted time windows for the tour. Be sure to check isValid() to see if the value is meaningful.
Returns:
number of time windows
Since:
1.0

getBustedTimeWalls

public final int getBustedTimeWalls()
Returns the number of busted time walls for the tour. Be sure to check isValid() to see if the value is meaningful.
Returns:
number of time walls
Since:
1.0

getDepartureTime

public final double getDepartureTime()
Returns the departure time for the tour. Be sure to check isValid() to see if the value is meaningful.
Returns:
departure time
Since:
1.0

getReturnTime

public final double getReturnTime()
Returns the estimated return time for the tour. Be sure to check isValid() to see if the value is meaningful.
Returns:
estimated return time
Since:
1.0

getHOrderAt

public final HOrder getHOrderAt(int position)
Returns the order at the positionth position. The index starts at zero.
Parameters:
position - position of order to return
Returns:
order at position
Since:
1.0
See Also:
HOrder

firstHOrder

public final HOrder firstHOrder()
Returns the first order in the tour.
Parameters:
position - position of order to return
Returns:
first order
Since:
1.0
See Also:
HOrder

getEstimatedArrivalTime

public final double getEstimatedArrivalTime(int i)
Return the estimated arrival time at the order in position i. This may be before the time window.
Parameters:
i - position of order in question
Returns:
estimated arrival time
Since:
1.0
See Also:
HOrder

getEstimatedDepartureTime

public final double getEstimatedDepartureTime(int i)
Return the estimated departure time at the order in position i.
Parameters:
i - position of order in question
Returns:
estimated departure time
Since:
1.0
See Also:
HOrder

getEstimatedWaitTime

public final double getEstimatedWaitTime(int i)
Return the estimated wait time at the order in position i.
Parameters:
i - position of order in question
Returns:
estimated wait time
Since:
1.0
See Also:
HOrder

serviced

public final boolean serviced(int i)
Returns true if the order has been serviced. An order should not be in the tour if it's not being serviced, but it could be.
Parameters:
i - position of order in question
Returns:
whether or not order is serviced
Since:
1.0
See Also:
HOrder

validateTour

public final void validateTour()
Validate the tour. This tracks travel time, wait time, penalties, etc based on the vehicle and orders.
Since:
1.0
See Also:
HOrder, HVehicle

size

public int size()
Number of orders in the tour.
Returns:
number of orders in the tour
Since:
1.0
See Also:
HOrder

isValid

public final boolean isValid()
Whether or not the costs and such associated with the tour are valid with respect to the latest changes.
Returns:
whether or not the costs, etc are valid
Since:
1.0

insertHOrderAt

public void insertHOrderAt(HOrder order,
                           int position)
Inserts the given order into position. If position = size() the order is appended to the end of the tour. The tour costs are then invalidated.
Parameters:
order - order to insert
position - where to put the order
Since:
1.0
See Also:
HOrder

removeHOrderAt

public void removeHOrderAt(int position)
Removes the given order from position. The tour costs are then invalidated.
Parameters:
order - order to remove
position - where the order is coming from
Since:
1.0
See Also:
HOrder

addHOrder

public void addHOrder(HOrder order)
Adds the order to the end of the tour. The tour costs are then invalidated.
Parameters:
order - order to add
Since:
1.0
See Also:
HOrder

invalidate

public final void invalidate()
Indicates that the tour costs are no longer valid.
Since:
1.0

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object