org.opt4j.core.common.archive
Class AbstractArchive

java.lang.Object
  extended by org.opt4j.core.IndividualSet
      extended by org.opt4j.core.optimizer.Archive
          extended by org.opt4j.core.common.archive.AbstractArchive
All Implemented Interfaces:
java.lang.Iterable<Individual>, java.util.Collection<Individual>, java.util.Set<Individual>
Direct Known Subclasses:
BoundedArchive, PopulationArchive, UnboundedArchive

public abstract class AbstractArchive
extends Archive

This AbstractArchive provides some common methods for Archive s. If one or more new Individuals are added to this Archive, it is ensured that all Individuals in this Archive are not Pareto-dominated. Actual implementations of this class may still refuse or drop some Individuals. An Archive can be a BoundedArchive if it has a bounded size or an UnboundedArchive, otherwise.


Field Summary
 
Fields inherited from class org.opt4j.core.IndividualSet
individuals, listeners
 
Constructor Summary
AbstractArchive()
           
 
Method Summary
 boolean update(java.util.Set<? extends Individual> individuals)
          Updates the archive with a set of individuals.
protected abstract  boolean updateWithNondominated(java.util.Collection<Individual> candidates)
          Adds new candidates which are already checked to be not Pareto-dominated by any other individual in this Archive.
 
Methods inherited from class org.opt4j.core.optimizer.Archive
addCheckedIndividual, addCheckedIndividuals, update
 
Methods inherited from class org.opt4j.core.IndividualSet
add, addAll, addAll, addListener, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, removeListener, retainAll, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

AbstractArchive

public AbstractArchive()
Method Detail

update

public boolean update(java.util.Set<? extends Individual> individuals)
Description copied from class: Archive
Updates the archive with a set of individuals. Instead of the add /addAll methods, which are prohibited for the archive (throwing an UnsupportedOperationException), this method shall be used.

Specified by:
update in class Archive
Parameters:
individuals - the set of individuals that is used to update the archive
Returns:
returns true if the content of the archive changed

updateWithNondominated

protected abstract boolean updateWithNondominated(java.util.Collection<Individual> candidates)
Adds new candidates which are already checked to be not Pareto-dominated by any other individual in this Archive. All Individuals in the Archive which were dominated by the candidates have already been removed.

Parameters:
candidates - the non-dominated individuals which can be added
Returns:
true if one or more candidates are added to the archive