org.opt4j.core.common.archive
Class AdaptiveGridArchive

java.lang.Object
  extended by org.opt4j.core.IndividualSet
      extended by org.opt4j.core.optimizer.Archive
          extended by org.opt4j.core.common.archive.AbstractArchive
              extended by org.opt4j.core.common.archive.BoundedArchive
                  extended by org.opt4j.core.common.archive.AdaptiveGridArchive
All Implemented Interfaces:
java.lang.Iterable<Individual>, java.util.Collection<Individual>, java.util.Set<Individual>

public class AdaptiveGridArchive
extends BoundedArchive

The AdaptiveGridArchive uses an adaptive grid in order to bound the size of the Archive, see "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
protected static class AdaptiveGridArchive.Cell
          A single AdaptiveGridArchive.Cell of the grid.
 
Field Summary
protected  java.util.Map<java.lang.Long,AdaptiveGridArchive.Cell> cells
           
protected  int dim
           
protected  int div
           
protected  java.util.List<Individual> extrema
           
protected  boolean isInit
           
protected  double[] lb
           
protected  Rand random
           
protected  double[] ub
           
 
Fields inherited from class org.opt4j.core.common.archive.BoundedArchive
capacity
 
Fields inherited from class org.opt4j.core.IndividualSet
individuals, listeners
 
Constructor Summary
AdaptiveGridArchive(int capacity, int div, Rand random)
          Constructs an AdaptiveGridArchive.
 
Method Summary
protected  void addToCell(java.lang.Iterable<Individual> individuals)
          Adds all Individuals to theirs AdaptiveGridArchive.Cells and the AdaptiveGridArchive.Cell s to the Archive.
protected  boolean determineBounds(java.util.Collection<Individual> individuals)
          Determines the new bounds for the individuals and returns true if the bounds have changed.
protected  AdaptiveGridArchive.Cell getCell(Individual individual)
          Returns the appropriate AdaptiveGridArchive.Cell for the given Individual.
protected  AdaptiveGridArchive.Cell getMostCrowdedCell()
          Returns the most crowded AdaptiveGridArchive.Cell.
protected  void init(Individual individual)
          Initialize the Archive.
 boolean remove(java.lang.Object o)
           
protected  void removeFromCell(Individual individual)
          Removes this Individual from its AdaptiveGridArchive.Cell and removes the AdaptiveGridArchive.Cell from the Archive if it is empty.
protected  boolean updateWithNondominated(java.util.Collection<Individual> candidates)
          Adds new candidates which are already checked to be not Pareto-dominated by any other individual in this Archive.
 
Methods inherited from class org.opt4j.core.common.archive.BoundedArchive
addCheckedIndividual, addCheckedIndividuals, getCapacity, setCapacity
 
Methods inherited from class org.opt4j.core.common.archive.AbstractArchive
update
 
Methods inherited from class org.opt4j.core.optimizer.Archive
update
 
Methods inherited from class org.opt4j.core.IndividualSet
add, addAll, addAll, 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.Set
equals, hashCode
 

Field Detail

isInit

protected boolean isInit

div

protected final int div

random

protected final Rand random

cells

protected final java.util.Map<java.lang.Long,AdaptiveGridArchive.Cell> cells

extrema

protected final java.util.List<Individual> extrema

lb

protected double[] lb

ub

protected double[] ub

dim

protected int dim
Constructor Detail

AdaptiveGridArchive

@Inject
public AdaptiveGridArchive(int capacity,
                                  int div,
                                  Rand random)
Constructs an AdaptiveGridArchive.

Parameters:
capacity - the capacity
div - the divisions
random - the random number generator
Method Detail

updateWithNondominated

protected boolean updateWithNondominated(java.util.Collection<Individual> candidates)
Description copied from class: AbstractArchive
Adds new candidates which are already checked to be not Pareto-dominated by any other individual in this Archive. All Individuals in the Archive which were dominated by the candidates have already been removed.

Specified by:
updateWithNondominated in class AbstractArchive
Parameters:
candidates - the non-dominated individuals which can be added
Returns:
true if one or more candidates are added to the archive

init

protected void init(Individual individual)
Initialize the Archive.

Parameters:
individual - one random individual

getCell

protected AdaptiveGridArchive.Cell getCell(Individual individual)
Returns the appropriate AdaptiveGridArchive.Cell for the given Individual.

Parameters:
individual - the individual
Returns:
the cell

getMostCrowdedCell

protected AdaptiveGridArchive.Cell getMostCrowdedCell()
Returns the most crowded AdaptiveGridArchive.Cell.

Returns:
the most crowded cell

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<Individual>
Specified by:
remove in interface java.util.Set<Individual>
Overrides:
remove in class IndividualSet

addToCell

protected void addToCell(java.lang.Iterable<Individual> individuals)
Adds all Individuals to theirs AdaptiveGridArchive.Cells and the AdaptiveGridArchive.Cell s to the Archive.

Parameters:
individuals - the individuals to be added

removeFromCell

protected void removeFromCell(Individual individual)
Removes this Individual from its AdaptiveGridArchive.Cell and removes the AdaptiveGridArchive.Cell from the Archive if it is empty.

Parameters:
individual - the individual to be removed

determineBounds

protected boolean determineBounds(java.util.Collection<Individual> individuals)
Determines the new bounds for the individuals and returns true if the bounds have changed.

Parameters:
individuals - the individuals
Returns:
true if the bounds have changed