Package org.opt4j.common.archive
Class AdaptiveGridArchive
java.lang.Object
org.opt4j.core.IndividualSet
org.opt4j.core.optimizer.Archive
org.opt4j.common.archive.AbstractArchive
org.opt4j.common.archive.BoundedArchive
org.opt4j.common.archive.AdaptiveGridArchive
- All Implemented Interfaces:
Iterable<Individual>
,Collection<Individual>
,Set<Individual>
The
AdaptiveGridArchive
uses an adaptive grid in order to bound the
size of the Archive
.- See Also:
-
- "Properties of an Adaptive Archiving Algorithm for Storing Nondominated Vectors, J. Knowles, D. Corne, Transactions of Evolutionary Computation, Vol. 7, No. 2, April 2003"
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
A singleAdaptiveGridArchive.Cell
of the grid. -
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Long,
AdaptiveGridArchive.Cell> protected int
protected final int
protected final List<Individual>
protected boolean
protected double[]
protected final Rand
protected double[]
Fields inherited from class org.opt4j.common.archive.BoundedArchive
capacity
Fields inherited from class org.opt4j.core.IndividualSet
individuals, listeners
-
Constructor Summary
ConstructorDescriptionAdaptiveGridArchive
(int capacity, int div, Rand random) Constructs anAdaptiveGridArchive
. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToCell
(Iterable<Individual> individuals) Adds allIndividual
s to theirsAdaptiveGridArchive.Cell
s and theAdaptiveGridArchive.Cell
s to thecore.optimizer.Archive
.protected boolean
determineBounds
(Collection<Individual> individuals) Determines the new bounds for the individuals and returnstrue
if the bounds have changed.protected AdaptiveGridArchive.Cell
getCell
(Individual individual) Returns the appropriateAdaptiveGridArchive.Cell
for the givenIndividual
.protected AdaptiveGridArchive.Cell
Returns the most crowdedAdaptiveGridArchive.Cell
.protected void
init
(Individual individual) Initialize theArchive
.boolean
protected void
removeFromCell
(Individual individual) Removes thisIndividual
from itsAdaptiveGridArchive.Cell
and removes theAdaptiveGridArchive.Cell
from theArchive
if it is empty.protected 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.common.archive.BoundedArchive
addCheckedIndividual, addCheckedIndividuals, getCapacity, setCapacity
Methods inherited from class org.opt4j.common.archive.AbstractArchive
update
Methods inherited from class org.opt4j.core.IndividualSet
addListener, clear, contains, containsAll, isEmpty, iterator, 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
-
Field Details
-
isInit
protected boolean isInit -
div
protected final int div -
random
-
cells
-
extrema
-
lb
protected double[] lb -
ub
protected double[] ub -
dim
protected int dim
-
-
Constructor Details
-
AdaptiveGridArchive
Constructs anAdaptiveGridArchive
.- Parameters:
capacity
- the capacitydiv
- the divisionsrandom
- the random number generator
-
-
Method Details
-
updateWithNondominated
Description copied from class:AbstractArchive
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.- Specified by:
updateWithNondominated
in classAbstractArchive
- Parameters:
candidates
- the non-dominated individuals which can be added- Returns:
- true if one or more candidates are added to the archive
-
init
Initialize theArchive
.- Parameters:
individual
- one random individual
-
getCell
Returns the appropriateAdaptiveGridArchive.Cell
for the givenIndividual
.- Parameters:
individual
- the individual- Returns:
- the cell
-
getMostCrowdedCell
Returns the most crowdedAdaptiveGridArchive.Cell
.- Returns:
- the most crowded cell
-
remove
- Specified by:
remove
in interfaceCollection<Individual>
- Specified by:
remove
in interfaceSet<Individual>
- Overrides:
remove
in classIndividualSet
-
addToCell
Adds allIndividual
s to theirsAdaptiveGridArchive.Cell
s and theAdaptiveGridArchive.Cell
s to thecore.optimizer.Archive
.- Parameters:
individuals
- the individuals to be added
-
removeFromCell
Removes thisIndividual
from itsAdaptiveGridArchive.Cell
and removes theAdaptiveGridArchive.Cell
from theArchive
if it is empty.- Parameters:
individual
- the individual to be removed
-
determineBounds
Determines the new bounds for the individuals and returnstrue
if the bounds have changed.- Parameters:
individuals
- the individuals- Returns:
true
if the bounds have changed
-