Package org.opt4j.common.archive
Class PopulationArchive
- java.lang.Object
-
- org.opt4j.core.IndividualSet
-
- org.opt4j.core.optimizer.Archive
-
- org.opt4j.common.archive.AbstractArchive
-
- org.opt4j.common.archive.PopulationArchive
-
- All Implemented Interfaces:
Iterable<Individual>,Collection<Individual>,Set<Individual>
public class PopulationArchive extends AbstractArchive
ThePopulationArchivekeeps the non-dominatedIndividuals from thePopulation. It is assumed that theupdate(Set)method is called with the currentPopulationin each iteration.
-
-
Field Summary
-
Fields inherited from class org.opt4j.core.IndividualSet
individuals, listeners
-
-
Constructor Summary
Constructors Constructor Description PopulationArchive()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanupdate(Set<? extends Individual> individuals)Updates the archive with a set of individuals.protected booleanupdateWithNondominated(Collection<Individual> candidates)Adds newcandidateswhich are already checked to be not Pareto-dominated by any other individual in thisArchive.-
Methods inherited from class org.opt4j.core.optimizer.Archive
add, addAll, addAll, addCheckedIndividual, addCheckedIndividuals, update
-
Methods inherited from class org.opt4j.core.IndividualSet
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.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
-
-
-
Method Detail
-
update
public boolean update(Set<? extends Individual> individuals)
Description copied from class:ArchiveUpdates the archive with a set of individuals. Instead of theadd/addAllmethods, which are prohibited for the archive (throwing anUnsupportedOperationException), this method shall be used.- Overrides:
updatein classAbstractArchive- Parameters:
individuals- the set of individuals that is used to update the archive- Returns:
- returns
trueif the content of the archive changed
-
updateWithNondominated
protected boolean updateWithNondominated(Collection<Individual> candidates)
Description copied from class:AbstractArchiveAdds newcandidateswhich are already checked to be not Pareto-dominated by any other individual in thisArchive. AllIndividuals in theArchivewhich were dominated by the candidates have already been removed.- Specified by:
updateWithNondominatedin classAbstractArchive- Parameters:
candidates- the non-dominated individuals which can be added- Returns:
- true if one or more candidates are added to the archive
-
-