java.lang.Object
exptree.utilities.generator
- public class generator
- extends java.lang.Object
Creates a randomly generated mathematic expression and places it in an expressionTree.
The generation process is influenced by several parameters contain in a globalSettings object.
The most significant are the properties "complexity," "depreciation," and "variable.probability."
The complexity value determines how likely the node being produced is to be a terminal node, where
the lower complexity's value, the more likely it is to be terminal. Depreciation is a value that
is subtracted from complexity at each level of the tree, to ensure the generation process will end
within a reasonable number of tree levels. The variable.probability determines how likely a terminal
node is to be a value or a variable, where higher values mean variables are more likely to occur
than values.
All three of these settings should fall in the range of 0.0 to 1.0. Depreciation, however, should never
actually be 0.0.
- Version:
- 1.1 08/19/2000
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
variables
variablePackage variables
- The variables the generated expression may use.
settings
settings.globalSettings settings
- The user defined settings that influence the generation of expressions.
list
exptree.operators.operatorInterface[] list
- A list of the available operators.
generator
public generator(settings.globalSettings s,
variablePackage v)
- Class constructor which sets the object's settings and variablePackage.
generate
public exptree.expressionTree generate(java.util.Random randomNumber)
- Returns a generated expressionTree based on the given Random object.
generate
public exptree.expressionTree generate(double level,
java.util.Random randomNumber)
- Returns a generated expressionTree based ont he given Random object, starting at the levelth level of the tree.
pickRandomOp
exptree.operators.operatorInterface pickRandomOp(java.util.Random whichOp)
- Returns a randomly chosen operatorInterface object.