Package org.opt4j.common.archive
Class AbstractArchive
java.lang.Object
org.opt4j.core.IndividualSet
org.opt4j.core.optimizer.Archive
org.opt4j.common.archive.AbstractArchive
- All Implemented Interfaces:
Iterable<Individual>
,Collection<Individual>
,Set<Individual>
- Direct Known Subclasses:
BoundedArchive
,PopulationArchive
,UnboundedArchive
This
AbstractArchive
provides some common methods for Archive
s. If one or more new Individual
s are added to this Archive
,
it is assured that all Individual
s in this Archive
are not
Pareto-dominated. The methods Archive.add(org.opt4j.core.Individual)
, Archive.addAll(Collection)
, and
Archive.addAll(Individual...)
are implemented such that each dominated
Individual is removed from the archive and with the new (unknown)
non-dominated Individual
s the method
updateWithNondominated(Collection)
is called. Actual implementations
of this class may still refuse or drop some Individual
s. 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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
update
(Set<? extends Individual> individuals) Updates the archive with a set of individuals.protected abstract boolean
updateWithNondominated
(Collection<Individual> candidates) Adds newcandidates
which 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
-
Constructor Details
-
AbstractArchive
public AbstractArchive()
-
-
Method Details
-
update
Description copied from class:Archive
Updates the archive with a set of individuals. Instead of theadd
/addAll
methods, which are prohibited for the archive (throwing anUnsupportedOperationException
), this method shall be used. -
updateWithNondominated
Adds newcandidates
which are already checked to be not Pareto-dominated by any other individual in thisArchive
. AllIndividual
s in theArchive
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
-