JAGA Homepage

org.jaga.individualRepresentation.booleanFormulas
Class BooleanFormulaTree

java.lang.Object
  extended by org.jaga.individualRepresentation.booleanFormulas.BooleanFormulaTree
All Implemented Interfaces:
Individual

public class BooleanFormulaTree
extends java.lang.Object
implements Individual

TODO: Complete these comments.

Project: JAGA - Java API for Genetic Algorithms.

Company: University College London and JAGA.Org (http://www.jaga.org).

Copyright: (c) 2004 by G. Paperin.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, ONLY if you include a note of the original author(s) in any redistributed/modified copy.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/gpl.html

Version:
JAGA public release 1.0 beta
Author:
Greg Paperin (greg@jaga.org)

Field Summary
private  Fitness fitness
           
private  long nextHandleToGenerate
           
private  java.util.HashMap nodes
           
private  int numberOfParameters
           
private  BooleanFormulaTreeNode root
           
 
Constructor Summary
private BooleanFormulaTree()
           
  BooleanFormulaTree(int numberOfParameters)
           
 
Method Summary
private  void addToNodeList(BooleanFormulaTreeNode node, int depth)
           
 boolean evaluate(boolean[] parameters)
           
 BooleanFormulaTreeNode exportNode(java.lang.Long handle)
           
private  java.lang.Long generateNewHandle()
           
 Fitness getFitness()
          Gets the individual's fitness.
 java.util.Iterator getHandlersIterator()
           
private  BooleanFormulaTreeNode getNode(java.lang.Long handle)
           
 int getNodeCount()
           
 int getNodeDepth(java.lang.Long handle)
           
 int getNodeHeight(java.lang.Long handle)
           
 int getNumberOfParameters()
           
private  void removeFromNodeList(BooleanFormulaTreeNode node)
           
 void replaceNode(java.lang.Long oldNodeHandle, BooleanFormulaTreeNode newNode)
           
 java.lang.Long selectRandomNode(GAParameterSet params)
           
 java.lang.Long selectRootNode()
           
 void setFitness(Fitness fitness)
          Sets the fitness.
 java.lang.String toString()
          Produces a string representation of this individuial.
 java.lang.String toString(boolean infix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numberOfParameters

private int numberOfParameters

fitness

private Fitness fitness

nodes

private java.util.HashMap nodes

root

private BooleanFormulaTreeNode root

nextHandleToGenerate

private long nextHandleToGenerate
Constructor Detail

BooleanFormulaTree

private BooleanFormulaTree()

BooleanFormulaTree

public BooleanFormulaTree(int numberOfParameters)
Method Detail

generateNewHandle

private java.lang.Long generateNewHandle()

getFitness

public Fitness getFitness()
Description copied from interface: Individual
Gets the individual's fitness.

Specified by:
getFitness in interface Individual
Returns:
The fitness object assosiated with this individual or null if no fitness is associated.

setFitness

public void setFitness(Fitness fitness)
Description copied from interface: Individual
Sets the fitness.

Specified by:
setFitness in interface Individual
Parameters:
fitness - The new fitness for this individual.

getNumberOfParameters

public int getNumberOfParameters()

selectRootNode

public java.lang.Long selectRootNode()

getNodeCount

public int getNodeCount()

selectRandomNode

public java.lang.Long selectRandomNode(GAParameterSet params)

getHandlersIterator

public java.util.Iterator getHandlersIterator()

exportNode

public BooleanFormulaTreeNode exportNode(java.lang.Long handle)

getNodeDepth

public int getNodeDepth(java.lang.Long handle)

getNodeHeight

public int getNodeHeight(java.lang.Long handle)

getNode

private BooleanFormulaTreeNode getNode(java.lang.Long handle)

replaceNode

public void replaceNode(java.lang.Long oldNodeHandle,
                        BooleanFormulaTreeNode newNode)

evaluate

public boolean evaluate(boolean[] parameters)

toString

public java.lang.String toString()
Description copied from interface: Individual
Produces a string representation of this individuial.

Specified by:
toString in interface Individual
Overrides:
toString in class java.lang.Object
Returns:
A string (mostly, human readable) representing this individual.

toString

public java.lang.String toString(boolean infix)

removeFromNodeList

private void removeFromNodeList(BooleanFormulaTreeNode node)

addToNodeList

private void addToNodeList(BooleanFormulaTreeNode node,
                           int depth)

JAGA Homepage

Go to JAGA Homepage