Meta::MAgent Class Reference

Symbolic manipulation, function reduction, machine learning, code evolution, and stochastic functions. More...

#include <MAgent.h>

Inheritance diagram for Meta::MAgent:
Meta::MObject Meta::MProcessor

List of all members.

Public Member Functions

 MAgent ()
 MAgent (const MAgent &agent)
 MAgent (const mvar &v, RestoreOpt opt)
 MAgent (MBrokerBase *broker)
virtual ~MAgent ()
virtual void store (mvar &v) const
virtual MObjectclone () const
virtual mnode process (mnode n, uint32_t flags=0)
bool configure (const mvar &args)
mnode Tell_ (mnode fact)
mnode Tell_ (mnode relation, mnode value)
mnode Tell_ (mnode condition, mnode relation, mnode value)
mnode Tell_ (mnode condition, mnode relation, mnode value, mnode post)
mnode Ask_ (mnode query)
mnode Reduce_ (mnode f)
mnode Objective_ (mnode f, mnode train, mnode prods, mnode population, mnode maxDepth, mnode evalTimeout=5.0, mnode mutationRate=0.05, mnode constMutationRate=0.0, mnode selectionPressure=0.5)
mnode Objective_ (mnode f, mnode train, mnode layers, mnode height)
mnode ObjectiveError_ (mnode f)
mnode DeleteObjective_ (mnode f)
mnode Objectives_ ()
mnode Evolve_ (mnode f, mnode maxTime, mnode targetError=0.0)
mnode Evaluate_ (mnode f)
mnode Sample_ (mnode f, mnode ranges, mnode count)
mnode Sample_ (mnode f, mnode g, mnode ranges, mnode count)
mnode SetSeed_ (mnode seed)
mnode TimeSeed_ ()
mnode Uniform_ ()
mnode Uniform_ (mnode a, mnode b)
mnode Exponential_ (mnode x)
mnode Normal_ (mnode m, mnode s)
mnode Erlang_ (mnode n, mnode x)
mnode Pareto_ (mnode k, mnode a)
mnode Lognormal_ (mnode a, mnode b)
mnode Chisquare_ (mnode n)
mnode Bernoulli_ (mnode p)
mnode Equilikely_ (mnode a, mnode b)
mnode Binomial_ (mnode n, mnode p)
mnode Geometric_ (mnode p)
mnode Pascal_ (mnode n, mnode p)
mnode Poisson_ (mnode m)
mnode Permutations_ (mnode f)
mnode Permutations_ (mnode f, mnode k)
mnode Depth_ (mnode f)
mnode MM_ (mnode f)
mnode MMC_ (mnode f)
mnode MMX_ (mnode f)
mnode Time_ ()

Friends

class MAgent_

Detailed Description

Symbolic manipulation, function reduction, machine learning, code evolution, and stochastic functions.

MAgent is the preferred class to use for M interpretation. It provides symbolic manipulation, mathematical function reduction, and code evolution using genetic programming, neural networks, and other machine learning techniques. MAgent provides a limited knowledge base that may be utilized via Tell() and Ask().

In addition, the agent includes functions for interfacing with Mathematica if it is available on your machine: just set the "mMMPath" config to the path of your "math" command. Although the agent may be used to interface with Mathematica, no part of the MAgent implemenation makes use of or requires Mathematica -- except for those functions named MMxxx.

Functional versions of the stochastic methods in MRandom are made available here. MAgent is fully storeable and restoreable. In most cases, agent should be run in non-strict mode, see MObject::setStrict(). Exact mode may also be desired, see MObject::setExact().


Constructor & Destructor Documentation

Meta::MAgent::MAgent (  ) 

Constructor.

Meta::MAgent::MAgent ( const MAgent agent  ) 

Copy constructor.

Meta::MAgent::MAgent ( const mvar v,
RestoreOpt  opt 
)

Restore constructor.

Meta::MAgent::MAgent ( MBrokerBase broker  ) 

Remote object constructor - do not call directly.

virtual Meta::MAgent::~MAgent (  )  [virtual]

Destructor.


Member Function Documentation

mnode Meta::MAgent::Ask_ ( mnode  query  ) 

Query the agent.

Parameters:
query e.g: LT(x,10)
Returns:
True or False (False if undetermined).
mnode Meta::MAgent::Bernoulli_ ( mnode  p  ) 
mnode Meta::MAgent::Binomial_ ( mnode  n,
mnode  p 
)
mnode Meta::MAgent::Chisquare_ ( mnode  n  ) 
virtual MObject* Meta::MAgent::clone (  )  const [virtual]

Return a copy of this agent.

Reimplemented from Meta::MObject.

bool Meta::MAgent::configure ( const mvar args  ) 

Configure the agent based on args.

Returns:
true if successful.
mnode Meta::MAgent::DeleteObjective_ ( mnode  f  ) 

Delete the specified objective function.

Parameters:
f objective function, e.g: f(x,y)
mnode Meta::MAgent::Depth_ ( mnode  f  ) 

Return the depth of function f.

mnode Meta::MAgent::Equilikely_ ( mnode  a,
mnode  b 
)
mnode Meta::MAgent::Erlang_ ( mnode  n,
mnode  x 
)
mnode Meta::MAgent::Evaluate_ ( mnode  f  ) 

Explicitly evaluate an objective function. Usually this function does not need to be called directly.

mnode Meta::MAgent::Evolve_ ( mnode  f,
mnode  maxTime,
mnode  targetError = 0.0 
)

Evolve an objective function. Upon completion the best solution is set to the objective function in the agent's scope.

Parameters:
f The objective function, e.g: f(x,y)
maxTime Maximum number of seconds to evolve for.
targetError Stop upon reaching this error.
Returns:
The current error of the objective.
mnode Meta::MAgent::Exponential_ ( mnode  x  ) 
mnode Meta::MAgent::Geometric_ ( mnode  p  ) 
mnode Meta::MAgent::Lognormal_ ( mnode  a,
mnode  b 
)
mnode Meta::MAgent::MM_ ( mnode  f  ) 

Execute a function in Mathematica.

mnode Meta::MAgent::MMC_ ( mnode  f  ) 

Display the Mathematica code for function f.

mnode Meta::MAgent::MMX_ ( mnode  f  ) 

Convert f to Mathematica function syntax without translating functions.

mnode Meta::MAgent::Normal_ ( mnode  m,
mnode  s 
)
mnode Meta::MAgent::Objective_ ( mnode  f,
mnode  train,
mnode  layers,
mnode  height 
)

Neural-network based evolver using supervised learning.

Parameters:
f The objective function to be evolved, e.g: f(x,y)
train the training set, e.g: [[f:4.23954, x:0.97627, y:1.85689],[f:14.3957, x:4.30379, y:6.88531]]
layers The number of hidden layers in the network.
height The height of each hidden layer.
mnode Meta::MAgent::Objective_ ( mnode  f,
mnode  train,
mnode  prods,
mnode  population,
mnode  maxDepth,
mnode  evalTimeout = 5.0,
mnode  mutationRate = 0.05,
mnode  constMutationRate = 0.0,
mnode  selectionPressure = 0.5 
)

Specify an objective to be evolved using genetic programming techniques. Supervised or unsupervised learning may be used.

Parameters:
f The output function name to be evolved, e.g: f(x,y)
train The training set of inputs and outputs, e.g: for supervised learning: [[f:4.23954, x:0.97627, y:1.85689],[f:14.3957, x:4.30379, y:6.88531]], for unsupervised learning: [[f:evalFunc(), x:0.97627, y:1.85689],[f:evalFunc(), x:4.30379, y:6.88531]].
prods The production rules / grammar, e.g: [[A,[A+A, A-A, A*A, A/A, B]],[B,[1,2,x,y]]], where production symbols are in all-caps and the first rule gives the start production.
population The population size -- larger populations run slower and require more memory but provide greater diversity and potentially better solutions. If an objective fails to find an adequate solution, increasing population should be one of the first things to try.
maxDepth Limits the complexity of the output solution. It determines the number of productions that can be selected before a terminal is chosen.
evalTimeout The maximum number of seconds to evaluate each solution over all of its inputs for. If the evaluation times out, its error is set to infinity.
mutationRate The mutation rate per population. 0..1.0
constMutationRate Constant mutation rate per population. Mutates floating point constants. 0..1.0
selectionPressure Higher values favor more strongly the selection of solutions with less error. 0..1.0
mnode Meta::MAgent::ObjectiveError_ ( mnode  f  ) 
Parameters:
f Objective function, e.g: f(x,y)
Returns:
The last error associated with evolving an objective function.
mnode Meta::MAgent::Objectives_ (  ) 
Returns:
A listing of the objectives and their parameters.
mnode Meta::MAgent::Pareto_ ( mnode  k,
mnode  a 
)
mnode Meta::MAgent::Pascal_ ( mnode  n,
mnode  p 
)
mnode Meta::MAgent::Permutations_ ( mnode  f,
mnode  k 
)

Enumerate permutations, choosing k.

Parameters:
f e.g: [1,2,3]
k e.g: 2
Returns:
e.g: ([1,2],[2,1],[3,1],[1,3],[2,3],[3,2])
mnode Meta::MAgent::Permutations_ ( mnode  f  ) 

Enumerate permutations.

Parameters:
f e.g: [1,2,3]
Returns:
e.g: ([1,2,3],[2,1,3],[3,1,2],[1,3,2],[2,3,1],[3,2,1])
mnode Meta::MAgent::Poisson_ ( mnode  m  ) 
virtual mnode Meta::MAgent::process ( mnode  n,
uint32_t  flags = 0 
) [virtual]

Process method.

Reimplemented from Meta::MObject.

mnode Meta::MAgent::Reduce_ ( mnode  f  ) 

Reduce a mathematical function.

Parameters:
f e.g: 1 + y + 2*y + 3*z / 22*z + 99
Returns:
e.g: 100 + 3 * y + 3/22 * z^2
mnode Meta::MAgent::Sample_ ( mnode  f,
mnode  g,
mnode  ranges,
mnode  count 
)

Identical to Sample(3) but make the output function g.

Parameters:
g e.g: g(x,y)
mnode Meta::MAgent::Sample_ ( mnode  f,
mnode  ranges,
mnode  count 
)

Sample a function over the specified inputs ranges, for count times. Useful for generating an objective test training set.

Parameters:
f e.g: f(x,y)
ranges e.g: [[-10,10], [5,10]]
count Number of samples to return.
Returns:
e.g: [[f:1.90472, x:0.97627, y:0.928446],[f:7.74644, x:4.30379, y:3.44266]]
mnode Meta::MAgent::SetSeed_ ( mnode  seed  ) 

Seed the agent's random number generator.

Parameters:
seed is 0..18446744073709551615
virtual void Meta::MAgent::store ( mvar v  )  const [virtual]

Store this agent to v.

Reimplemented from Meta::MObject.

mnode Meta::MAgent::Tell_ ( mnode  condition,
mnode  relation,
mnode  value,
mnode  post 
)

Tell the agent a relation has the specified value whenever condition is true thereby executing the post function.

Parameters:
condition Eq(x,2)
relation e.g: Mul(x,y)
value e.g: 8
post e.g: Inc(x)
Returns:
true on success.
mnode Meta::MAgent::Tell_ ( mnode  condition,
mnode  relation,
mnode  value 
)

Tell the agent a relation has the specified value whenever condition is true.

Parameters:
condition e.g: Eq(x,2)
relation e.g: Mul(x,y)
value e.g: 8
Returns:
true on success.
mnode Meta::MAgent::Tell_ ( mnode  relation,
mnode  value 
)

Tell the agent that a relation has the specified value.

Parameters:
relation e.g: Add(x,y)
value e.g: 8
Returns:
true on success.
mnode Meta::MAgent::Tell_ ( mnode  fact  ) 

Tell the agent a fact.

Parameters:
fact e.g: IsCommutative(Add)
Returns:
true on success.
mnode Meta::MAgent::Time_ (  ) 

Return time since the UNIX epoch in seconds + microseconds.

mnode Meta::MAgent::TimeSeed_ (  ) 

Seed the agent's random number generator with the current time.

mnode Meta::MAgent::Uniform_ ( mnode  a,
mnode  b 
)
mnode Meta::MAgent::Uniform_ (  ) 

The documentation for this class was generated from the following file:

Generated on Wed Mar 24 16:22:42 2010 for AndroMeta by  doxygen 1.6.1