Package | Description |
---|---|
org.oakgp |
A tree-based genetic programming framework.
|
org.oakgp.evolve |
Provides classes to use techniques inspired by biological evolution for the creation of new candidates from an existing generation.
|
org.oakgp.evolve.crossover |
Provides classes for combining existing
Node instances to create (evolve) new instances. |
org.oakgp.evolve.mutate |
Provides classes for mutating existing
Node instances to create (evolve) new instances. |
org.oakgp.function |
Provides functions that accept arguments and produce a result.
|
org.oakgp.function.choice |
Provides functions for selection.
|
org.oakgp.function.compare |
Provides functions for comparing the results of evaluating
Node instances. |
org.oakgp.generate |
Provides classes for the creation of an initial population.
|
org.oakgp.node |
Provides classes that can be used to construct hierarchical tree structures.
|
org.oakgp.node.walk |
Provides mechanisms for recursively visiting nodes in a tree structure.
|
org.oakgp.primitive |
Provides classes for specifying the contents of a primitive set.
|
org.oakgp.rank |
Provides classes for the evaluation and ranking of candidates in a generation.
|
org.oakgp.rank.fitness |
Provides classes for using a fitness function to rank the candidates of a generation.
|
org.oakgp.rank.tournament |
Provides classes for using a round-robin tournament to rank the candidates of a generation.
|
org.oakgp.select |
Provides classes for the selection of
Node instances. |
org.oakgp.serialize |
Provides class for the serialisation and deserialisation of
Node instances. |
org.oakgp.util |
Utility classes that support the functionality provided by the rest of the framework.
|
Modifier and Type | Method and Description |
---|---|
Node |
Arguments.firstArg()
Returns the first argument in this
Arguments . |
Node |
Arguments.getArg(int index)
Returns the
Node at the specified position in this Arguments . |
Node |
Arguments.secondArg()
Returns the second argument in this
Arguments . |
static Node |
NodeSimplifier.simplify(Node input)
Attempts to reduce the size of the specified tree structures without altering its functionality.
|
Node |
Arguments.thirdArg()
Returns the third argument in this
Arguments . |
Modifier and Type | Method and Description |
---|---|
static Arguments |
Arguments.createArguments(Node... args)
Returns a new
Arguments which contains the specified values. |
Arguments |
Arguments.replaceAt(int index,
Node replacement)
Returns a new
Arguments resulting from replacing the existing Node at position index with replacement . |
static Node |
NodeSimplifier.simplify(Node input)
Attempts to reduce the size of the specified tree structures without altering its functionality.
|
Modifier and Type | Method and Description |
---|---|
static Arguments |
Arguments.createArguments(List<? extends Node> args)
Returns a new
Arguments which contains the specified values. |
Modifier and Type | Method and Description |
---|---|
Node |
GeneticOperator.evolve(NodeSelector selector)
Returns a new
Node evolved from existing instances. |
Modifier and Type | Method and Description |
---|---|
Collection<Node> |
GenerationEvolverImpl.evolve(RankedCandidates oldGeneration)
Returns a new generation of
Node instances evolved from the specified existing generation. |
Collection<Node> |
GenerationEvolver.evolve(RankedCandidates oldGeneration)
Returns a new generation of
Node instances evolved from the specified existing generation. |
Modifier and Type | Method and Description |
---|---|
Node |
SubtreeCrossover.evolve(NodeSelector selector) |
Node |
OnePointCrossover.evolve(NodeSelector selector) |
Modifier and Type | Method and Description |
---|---|
Node |
SubTreeMutation.evolve(NodeSelector selector) |
Node |
ShrinkMutation.evolve(NodeSelector selector) |
Node |
PointMutation.evolve(NodeSelector selector) |
Node |
HoistMutation.evolve(NodeSelector selector) |
Node |
ConstantToFunctionMutation.evolve(NodeSelector selector) |
Modifier and Type | Method and Description |
---|---|
default Node |
Function.simplify(Arguments arguments)
Attempts to find a simplified alternative to applying this function to the specified arguments.
|
Modifier and Type | Method and Description |
---|---|
Node |
SwitchEnum.simplify(Arguments arguments) |
Node |
OrElse.simplify(Arguments arguments) |
Node |
If.simplify(Arguments arguments) |
Modifier and Type | Method and Description |
---|---|
Node |
NotEqual.simplify(Arguments arguments) |
Node |
GreaterThanOrEqual.simplify(Arguments arguments) |
Node |
GreaterThan.simplify(Arguments arguments) |
Node |
Equal.simplify(Arguments arguments) |
Modifier and Type | Method and Description |
---|---|
Node |
TreeGeneratorImpl.generate(Type type,
int depth) |
Node |
TreeGenerator.generate(Type type,
int depth)
Constructs a new tree data structure.
|
Modifier and Type | Class and Description |
---|---|
class |
ConstantNode
Represents a constant value.
|
class |
FunctionNode
Contains a function (operator) and the arguments (operands) to apply to it.
|
class |
VariableNode
Represents a variable.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
NodeType.areFunctions(Node n1,
Node n2)
Returns
true if both of the specified nodes are function nodes, else false . |
static boolean |
NodeType.areTerminals(Node n1,
Node n2)
Returns
true if both of the specified nodes are terminal nodes, else false . |
static boolean |
NodeType.isConstant(Node n)
Returns
true if the specified node is a constant node, else false . |
static boolean |
NodeType.isFunction(Node n)
Returns
true if the specified node is a function node, else false . |
static boolean |
NodeType.isTerminal(Node n)
Returns
true if the specified node is a terminal node, else false . |
static boolean |
NodeType.isVariable(Node n)
Returns
true if the specified node is a variable node, else false . |
Constructor and Description |
---|
FunctionNode(Function function,
Node... arguments)
Constructs a new
FunctionNode with the specified function function and arguments. |
Modifier and Type | Method and Description |
---|---|
Node |
DepthWalk.DepthWalkReplacement.apply(Node node,
int depth) |
static Node |
NodeWalk.getAt(Node node,
int index)
Returns a
Node from the tree structure represented by the given Node . |
static Node |
DepthWalk.getAt(Node current,
int index,
DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static Node |
StrategyWalk.getAt(Node node,
int index,
Predicate<Node> treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static Node |
NodeWalk.replaceAll(Node node,
Predicate<Node> criteria,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing any components that match the specified predicate with the result of applying the specified function. |
static Node |
DepthWalk.replaceAt(Node current,
int index,
DepthWalk.DepthWalkReplacement replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
NodeWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
StrategyWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement,
Predicate<Node> treeWalkerStrategy)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
Modifier and Type | Method and Description |
---|---|
Node |
DepthWalk.DepthWalkReplacement.apply(Node node,
int depth) |
static Node |
NodeWalk.getAt(Node node,
int index)
Returns a
Node from the tree structure represented by the given Node . |
static Node |
DepthWalk.getAt(Node current,
int index,
DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static Node |
StrategyWalk.getAt(Node node,
int index,
Predicate<Node> treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static int |
DepthWalk.getNodeCount(Node tree,
DepthWalk.DepthWalkStrategy treeWalkerStrategy)
Returns the total number of nodes contained in the tree-structure represented by the given
Node that match the specified predicate. |
static int |
StrategyWalk.getNodeCount(Node node,
Predicate<Node> treeWalkerStrategy)
Returns the total number of nodes contained in the tree-structure represented by the given
Node that match the specified predicate. |
static Node |
NodeWalk.replaceAll(Node node,
Predicate<Node> criteria,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing any components that match the specified predicate with the result of applying the specified function. |
static Node |
DepthWalk.replaceAt(Node current,
int index,
DepthWalk.DepthWalkReplacement replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
NodeWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
StrategyWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement,
Predicate<Node> treeWalkerStrategy)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
boolean |
DepthWalk.DepthWalkStrategy.test(Node node,
int depth) |
Modifier and Type | Method and Description |
---|---|
static Node |
StrategyWalk.getAt(Node node,
int index,
Predicate<Node> treeWalkerStrategy)
Returns a
Node from the tree structure represented by the given Node that matches the specified predicate. |
static int |
StrategyWalk.getNodeCount(Node node,
Predicate<Node> treeWalkerStrategy)
Returns the total number of nodes contained in the tree-structure represented by the given
Node that match the specified predicate. |
static Node |
NodeWalk.replaceAll(Node node,
Predicate<Node> criteria,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing any components that match the specified predicate with the result of applying the specified function. |
static Node |
NodeWalk.replaceAll(Node node,
Predicate<Node> criteria,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing any components that match the specified predicate with the result of applying the specified function. |
static Node |
NodeWalk.replaceAll(Node node,
Predicate<Node> criteria,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing any components that match the specified predicate with the result of applying the specified function. |
static Node |
NodeWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
NodeWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
StrategyWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement,
Predicate<Node> treeWalkerStrategy)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
StrategyWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement,
Predicate<Node> treeWalkerStrategy)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
static Node |
StrategyWalk.replaceAt(Node node,
int index,
Function<Node,Node> replacement,
Predicate<Node> treeWalkerStrategy)
Returns a new
Node resulting from replacing the Node at position index of the given Node with the result of
replacement . |
Modifier and Type | Method and Description |
---|---|
Node |
PrimitiveSetImpl.nextAlternativeTerminal(Node current)
Returns a randomly selected terminal node that is not the same as the specified
Node . |
Node |
PrimitiveSet.nextAlternativeTerminal(Node current)
Returns a randomly selected terminal node that is not the same as the specified
Node . |
Node |
PrimitiveSetImpl.nextTerminal(Type type)
Returns a randomly selected terminal node.
|
Node |
PrimitiveSet.nextTerminal(Type type)
Returns a randomly selected terminal node.
|
Modifier and Type | Method and Description |
---|---|
Node |
PrimitiveSetImpl.nextAlternativeTerminal(Node current)
Returns a randomly selected terminal node that is not the same as the specified
Node . |
Node |
PrimitiveSet.nextAlternativeTerminal(Node current)
Returns a randomly selected terminal node that is not the same as the specified
Node . |
Modifier and Type | Method and Description |
---|---|
Node |
RankedCandidate.getNode() |
Modifier and Type | Method and Description |
---|---|
RankedCandidates |
GenerationRanker.rank(Collection<Node> input)
Returns the sorted result of evaluating the fitness of each of the specified nodes.
|
Constructor and Description |
---|
RankedCandidate(Node node,
double fitness)
Creates a
RankedCandidate which associates the given Node with the given fitness value. |
Modifier and Type | Method and Description |
---|---|
double |
TestDataFitnessFunction.evaluate(Node node)
Evaluates the specified
Node using the test data specified when this FitnessFunction was constructed. |
double |
FitnessFunctionCache.evaluate(Node n) |
double |
FitnessFunction.evaluate(Node n)
Returns the fitness of the solution represented by the given
Node . |
Modifier and Type | Method and Description |
---|---|
RankedCandidates |
FitnessFunctionGenerationRanker.rank(Collection<Node> input)
Returns the sorted result of applying this object's
FitnessFunction against each of the specified nodes. |
Modifier and Type | Method and Description |
---|---|
double |
TwoPlayerGameCache.evaluate(Node player1,
Node player2) |
double |
TwoPlayerGame.evaluate(Node player1,
Node player2)
Determines the outcome of the two specified players competing against each other.
|
double |
FirstPlayerAdvantageGame.evaluate(Node player1,
Node player2) |
Modifier and Type | Method and Description |
---|---|
RankedCandidates |
RoundRobinTournament.rank(Collection<Node> input) |
Modifier and Type | Method and Description |
---|---|
Node |
RankSelection.next() |
Node |
NodeSelector.next()
Returns a
Node . |
Node |
FitnessProportionateSelection.next() |
Modifier and Type | Method and Description |
---|---|
Node |
NodeReader.readNode()
Creates and returns a
Node which represents the next s-expression read from the input. |
Modifier and Type | Method and Description |
---|---|
String |
NodeWriter.writeNode(Node node)
Returns a
String representation of the specified Node . |
Modifier and Type | Method and Description |
---|---|
static <T extends Node> |
Utils.groupByType(T[] nodes)
Returns a map grouping the specified nodes by their
Type . |
Modifier and Type | Method and Description |
---|---|
boolean |
NodeSet.add(Node n)
Adds the simplified version of the specified
Node to this set if it is not already present. |
int |
NodeComparator.compare(Node o1,
Node o2) |
static <T extends Node> |
Utils.groupByType(T[] nodes)
Returns a map grouping the specified nodes by their
Type . |
static boolean |
Void.isVoid(Node n)
Returns
true if the given node is a constant node containing Void.VOID . |
static int |
Utils.selectSubNodeIndex(Random random,
Node tree)
Returns randomly selected index of a node from the specified tree.
|
Modifier and Type | Method and Description |
---|---|
static RankedCandidates |
Runner.process(GenerationRanker generationRanker,
GenerationEvolver generationEvolver,
Predicate<RankedCandidates> terminator,
Collection<Node> initialPopulation)
Performs a Genetic Programming run.
|
RunBuilder.GenerationEvolverSetter |
RunBuilder.InitialPopulationSetter.setInitialPopulation(Function<RunBuilder.Config,Collection<Node>> initialPopulation)
Set the contents of the initial population.
|
OakGP Genetic Programming Framework