logist.task
Class Task

java.lang.Object
  extended by logist.task.Task

public final class Task
extends java.lang.Object

A task represents the unit of work in the pick up and delivery problem.

Tasks are created in batches at the beginning of each round according to a TaskDistribution.

Author:
Robin Steiger

Field Summary
 Topology.City deliveryCity
          The delivery location
 int id
          A unique id of the task in the current round, in the range [0,numTasks).
 Topology.City pickupCity
          The pickup location
 long reward
          The reward for this task
 int weight
          The weight of this task
 
Constructor Summary
Task(int id, Topology.City source, Topology.City destination, long reward, int weight)
          For system use only.
 
Method Summary
 java.util.List<Topology.City> path()
          The cities on the shortest path from the source of this task (excluding) to the destination (including).
 double pathLength()
          The length of the shortest path from the source of this task to the destination.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public final int id
A unique id of the task in the current round, in the range [0,numTasks).


pickupCity

public final Topology.City pickupCity
The pickup location


deliveryCity

public final Topology.City deliveryCity
The delivery location


reward

public final long reward
The reward for this task


weight

public final int weight
The weight of this task

Constructor Detail

Task

public Task(int id,
            Topology.City source,
            Topology.City destination,
            long reward,
            int weight)
For system use only. Creates a new task.

Method Detail

toString

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

path

public java.util.List<Topology.City> path()
The cities on the shortest path from the source of this task (excluding) to the destination (including).

Returns:
The cities on the shortest path to deliver this task.

pathLength

public double pathLength()
The length of the shortest path from the source of this task to the destination.