Package org.opt4j.core.optimizer
Class Archive
- java.lang.Object
-
- org.opt4j.core.IndividualSet
-
- org.opt4j.core.optimizer.Archive
-
- All Implemented Interfaces:
Iterable<Individual>
,Collection<Individual>
,Set<Individual>
- Direct Known Subclasses:
AbstractArchive
public abstract class Archive extends IndividualSet
AnArchive
is used to store a set of high-qualityIndividual
s. Commonly, theseIndividual
s are non-dominated.
-
-
Field Summary
-
Fields inherited from class org.opt4j.core.IndividualSet
individuals, listeners
-
-
Constructor Summary
Constructors Constructor Description Archive()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
add(Individual individual)
Deprecated.boolean
addAll(Collection<? extends Individual> c)
Deprecated.boolean
addAll(Individual... c)
Deprecated.protected boolean
addCheckedIndividual(Individual individual)
Adds theIndividual
to thisArchive
without further checks.protected boolean
addCheckedIndividuals(Collection<? extends Individual> individuals)
Adds theIndividual
s to thisArchive
without further checks.abstract boolean
update(Set<? extends Individual> individuals)
Updates the archive with a set of individuals.boolean
update(Individual individual)
Updates the archive with a single individual.-
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(Individual individual)
Updates the archive with a single individual.- Parameters:
individual
- the individual that is used to update the archive- Returns:
- returns
true
if the content of the archive changed
-
update
public abstract boolean update(Set<? extends Individual> individuals)
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.- Parameters:
individuals
- the set of individuals that is used to update the archive- Returns:
- returns
true
if the content of the archive changed
-
add
@Deprecated public final boolean add(Individual individual)
Deprecated.- Specified by:
add
in interfaceCollection<Individual>
- Specified by:
add
in interfaceSet<Individual>
- Overrides:
add
in classIndividualSet
-
addAll
@Deprecated public final boolean addAll(Collection<? extends Individual> c)
Deprecated.- Specified by:
addAll
in interfaceCollection<Individual>
- Specified by:
addAll
in interfaceSet<Individual>
- Overrides:
addAll
in classIndividualSet
-
addAll
@Deprecated public final boolean addAll(Individual... c)
Deprecated.Description copied from class:IndividualSet
Add allIndividual
s.- Overrides:
addAll
in classIndividualSet
- Parameters:
c
- the individuals to be added- Returns:
- true if at least one individual was added
-
addCheckedIndividual
protected boolean addCheckedIndividual(Individual individual)
Adds theIndividual
to thisArchive
without further checks. Must be used only if theIndividual
is checked to be Pareto-dominant and, according to possible archive size restrictions, can be added to thisArchive
.- Parameters:
individual
- the individual to be actually added to the archive- Returns:
- true
-
addCheckedIndividuals
protected boolean addCheckedIndividuals(Collection<? extends Individual> individuals)
Adds theIndividual
s to thisArchive
without further checks. Must be used only if theIndividual
s are checked to be Pareto-dominant and, according to possible archive size restrictions, can all be added to thisArchive
.- Parameters:
individuals
- the individuals to be actually added to the archive- Returns:
- true
-
-