net.sourceforge.cilib.coevolution.competitors
Class CoevolutionCompetitorList

java.lang.Object
  extended by net.sourceforge.cilib.coevolution.competitors.CoevolutionCompetitorList
All Implemented Interfaces:
Serializable, Type, Cloneable

public class CoevolutionCompetitorList
extends Object
implements Type

This class maintains a list of competitors per population for a coevolution problem. It could also be used to represent a HOF.

Author:
leo
See Also:
Serialized Form

Constructor Summary
CoevolutionCompetitorList()
           
CoevolutionCompetitorList(CoevolutionCompetitorList other)
           
CoevolutionCompetitorList(int numberOfEntitiesPerList)
           
 
Method Summary
 void addCompetitor(Competitor competitor)
          Add a competitor to the list of population competitors.
 void addCompetitorList(int populationID, List<Competitor> list)
          Add a list of Competitor's to specific PopulationCompetitorList
 void addCompetitorList(PopulationCompetitorList list)
          Add a PopulationCompetitorList to this CoevolutionCompetitorList
 CoevolutionCompetitorList getClone()
          Create a cloned copy of the current object and return it.
 Competitor getCompetitor(int listIndex, int populationIndex)
           
 List<Competitor> getCompetitorsFromSubList(int index)
          get one entry from each list at index
 int getNumberOfCompetitors(int index)
           
 int getNumberOfEntitesPerList()
           
 int getNumberOfLists()
           
 int getPopulationID(int index)
           
 void merge(CoevolutionCompetitorList other)
          Merge another CoevolutionCompetitorList into this one
 void removeCompetitor(int listIndex, int populationIndex)
           
 void removeSubList(int index)
          Remove the PopulationCompetitorList with the specified index
 void setNumberofEntitiesPerList()
           
 void updatePopulationID(int index, int oldPopulationID, int newPopulationID)
          Change the populationID for a PopulationCompetitorList, if the new population already exists, update the population ID's of the Competitor's and merge them with the existing PopulationCompetitorList,
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.cilib.type.types.Type
equals, hashCode
 

Constructor Detail

CoevolutionCompetitorList

public CoevolutionCompetitorList()

CoevolutionCompetitorList

public CoevolutionCompetitorList(int numberOfEntitiesPerList)

CoevolutionCompetitorList

public CoevolutionCompetitorList(CoevolutionCompetitorList other)
Method Detail

addCompetitorList

public void addCompetitorList(PopulationCompetitorList list)
Add a PopulationCompetitorList to this CoevolutionCompetitorList

Parameters:
list - The competitors

addCompetitorList

public void addCompetitorList(int populationID,
                              List<Competitor> list)
Add a list of Competitor's to specific PopulationCompetitorList

Parameters:
populationID - The ID of the population these competitors are from
list - The list of competitors

merge

public void merge(CoevolutionCompetitorList other)
Merge another CoevolutionCompetitorList into this one

Parameters:
other - The list to merge

addCompetitor

public void addCompetitor(Competitor competitor)
Add a competitor to the list of population competitors. First see if it will fit in a PopulationCompetitorList based on its populationID, if not create a new PopulationCompetitorList

Parameters:
competitor - The Competitor to add

getCompetitorsFromSubList

public List<Competitor> getCompetitorsFromSubList(int index)
get one entry from each list at index

Parameters:
index - the specified index which relates to a population ID
Returns:
the requested list

removeSubList

public void removeSubList(int index)
Remove the PopulationCompetitorList with the specified index

Parameters:
index -

getNumberOfEntitesPerList

public int getNumberOfEntitesPerList()

setNumberofEntitiesPerList

public void setNumberofEntitiesPerList()

getNumberOfLists

public int getNumberOfLists()

getPopulationID

public int getPopulationID(int index)

getNumberOfCompetitors

public int getNumberOfCompetitors(int index)

getCompetitor

public Competitor getCompetitor(int listIndex,
                                int populationIndex)

removeCompetitor

public void removeCompetitor(int listIndex,
                             int populationIndex)

updatePopulationID

public void updatePopulationID(int index,
                               int oldPopulationID,
                               int newPopulationID)
Change the populationID for a PopulationCompetitorList, if the new population already exists, update the population ID's of the Competitor's and merge them with the existing PopulationCompetitorList,

Parameters:
index - the index in the array to update
oldPopulationID - the old populationID
newPopulationID - the new populationID

getClone

public CoevolutionCompetitorList 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 Type
Specified by:
getClone in interface Cloneable
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()


Copyright © 2009 CIRG. All Rights Reserved.