Orbital library

orbital.algorithm.evolutionary
Class ParallelEvaluationPopulation

java.lang.Object
  extended by orbital.algorithm.evolutionary.Population
      extended by orbital.algorithm.evolutionary.ParallelEvaluationPopulation
All Implemented Interfaces:
java.io.Serializable

public class ParallelEvaluationPopulation
extends Population
implements java.io.Serializable

A Population that evaluates its members fitness-weights in parallel.

When using the ParallelEvaluationPopulation always make sure that you call evaluate(boolean) after having added some Genomes, and prior to relying on it being sorted. Especially call evaluate after creation or evolving (with GeneticAlgorithm.evolve()).

Better not try calling add() again while evaluate() is still running, although it should work.

Author:
André Platzer
See Also:
ParallelEvaluationPopulation(Population), Serialized Form
Invariants:
evaluators != null is final-like (either due to constructor call, or after a call to readObject).

Constructor Summary
ParallelEvaluationPopulation()
           
ParallelEvaluationPopulation(Population original)
          Convert a population into a parallel evaluating population using its members list per reference.
 
Method Summary
 boolean add(java.lang.Object o)
          Adds at an arbitrary position since fitness evaluation is done later.
 void evaluate(boolean redo)
          Evaluate and resort population waiting for all current evaluator threads to stop.
protected  void evaluate(Genome g, boolean redo)
          Concurrently evaluate a genome.
protected  java.lang.ThreadGroup exchangeEvaluators()
          Exchanges evaluators for this generation.
protected  java.lang.ThreadGroup getEvaluators()
          Get the master thread group for all evaluation threads started to evaluate some fitness values of the members.
protected  java.lang.ThreadGroup getGenerationEvaluators()
          Get the current thread group for all evaluation threads started during this generation to evaluate some fitness values of the members.
protected  void waitForEvaluators()
          Waits for all current evaluator threads to stop.
 
Methods inherited from class orbital.algorithm.evolutionary.Population
clone, create, create, equals, get, get, getFitnessArray, getGeneration, getMembers, getOverallDistance, hashCode, iterator, listIterator, listIterator, remove, remove, setGeneration, size, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParallelEvaluationPopulation

public ParallelEvaluationPopulation()

ParallelEvaluationPopulation

public ParallelEvaluationPopulation(Population original)
Convert a population into a parallel evaluating population using its members list per reference. To parallelize the evaluation in create as well consider using Population.create(Population, Genome, int) instead.

See Also:
Population.create(Population, Genome, int)
Method Detail

getEvaluators

protected final java.lang.ThreadGroup getEvaluators()
Get the master thread group for all evaluation threads started to evaluate some fitness values of the members.

See Also:
getGenerationEvaluators()

getGenerationEvaluators

protected final java.lang.ThreadGroup getGenerationEvaluators()
Get the current thread group for all evaluation threads started during this generation to evaluate some fitness values of the members. Exchanged whenever waitForEvaluators() or exchangeEvaluators() is called.

See Also:
getEvaluators(), exchangeEvaluators(), waitForEvaluators()

add

public boolean add(java.lang.Object o)
Adds at an arbitrary position since fitness evaluation is done later. Threads fitness calculation.

Overrides:
add in class Population
See Also:
evaluate(boolean)

evaluate

public void evaluate(boolean redo)
Evaluate and resort population waiting for all current evaluator threads to stop.

Overrides:
evaluate in class Population
Parameters:
redo - force whole evaluation again, even for cached fitness values. If true we will Thread.stop()(!) all running evaluator threads.
See Also:
add(Object)

evaluate

protected void evaluate(Genome g,
                        boolean redo)
Concurrently evaluate a genome. When called threads fitness calculation.

See Also:
waitForEvaluators()

waitForEvaluators

protected void waitForEvaluators()
Waits for all current evaluator threads to stop.


exchangeEvaluators

protected final java.lang.ThreadGroup exchangeEvaluators()
Exchanges evaluators for this generation.

See Also:
generationEvaluators

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.