auc.algo
Class BruteForce

java.lang.Object
  |
  +--auc.algo.BruteForce
All Implemented Interfaces:
RouteAlgorithm

public class BruteForce
extends java.lang.Object
implements RouteAlgorithm

The brute-force approach algorithm for the route planning.


Field Summary
protected  double bestlength
           
protected  Route bestroute
           
protected  double[][] costs
           
protected  int count
           
protected  CostEvaluator evaluator
          Default CostEvaluator is a DistanceEvaluator.
protected  double length
           
protected  Vector2D[] points
           
protected  java.util.Stack travelled
           
protected  boolean[] visited
           
 
Constructor Summary
BruteForce()
           
 
Method Summary
 Route planRoute(Job job)
          Searches for the optimal route and orders the points array to be in the optimal order.
 void setCostEvaluator(CostEvaluator ce)
          Sets the cost evaluator object to evaluate the basic route cost travelling between two points.
protected  void shortest(int current)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

evaluator

protected CostEvaluator evaluator
Default CostEvaluator is a DistanceEvaluator.

count

protected int count

costs

protected double[][] costs

visited

protected boolean[] visited

travelled

protected java.util.Stack travelled

length

protected double length

bestlength

protected double bestlength

bestroute

protected Route bestroute

points

protected Vector2D[] points
Constructor Detail

BruteForce

public BruteForce()
Method Detail

planRoute

public Route planRoute(Job job)
Searches for the optimal route and orders the points array to be in the optimal order. The 0-th element in the array is assumed to be starting point. No assumptions are made for ending point.
Specified by:
planRoute in interface RouteAlgorithm
Parameters:
field - The field structure.
points - The array of points to be visited.
Returns:
The optimal route through all of the points.

shortest

protected void shortest(int current)

setCostEvaluator

public void setCostEvaluator(CostEvaluator ce)
Sets the cost evaluator object to evaluate the basic route cost travelling between two points.
Specified by:
setCostEvaluator in interface RouteAlgorithm
Parameters:
ce - The cost evaluator. If not set the distance is assumed to be the cost.