iterator
Class NSGA2

java.lang.Object
  extended by iterator.AbstractIterator
      extended by iterator.AbstractOptimizer<T>
          extended by iterator.AbstractInitialSampleBasedOptimizer<T>
              extended by iterator.AbstractPopulationOptimizer<T>
                  extended by iterator.BasicRealEncodedGA<MultiObjectiveProblem>
                      extended by iterator.NSGA2
All Implemented Interfaces:
DataListener, InitialSamplesSettable, Iterable, LoggableIterator, RepeatableLoggableIterator

public class NSGA2
extends BasicRealEncodedGA<MultiObjectiveProblem>

NSGA-II algorithm. Implemented in a multithreaded fashion.

Author:
dgorur

Field Summary
 
Fields inherited from class iterator.BasicRealEncodedGA
comparator, extrapolationFactor, interpolationFactor, xMutation
 
Fields inherited from class iterator.AbstractPopulationOptimizer
currentBestG, lastBestG, nextBlock
 
Fields inherited from class iterator.AbstractInitialSampleBasedOptimizer
uniform
 
Fields inherited from class iterator.AbstractOptimizer
doubleFormat, funEvalCount, logWriter
 
Fields inherited from class iterator.AbstractIterator
diagnosticString, iter
 
Constructor Summary
NSGA2()
           
 
Method Summary
protected  cern.colt.matrix.DoubleMatrix2D computeNextPoints()
          Computes the next set of candidate solutions.
protected  void evaluatePoints(cern.colt.matrix.DoubleMatrix2D nextPoints)
          Evaluates the objective (and constraints) given set of points.
 iterator.NSGA2.PopulationMember[] getPopulation()
           
 int getThreadCount()
          Returns the number of threads this iterator can launch simultaneously.
 void init()
          Initialization routine
protected  void initializePopulation()
          Creates an initial population.
 boolean isWriteFrontsToFile()
          Returns true if the pareto fronts at each iteration are to be written to a file.
 void iterate()
          Iterates until termination.
static void main(java.lang.String[] args)
           
 void setInitialSamples(cern.colt.matrix.DoubleMatrix2D initialSamples)
           
 void setThreadCount(int threadCount)
          Sets the number of threads this iterator can launch simultaneously.
 void setWriteFrontsToFile(boolean writeFrontsToFile)
          Sets whether the pareto fronts at each iteration will be written to file.
 void singleIteration()
          Performs a single iteration.
 double[] singleObjectiveSearch(int objectiveIndex, double fraction)
          Sorts the pareto front according to the specified objective, then returns the population member at the specified fraction of this sorted list.
 iterator.NSGA2.PopulationMember[] sortFrontOn(int objectiveIndex)
          Sorts the pareto front on the specified objective.
protected  void updateDiagnostics()
          Provides access to the diagnosticString, so that the user has flexibility over multiple methods accessing this string at different times.
 
Methods inherited from class iterator.BasicRealEncodedGA
getExtrapolationFactor, getInterpolationFactor, getMutationBox, getMutationFraction, getMutationProbability, makeChildren, setExtrapolationFactor, setInterpolationFactor, setMutationBox, setMutationFraction, setMutationProbability
 
Methods inherited from class iterator.AbstractPopulationOptimizer
getPopulationSize, setInitialSamples, setInitialSamples, setPopulationSize
 
Methods inherited from class iterator.AbstractInitialSampleBasedOptimizer
getRandomSeed, makeInitialSamples, setRandomSeed
 
Methods inherited from class iterator.AbstractOptimizer
clear, dataAdded, dataAdded, dataRemoved, dataRemoved, getDataHandler, getFunEvalCount, getLogFileName, getMaxFunEval, getProblem, isTerminated, setDataHandler, setFunEvalCount, setLogFileName, setMaxFunEval, setProblem, writeInitialRunLog
 
Methods inherited from class iterator.AbstractIterator
isVerbose, printDiagnostics, setVerbose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface iterator.LoggableIterator
getLogFileName, setLogFileName
 
Methods inherited from interface iterator.Iterable
isTerminated
 

Constructor Detail

NSGA2

public NSGA2()
Method Detail

main

public static void main(java.lang.String[] args)

getPopulation

public iterator.NSGA2.PopulationMember[] getPopulation()
Overrides:
getPopulation in class BasicRealEncodedGA<MultiObjectiveProblem>

getThreadCount

public int getThreadCount()
Returns the number of threads this iterator can launch simultaneously.

Returns:
the thread count.

setThreadCount

public void setThreadCount(int threadCount)
Sets the number of threads this iterator can launch simultaneously.

Parameters:
threadCount - the given number of threads.

init

public void init()
Description copied from interface: Iterable
Initialization routine

Specified by:
init in interface Iterable
Overrides:
init in class BasicRealEncodedGA<MultiObjectiveProblem>

iterate

public void iterate()
Description copied from interface: Iterable
Iterates until termination.

Specified by:
iterate in interface Iterable
Overrides:
iterate in class AbstractOptimizer<MultiObjectiveProblem>

isWriteFrontsToFile

public boolean isWriteFrontsToFile()
Returns true if the pareto fronts at each iteration are to be written to a file.

Returns:
true if the pareto fronts are to be written to a file.

setWriteFrontsToFile

public void setWriteFrontsToFile(boolean writeFrontsToFile)
Sets whether the pareto fronts at each iteration will be written to file.

Parameters:
writeFrontsToFile - set true if fronts are to be written to file.

singleIteration

public void singleIteration()
Description copied from interface: Iterable
Performs a single iteration.

Specified by:
singleIteration in interface Iterable
Overrides:
singleIteration in class AbstractPopulationOptimizer<MultiObjectiveProblem>

singleObjectiveSearch

public double[] singleObjectiveSearch(int objectiveIndex,
                                      double fraction)
Sorts the pareto front according to the specified objective, then returns the population member at the specified fraction of this sorted list.

Parameters:
objectiveIndex - the index of the objective to sort on.
fraction - the fraction at which the population member is to be selected.
Returns:
the population member the desired fraction of the pareto front sorted along the given objective.

sortFrontOn

public iterator.NSGA2.PopulationMember[] sortFrontOn(int objectiveIndex)
Sorts the pareto front on the specified objective.

Parameters:
objectiveIndex - the index of the objective to sort on.
Returns:
an array of population members representing the pareto front sorted along the given objective.

setInitialSamples

public void setInitialSamples(cern.colt.matrix.DoubleMatrix2D initialSamples)
Specified by:
setInitialSamples in interface InitialSamplesSettable
Overrides:
setInitialSamples in class AbstractPopulationOptimizer<MultiObjectiveProblem>
Parameters:
initialSamples - initial matrix of points, stored row-wise.

initializePopulation

protected void initializePopulation()
Creates an initial population.

Overrides:
initializePopulation in class BasicRealEncodedGA<MultiObjectiveProblem>

computeNextPoints

protected cern.colt.matrix.DoubleMatrix2D computeNextPoints()
Description copied from class: AbstractPopulationOptimizer
Computes the next set of candidate solutions.

Specified by:
computeNextPoints in class AbstractPopulationOptimizer<MultiObjectiveProblem>
Returns:
a DoubleMatrix2D containing design points row-wise.

evaluatePoints

protected void evaluatePoints(cern.colt.matrix.DoubleMatrix2D nextPoints)
Description copied from class: AbstractPopulationOptimizer
Evaluates the objective (and constraints) given set of points.

Overrides:
evaluatePoints in class AbstractPopulationOptimizer<MultiObjectiveProblem>
Parameters:
nextPoints - the given set of inputs, row-wise.

updateDiagnostics

protected void updateDiagnostics()
Description copied from class: AbstractIterator
Provides access to the diagnosticString, so that the user has flexibility over multiple methods accessing this string at different times.

Overrides:
updateDiagnostics in class AbstractOptimizer<MultiObjectiveProblem>