net.openai.ai.ga.selection.common
Class SelectDifference

java.lang.Object
  |
  +--net.openai.ai.ga.selection.common.SelectDifference
All Implemented Interfaces:
SelectionAlgorithm

public class SelectDifference
extends java.lang.Object
implements SelectionAlgorithm

SelectDifference is a SelectionAlgorithm that will return the difference of the results of two specified SelectionAlgorithms.

Since:
JDK1.3
Version:
%I%, %G%
Author:
Jared Grubb

Constructor Summary
SelectDifference(SelectionAlgorithm first, SelectionAlgorithm second)
          Creates a new SelectDifference object for taking the difference of the Populations returned by the two passed SelectionAlgorithms.
 
Method Summary
 Population selectFromPopulation(Population pop)
          Returns a Population that represents the difference (disjunction) of the two SelectionAlgorithms specified in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectDifference

public SelectDifference(SelectionAlgorithm first,
                        SelectionAlgorithm second)
Creates a new SelectDifference object for taking the difference of the Populations returned by the two passed SelectionAlgorithms.

Parameters:
first - the first SelectionAlgorithm
second - the second SelectionAlgorithm
Method Detail

selectFromPopulation

public Population selectFromPopulation(Population pop)
Returns a Population that represents the difference (disjunction) of the two SelectionAlgorithms specified in the constructor. The return is the result of the first selection algorithm with the results of the second removed from it via Population.removeCells method. If the first selection algorithm returns a null then a NullPointerException will be thrown. If the second one returns a null, the the results of the first will be returned unchanged.

Specified by:
selectFromPopulation in interface SelectionAlgorithm
Parameters:
pop - the Population to choose from
Returns:
the difference Population of the two selection algorithms


Copyright - 2001 OpenAI Labs. All Rights Reserved.