-
Notifications
You must be signed in to change notification settings - Fork 24
MTree
MTrees are data structures that define mathematical functions.
One particularly useful aspect of MTrees is that they can be defined by and converted into strings.
Some Parameters will use MTrees so that the user can define complex behavior.
for example...
optimizeValue = POW[1.05,DM_AVE[score]]
... sets optimizeValue to 1.05 raised to the power of the score in the DataMap of the organism being evaluated.
another example...
optimizeValue = (DM_AVE[score]*(10-DM_AVE[gates]))
... sets optimizeValue to the score in the DataMap of the organism being evaluated times 10 minus the number of gates in that organism (assumes that the organism has gates - i.e. markov brains). That is optimization should be based on score and having fewer gates.
You can construct an MTree from a string with:
myMT= stringToMTree("DM_AVE[score]*(10-DM_AVE[gates])");
When you want to evaluate an MTree, you call the eval function on the MTree.
double opVal = myMT->eval(dataMap, PT, vect)[0];
where dataMap is some DataMap, PT is a parameters table, and vect is a vector<vector<double>>.
You can leave out any of the parameters if they are not needed (see below for how dataMap, PT, and vect are used in an MTree.)
- CONST[x]
- returns x. x without CONST[] can be used in place of CONST[x]
- SUM[x,y,x,...]
- sums all elements in brackets
- MULT[x,y,x,...]
- multiples all elements in brackets
- SUBTRACT[x,y]
- subract y from x
- DIVIDE[x,y]
- divide x by y
- POW[x,y]
- x to the y power
- SIN[x]
- return sine of x
- COS[x]
- return cosine of x
- RANDOM[x,y]
- generate a random number between x and y
- UPDATE[]
- return the current value of GLOBAL::update
- DM_AVE["key_name"]
- if a (DataMap)[DataMap] is passed when MTree.evaluate is called then return the average of the values associated with "key_name"
- DM_SUM["key_name"]
- if a (DataMap)[DataMap] is passed when MTree.evaluate is called then return the sum of the values associated with "key_name"
- MANY[x,y,z,...]
- returns a vector with the values of {x,y,z,...}
- VECT[x,y]
- if a Vector> is passed when MTree.evaluate is called, then return the value in vect[x][y] (this can be used to provide access to values that are only known at runtime.)
- IF[x,y,z]
- if x > 0 then y else z
- MIN[x,y]
- lesser of x and y
- MAX[x,y]
- greaterof x and y
- REMAP[x,y,z,a,b]
- if one argument, return x clamped [0,1]
- if three arguments, return x clamped [y,z] and scaled to [0,1]
- if five arguments, return x clamped [y,z] and scaled to [a,b]
- SIGMOID[x,y,z,a]
- returns value in range [0,1]
- with 2 arguments, x is value to remap, y is strength of sigmoid function
- with 4 arguments, x will be bounded and scaled to [0,1] by [z,a] before sigmod function is applied.
- MOD[x,y]
- x % y
- ABS[x]
- absolute value of x
MULT[x,y,z...] and SUM[x,y,z...] can be replaced by (xyz...) and (x+y+z...) respectively.
x,y,z, etc. can be other functions but within parathesis, there can only be one type of operator. MTree has no definition of order of operations, the user must resolve this with parathesis.
SUB[x,y], DIVIDE[x,y] and POW[x,y] can be replaced by (x-y), (x/y) and, (x^y) respectively as in MULT and SUM, with the exception that only two terms are allowed.
home
welcome
MABE Parameter Widget
Installation and quick start
license
citations
release notes
developer contributions
consistency testing
Using MABE
Using Settings Files
Output Files
Creating Graphs with python
MABE framework
Defining Update
Brains
Markov Brain
Neuron Gate
Wire Brain
Human Brain
ConstantValues Brain
CGP Brain
Genetic Programing Brain
Artificial Neural Networks
Brains Structure and Connectome
Genomes
Circular Genome
Multi Genome
Genome Handlers
Genome Value Conversions
Organisms
Groups
Archivists
popFileColumns
Optimizers
Lexicase Optimizer
Worlds
Berry World
ComplexiPhi World
MultiThreadTemplate World
Utilities
DataMap
Parameters
Parameters Name Space
Adding Parameters to Code
ParametersTable
MTree
sequence function
Population Loading
PythonTools
MBuild
MGraph
MQ
findRelatedness
generatePhylogeny
Information Theory Tools
Brain States and Life Times
TimeSeries
Entropy Functions
Smearing
Fragmentation
State to State
Brain Infomation Tools
ProcessingTools