|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectec.gp.GPFunctionSet
ec.gp.build.PTCFunctionSet
PTCFunctionSet is a GPFunctionSet which adheres to PTCFunctionSetForm, and thus can be used with the PTC1 and PTC2 methods. Terminal and nonterminal probabilities for nodes used in this function set are determined by the prob parameter for the nodes' GPNodeConstraints object. That's not the greatest solution, because it could require making a lot of different GPNodeConstraints, customized for each node, but it's the best I can do for now. The nonterminalSelectionProbabilities() method computes nonterminal selection probability using the probabilities above, per type, for the size requested. If the size is small enough (smaller than CACHE_SIZE), then the result is memoized so it doesn't need to be computed again next time.
Field Summary | |
static int |
CACHE_SIZE
|
float[][] |
p_y
cache of nonterminal selection probabilities -- dense array [size-1][type]. |
float[][] |
q_ny
nonterminal probabilities[type][thenodes], in organized form |
float[][] |
q_ty
terminal probabilities[type][thenodes], in organized form |
Fields inherited from class ec.gp.GPFunctionSet |
name, nodes, nodes_h, nodesByArity, nonterminals, nonterminals_h, nonterminalsOverArity, nonterminalsUnderArity, P_FUNC, p_funcinfo, P_FUNCINFO, P_NAME, P_SIZE, terminals, terminals_h |
Constructor Summary | |
PTCFunctionSet()
|
Method Summary | |
float[] |
computeNonterminalSelectionProbabilities(int expectedTreeSize)
|
float[] |
nonterminalProbabilities(int type)
Returns an organized distribution (see ec.util.RandomChoice) of likelihoods that various nonterminals in the function set will be chosen over other nonterminals with the same return type. |
float[] |
nonterminalSelectionProbabilities(int expectedTreeSize)
Returns an array (by return type) of the probability that PTC1 must pick a nonterminal over a terminal in order to guarantee the expectedTreeSize. |
void |
setup(EvolutionState state,
Parameter base)
Must be done after GPType and GPNodeConstraints have been set up |
float[] |
terminalProbabilities(int type)
Returns an organized distribution (see ec.util.RandomChoice) of likelihoods that various terminals in the function set will be chosen over other terminals with the same return type. |
Methods inherited from class ec.gp.GPFunctionSet |
functionSetFor, postProcessFunctionSet, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public float[][] q_ty
public float[][] q_ny
public static final int CACHE_SIZE
public float[][] p_y
Constructor Detail |
public PTCFunctionSet()
Method Detail |
public float[] terminalProbabilities(int type)
PTCFunctionSetForm
terminalProbabilities
in interface PTCFunctionSetForm
public float[] nonterminalProbabilities(int type)
PTCFunctionSetForm
nonterminalProbabilities
in interface PTCFunctionSetForm
public void setup(EvolutionState state, Parameter base)
GPFunctionSet
setup
in interface Setup
setup
in class GPFunctionSet
public float[] nonterminalSelectionProbabilities(int expectedTreeSize)
PTCFunctionSetForm
nonterminalSelectionProbabilities
in interface PTCFunctionSetForm
public float[] computeNonterminalSelectionProbabilities(int expectedTreeSize)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |