net.sourceforge.cilib.entity.topologies
Class LBestTopology<E extends Entity>

java.lang.Object
  extended by net.sourceforge.cilib.entity.AbstractTopology<E>
      extended by net.sourceforge.cilib.entity.topologies.GBestTopology<E>
          extended by net.sourceforge.cilib.entity.topologies.LBestTopology<E>
Type Parameters:
E - The Entity type.
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, List<E>, Topology<E>, Cloneable

public class LBestTopology<E extends Entity>
extends GBestTopology<E>

Implementation of the Local Best Neighbourhood topology.

References:

Author:
Edwin Peer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sourceforge.cilib.entity.topologies.GBestTopology
GBestTopology.IndexedIterator<T extends Entity>
 
Field Summary
 
Fields inherited from class net.sourceforge.cilib.entity.topologies.GBestTopology
entities
 
Constructor Summary
LBestTopology()
          Creates a new instance of LBestTopology.
LBestTopology(LBestTopology<E> copy)
          Copy constructor.
 
Method Summary
 LBestTopology<E> getClone()
          Create a cloned copy of the current object and return it.
 int getNeighbourhoodSize()
          Accessor for the number of particles in a neighbourhood.
 Iterator<E> neighbourhood(Iterator<? extends Entity> iterator)
          Recalculate the neighbourhoodSize by updating the ControlParameter and then construct a new iterator to be returned.
 void setNeighbourhoodSize(ControlParameter neighbourhoodSize)
          Sets the ControlParameter that should be used to determine the number of particles in the neighbourhood of each particle.
 
Methods inherited from class net.sourceforge.cilib.entity.topologies.GBestTopology
add, add, addAll, addAll, asList, clear, contains, containsAll, equals, get, getId, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, remove, removeAll, retainAll, set, setId, size, subList, toArray, toArray
 
Methods inherited from class net.sourceforge.cilib.entity.AbstractTopology
accept, accept, clearBestEntity, getBestEntity, getBestEntity, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LBestTopology

public LBestTopology()
Creates a new instance of LBestTopology. The default neighbourhoodSize is a ConstantControlParameter with it's parameter set to 3.


LBestTopology

public LBestTopology(LBestTopology<E> copy)
Copy constructor. Copy the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

getClone

public LBestTopology<E> 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 Topology<E extends Entity>
Specified by:
getClone in interface Cloneable
Overrides:
getClone in class GBestTopology<E extends Entity>
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

neighbourhood

public Iterator<E> neighbourhood(Iterator<? extends Entity> iterator)
Recalculate the neighbourhoodSize by updating the ControlParameter and then construct a new iterator to be returned.

Specified by:
neighbourhood in interface Topology<E extends Entity>
Overrides:
neighbourhood in class GBestTopology<E extends Entity>
Parameters:
iterator - The Iterator to wrap.
Returns:
a new iterator for this topology.

setNeighbourhoodSize

public void setNeighbourhoodSize(ControlParameter neighbourhoodSize)
Sets the ControlParameter that should be used to determine the number of particles in the neighbourhood of each particle. The default is a ConstantControlParameter with the parameter set to 3.

Parameters:
neighbourhoodSize - The ControlParameter to use.

getNeighbourhoodSize

public int getNeighbourhoodSize()
Accessor for the number of particles in a neighbourhood. NOTE: This method does not return the ControlParameter but the parameter that is changed / updated by it rounded to the nearest integer.

Returns:
The size of the neighbourhood.


Copyright © 2009 CIRG. All Rights Reserved.