net.sourceforge.cilib.clustering.kmeans
Class KMeans

java.lang.Object
  extended by net.sourceforge.cilib.algorithm.Algorithm
      extended by net.sourceforge.cilib.algorithm.SingularAlgorithm
          extended by net.sourceforge.cilib.clustering.kmeans.KMeans
All Implemented Interfaces:
Serializable, Runnable, Cloneable

public class KMeans
extends SingularAlgorithm

This algorithm is an implementation of the KMeans Clustering algorithm.

This is the implementation as described in Section 2 of:

Author:
Theuns Cloete
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.cilib.algorithm.Algorithm
optimisationProblem
 
Constructor Summary
KMeans()
          Create an instance of KMeans.
KMeans(KMeans copy)
          Create a copy of the provided instance.
 
Method Summary
 void algorithmIteration()
          Performs a single iteration of the KMeans algorithm.
 OptimisationSolution getBestSolution()
          Get the best current solution.
 CentroidsInitialisationStrategy getCentroidsInitialisationStrategy()
          Get the centroid initialisation strategy.
 Algorithm getClone()
          Create a cloned copy of the current object and return it.
 List<OptimisationSolution> getSolutions()
          Get the collection of best solutions.
 void performInitialisation()
          This initialisation of the centroids is handled by the chosen CentroidsInitialisationStrategy.
 void setCentroidsInitialisationStrategy(CentroidsInitialisationStrategy centroidsInitialisationStrategy)
          Set the current CentroidsInitialisationStrategy.
 
Methods inherited from class net.sourceforge.cilib.algorithm.Algorithm
addAlgorithmListener, addStoppingCondition, get, getAlgorithmList, getIterations, getOptimisationProblem, getPercentageComplete, getStoppingConditions, initialise, isFinished, performIteration, performUninitialisation, removeAlgorithmListener, removeStoppingCondition, reset, run, setOptimisationProblem, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KMeans

public KMeans()
Create an instance of KMeans.


KMeans

public KMeans(KMeans copy)
Create a copy of the provided instance.

Parameters:
rhs - The instance to copy.
Method Detail

getClone

public Algorithm getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in class Algorithm
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

performInitialisation

public void performInitialisation()
This initialisation of the centroids is handled by the chosen CentroidsInitialisationStrategy.

Overrides:
performInitialisation in class Algorithm

algorithmIteration

public void algorithmIteration()
Performs a single iteration of the KMeans algorithm.

Specified by:
algorithmIteration in class SingularAlgorithm

getBestSolution

public OptimisationSolution getBestSolution()
Get the best current solution. This best solution is determined from the personal bests of the particles.

Specified by:
getBestSolution in class Algorithm
Returns:
The OptimisationSolution representing the best solution.

getSolutions

public List<OptimisationSolution> getSolutions()
Get the collection of best solutions. This result does not actually make sense in the normal PSO algorithm, but rather in a MultiObjective optimization.

Specified by:
getSolutions in class Algorithm
Returns:
The Collection<OptimisationSolution> containing the solutions.

getCentroidsInitialisationStrategy

public CentroidsInitialisationStrategy getCentroidsInitialisationStrategy()
Get the centroid initialisation strategy.

Returns:
The current CentroidsInitialisationStrategy.

setCentroidsInitialisationStrategy

public void setCentroidsInitialisationStrategy(CentroidsInitialisationStrategy centroidsInitialisationStrategy)
Set the current CentroidsInitialisationStrategy.

Parameters:
centroidsInitialisationStrategy - The value to set.


Copyright © 2009 CIRG. All Rights Reserved.