Package org.opt4j.core.common.archive
Class AbstractArchive
- java.lang.Object
-
- org.opt4j.core.IndividualSet
-
- org.opt4j.core.optimizer.Archive
-
- 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
ThisAbstractArchive
provides some common methods forArchive
s. If one or more newIndividual
s are added to thisArchive
, it is ensured that allIndividual
s in thisArchive
are not Pareto-dominated. Actual implementations of this class may still refuse or drop someIndividual
s. AnArchive
can be aBoundedArchive
if it has a bounded size or anUnboundedArchive
, otherwise.
-
-
Field Summary
-
Fields inherited from class org.opt4j.core.IndividualSet
individuals, listeners
-
-
Constructor Summary
Constructors Constructor Description AbstractArchive()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
removeArchiveDominated(java.util.List<Individual> candidates)
Remove those individuals from the candidates which are weakly dominated by the archive.protected void
removeDominatedCandidates(java.util.List<Individual> candidates)
Remove candidates, which are weakly dominated by another candidate.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 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
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
-
-
-
-
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 theadd
/addAll
methods, which are prohibited for the archive (throwing anUnsupportedOperationException
), this method shall be used.
-
removeDominatedCandidates
protected void removeDominatedCandidates(java.util.List<Individual> candidates)
Remove candidates, which are weakly dominated by another candidate. Thus, the list of candidates which need to be tested against the whole archive is reduced.- Parameters:
candidates
- the list of candidates to sanitize
-
removeArchiveDominated
protected void removeArchiveDominated(java.util.List<Individual> candidates)
Remove those individuals from the candidates which are weakly dominated by the archive. Remove those individuals from the archive which are dominated by the candidates. In case of equal objectives, this gives priority to the individuals in the archive and avoids unnecessary archive updates.- Parameters:
candidates
- the list of candidates to sanitize
-
updateWithNondominated
protected abstract boolean updateWithNondominated(java.util.Collection<Individual> candidates)
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
-
-