edu.udo.cs.ie.cowbots.util.cluster
Class ClusterCalculator

Package class diagram package ClusterCalculator
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.util.cluster.ClusterCalculator
All Implemented Interfaces:
IClusterCalculator

public class ClusterCalculator
extends java.lang.Object
implements IClusterCalculator

Utility class for calculating cow clusters identified by one intelligent selected cow for driving.


Field Summary
private  int clusterDistance
           
private  java.util.HashMap<java.lang.String,java.awt.Point> cowPositions
           
private  java.util.HashMap<java.lang.String,java.lang.Integer> cowToCluster
           
(package private) static int defaultCulsterDistance
           
private  astar pathfinder
           
 
Constructor Summary
ClusterCalculator()
           
 
Method Summary
 java.util.List<CowCluster> getCowClusters(GridMap map, DistanceMap dm, int cDist, int maxCowTime)
          this method returns a set of clusters of cows derived from the current world view of an agent.
protected  int getCowWithClusterInNeighbourhood(int x, int y, GridMap map)
          Uses a* to find a way to another cow wich is already assigned to a cluster.
 java.util.HashMap<java.lang.Integer,java.util.List<java.lang.String>> newClusterMethod(GridMap map, int worldtime)
          a very simple cluster method. for every cow, it creates a new cluster or puts the cow in the first cluster while keeping a maximal cluster width (or height).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultCulsterDistance

static final int defaultCulsterDistance
See Also:
Constant Field Values

clusterDistance

private int clusterDistance

pathfinder

private astar pathfinder

cowToCluster

private java.util.HashMap<java.lang.String,java.lang.Integer> cowToCluster

cowPositions

private java.util.HashMap<java.lang.String,java.awt.Point> cowPositions
Constructor Detail

ClusterCalculator

public ClusterCalculator()
Method Detail

getCowClusters

public java.util.List<CowCluster> getCowClusters(GridMap map,
                                                 DistanceMap dm,
                                                 int cDist,
                                                 int maxCowTime)
Description copied from interface: IClusterCalculator
this method returns a set of clusters of cows derived from the current world view of an agent.

Specified by:
getCowClusters in interface IClusterCalculator
Parameters:
map - GridMap representing an agents view of the world
dm - DistanceMap for fast cow2corral lookup
cDist - maximum allowed cluster elongation
maxCowTime - maximum age of cows to respect during clustering
Returns:
list of cow cluster

getCowWithClusterInNeighbourhood

protected int getCowWithClusterInNeighbourhood(int x,
                                               int y,
                                               GridMap map)
Uses a* to find a way to another cow wich is already assigned to a cluster. Treats agents and their surrounding as obstacles, so they can split clusters.

Parameters:
x -
y -
map -
Returns:

newClusterMethod

public java.util.HashMap<java.lang.Integer,java.util.List<java.lang.String>> newClusterMethod(GridMap map,
                                                                                              int worldtime)
a very simple cluster method. for every cow, it creates a new cluster or puts the cow in the first cluster while keeping a maximal cluster width (or height).

Parameters:
map -
worldtime -
Returns: