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
Nested ClassesModifier and TypeClassDescriptionprotected static classA singleAdaptiveGridArchive.Cellof the grid. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Long,AdaptiveGridArchive.Cell> protected intprotected final intprotected final List<Individual>protected booleanprotected double[]protected final Randprotected double[]Fields inherited from class org.opt4j.common.archive.BoundedArchive
capacityFields inherited from class org.opt4j.core.IndividualSet
individuals, listeners -
Constructor Summary
ConstructorsConstructorDescriptionAdaptiveGridArchive(int capacity, int div, Rand random) Constructs anAdaptiveGridArchive. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToCell(Iterable<Individual> individuals) Adds allIndividuals to theirsAdaptiveGridArchive.Cells and theAdaptiveGridArchive.Cells to thecore.optimizer.Archive.protected booleandetermineBounds(Collection<Individual> individuals) Determines the new bounds for the individuals and returnstrueif the bounds have changed.protected AdaptiveGridArchive.CellgetCell(Individual individual) Returns the appropriateAdaptiveGridArchive.Cellfor the givenIndividual.protected AdaptiveGridArchive.CellReturns the most crowdedAdaptiveGridArchive.Cell.protected voidinit(Individual individual) Initialize theArchive.booleanprotected voidremoveFromCell(Individual individual) Removes thisIndividualfrom itsAdaptiveGridArchive.Celland removes theAdaptiveGridArchive.Cellfrom theArchiveif it is empty.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.common.archive.BoundedArchive
addCheckedIndividual, addCheckedIndividuals, getCapacity, setCapacityMethods inherited from class org.opt4j.common.archive.AbstractArchive
updateMethods inherited from class org.opt4j.core.IndividualSet
addListener, clear, contains, containsAll, isEmpty, iterator, removeAll, removeListener, retainAll, size, toArray, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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: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
-
init
Initialize theArchive.- Parameters:
individual- one random individual
-
getCell
Returns the appropriateAdaptiveGridArchive.Cellfor the givenIndividual.- Parameters:
individual- the individual- Returns:
- the cell
-
getMostCrowdedCell
Returns the most crowdedAdaptiveGridArchive.Cell.- Returns:
- the most crowded cell
-
remove
- Specified by:
removein interfaceCollection<Individual>- Specified by:
removein interfaceSet<Individual>- Overrides:
removein classIndividualSet
-
addToCell
Adds allIndividuals to theirsAdaptiveGridArchive.Cells and theAdaptiveGridArchive.Cells to thecore.optimizer.Archive.- Parameters:
individuals- the individuals to be added
-
removeFromCell
Removes thisIndividualfrom itsAdaptiveGridArchive.Celland removes theAdaptiveGridArchive.Cellfrom theArchiveif it is empty.- Parameters:
individual- the individual to be removed
-
determineBounds
Determines the new bounds for the individuals and returnstrueif the bounds have changed.- Parameters:
individuals- the individuals- Returns:
trueif the bounds have changed
-