|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mov.analyser.gp.Mutator
public class Mutator
The mutator can build random expressions and randomly mutate existing expressions. This class is at the heart of the GP as it creates the random buy and sell rules and combines the rules during "breeding".
Individual
,
GeneticProgramme
Constructor Summary | |
---|---|
Mutator(java.util.Random random,
GPGondolaSelection GPGondolaSelection,
boolean allowHeld,
boolean allowOrder)
Create a new mutator. |
Method Summary | |
---|---|
Expression |
createRandom(Expression model,
int type,
int subType,
int level)
Create a new random expression based on mutating the given expression. |
Expression |
createRandom(int type)
Create a new random expression of the given type. |
Expression |
createRandom(int type,
int subType)
Create a new random expression of the given type and subType. |
Expression |
createRandom(int type,
int subType,
int level)
Create a new random expression of the given type,subType at the given level. |
Expression |
createRandomNonTerminal(Expression model,
int type,
int subType,
int level)
Create a new random non-terminal expression based on mutating the given expression. |
Expression |
createRandomNonTerminal(int type)
Create a new random non-terminal expression of the given type. |
Expression |
createRandomNonTerminal(int type,
int subType)
Create a new random non-terminal expression of the given type and subType. |
Expression |
createRandomNonTerminal(int type,
int subType,
int level)
Create a new random non-terminal expression of the given type and subType at the given level. |
Expression |
createRandomTerminal(int type)
Creates a random terminal expression of the given type. |
Expression |
createRandomTerminal(int type,
int subType)
Creates a random terminal expression of the given type and subType. |
Expression |
delete(Expression root,
Expression destination)
Perform a deletion mutation on the given expression. |
Expression |
findRandomSite(Expression expression)
Randomly pick a node in the given expression. |
Expression |
findRandomSite(Expression expression,
int type)
Randomly pick a node of the given type in the given expression. |
Expression |
insert(Expression root,
Expression destination,
Expression source)
Perform an insertion mutation on the given expression. |
Expression |
modify(Expression root,
Expression destination)
Perform a modification mutation on the given expression. |
Expression |
mutate(Expression expression)
Possibly mutate the given expression. |
Expression |
mutate(Expression expression,
int percent)
Possibly mutate the given expression |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mutator(java.util.Random random, GPGondolaSelection GPGondolaSelection, boolean allowHeld, boolean allowOrder)
random
- use this random number generatorGPGondolaSelection
- UI containing user's desired expression probabilitiesallowHeld
- allow the creation of the held
variableallowOrder
- allow the creation of the order
variableMethod Detail |
---|
public Expression createRandom(int type)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
public Expression createRandom(int type, int subType)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.
public Expression createRandom(int type, int subType, int level)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.level
- the level in the tree
public Expression createRandom(Expression model, int type, int subType, int level)
level < 1
then the top node of the created expression
will not be terminal.
model
- initial expression to work withtype
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.level
- the level in the tree
createRandom(int type, int subType, int level)
public Expression createRandomNonTerminal(int type)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
public Expression createRandomNonTerminal(int type, int subType)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.
public Expression createRandomNonTerminal(int type, int subType, int level)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.level
- the level in the tree
public Expression createRandomNonTerminal(Expression model, int type, int subType, int level)
model
- initial expression to work withtype
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.level
- the level in the tree
createRandom(int type, int subType, int level)
public Expression createRandomTerminal(int type)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
public Expression createRandomTerminal(int type, int subType)
type
- the type of the expression, e.g. Expression.BOOLEAN_TYPE
subType
- the subType of the expression.
public Expression findRandomSite(Expression expression)
expression
- the expression to search
public Expression findRandomSite(Expression expression, int type)
expression
- the expression nodetype
- the type of the node, e.g. Expression.BOOLEAN_TYPE
null
if one could not be foundpublic Expression delete(Expression root, Expression destination)
root
- the root of the expression being mutateddestination
- the destination site for the deletion
public Expression insert(Expression root, Expression destination, Expression source)
root
- the root of the expression being mutateddestination
- the destination site for the insertionsource
- the expression to insert
delete(Expression root, Expression destination)
public Expression modify(Expression root, Expression destination)
root
- the root of the expression being mutateddestination
- the destination site for the modification
delete(Expression root, Expression destination)
public Expression mutate(Expression expression)
expression
- the root of the expression to modify
public Expression mutate(Expression expression, int percent)
expression
- the root of the expression to modifypercent
- percent change of mutation
|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |