messif.pivotselection
Class CoveragePivotChooser

java.lang.Object
  extended by messif.pivotselection.AbstractPivotChooser
      extended by messif.pivotselection.CoveragePivotChooser
All Implemented Interfaces:
java.io.Serializable, BucketFilter, BucketFilterAfterAdd, BucketFilterAfterRemove

public class CoveragePivotChooser
extends AbstractPivotChooser
implements java.io.Serializable, BucketFilterAfterAdd, BucketFilterAfterRemove

This pivot chooser selects the pivots in a way that a good coverage of data by ball regions with centers in pivots and radius equal to a fixed value (threshold) is ensured. The fixed valus, so-called threshold on radius, is passed to the constructor of this class. The coverage is done by putting the balls over the data in a way that the balls do not intersect. This implies that some objects might not have been covered by a ball. The procedure starts by defining a ball for each object. The first output ball is the most populated ball (the ball containing the highest number of objects). Next, all balls that intersect are eliminated. The second output ball is the most populated ball again. This procedure is repeated until there are some non-eliminated balls. Because we eliminated all balls that intersect, so the population of a ball (number of objects in the ball) is computed as with the radius equal to double value of the threshold. This implies that the most populated ball leads to elimination of the most other balls. CAVEAT: This pivot chooser ignores the parameter count passed in all selectPivot(int, messif.objects.util.AbstractObjectIterator) methods.

See Also:
Serialized Form

Nested Class Summary
protected  class CoveragePivotChooser.Ball
          Class encapsulating info about each cluster (ball region).
protected  class CoveragePivotChooser.PrecomputedDistances
          A cache for distances between a pair of objects
 
Field Summary
protected  float clusterDiameter
          Ball size multiplied by two
protected  float clusterRadius
          Ball size -- radius of the cluster.
static int SAMPLE_SET_SIZE
          Size of the data sample used to create clusters.
 
Fields inherited from class messif.pivotselection.AbstractPivotChooser
counterBucketReadBuckets, counterObjectDistComp, counterPivotDistComp, counterPivotReadBuckets, preselectedPivots, sampleProviders
 
Constructor Summary
CoveragePivotChooser(float radius)
          Creates a new instance of CoveragePivotChooser.
 
Method Summary
 void filterAfterAdd(LocalAbstractObject object, LocalBucket bucket)
          Filter object after its insertion into a bucket.
 void filterAfterRemove(LocalAbstractObject object, LocalBucket bucket)
          Filter object after its removal from a bucket.
protected  void selectPivot(int count, AbstractObjectIterator<? extends LocalAbstractObject> sampleSetIterator)
          This method carries out the actual pivot selection and must be implemented by subclasses.
 
Methods inherited from class messif.pivotselection.AbstractPivotChooser
addPivot, clear, deregisterSampleProvider, getLastPivot, getNextPivot, getPivot, getPivot, iterator, registerSampleProvider, removeLastPivot, selectPivot, selectPivot, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAMPLE_SET_SIZE

public static int SAMPLE_SET_SIZE
Size of the data sample used to create clusters.


clusterRadius

protected final float clusterRadius
Ball size -- radius of the cluster.


clusterDiameter

protected final float clusterDiameter
Ball size multiplied by two

Constructor Detail

CoveragePivotChooser

public CoveragePivotChooser(float radius)
Creates a new instance of CoveragePivotChooser.

Parameters:
radius - radius of clusters (balls) used to create the coverage
Method Detail

selectPivot

protected void selectPivot(int count,
                           AbstractObjectIterator<? extends LocalAbstractObject> sampleSetIterator)
Description copied from class: AbstractPivotChooser
This method carries out the actual pivot selection and must be implemented by subclasses. The implementation must select at least count pitvots and add them by addPivot method.

Specified by:
selectPivot in class AbstractPivotChooser
Parameters:
count - Number of pivots to generate
sampleSetIterator - Iterator over the sample set of objects to choose new pivots from

filterAfterAdd

public void filterAfterAdd(LocalAbstractObject object,
                           LocalBucket bucket)
Description copied from interface: BucketFilterAfterAdd
Filter object after its insertion into a bucket.

Specified by:
filterAfterAdd in interface BucketFilterAfterAdd
Parameters:
object - the inserted object
bucket - bucket, where the object is stored

filterAfterRemove

public void filterAfterRemove(LocalAbstractObject object,
                              LocalBucket bucket)
Description copied from interface: BucketFilterAfterRemove
Filter object after its removal from a bucket.

Specified by:
filterAfterRemove in interface BucketFilterAfterRemove
Parameters:
object - the removed object
bucket - bucket, where the object has been stored