edu.udo.cs.ie.cowbots.util.cluster
Class ClusterCalculator
java.lang.Object
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.
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 |
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
ClusterCalculator
public ClusterCalculator()
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 worlddm
- DistanceMap for fast cow2corral lookupcDist
- maximum allowed cluster elongationmaxCowTime
- 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: