AndroMeta is a software platform for technical and scientific computing which spans a diverse range of fields: from machine learning and artificial intelligence in general, distributed and concurrent computing, language design, to modeling and simulation -- all of which are unified into a powerful yet easy-to-use C++ framework. The constructs that make up AndroMeta’s specialized higher-level functionality are all made available as general-purpose classes. In this way, while AndroMeta’s focuses on technical computing, it may prove to be a valuable tool for general programming situations as well. AndroMeta (pronounced like Andromeda) is available for Mac OS X, 64-bit (x86_64) Linux, and 32-bit (x86) Linux.
The AndroMeta framework is intended to be accessible to C++ users of all levels -- one does not have to be a C++ expert to make nearly full use of the framework, while at the same time it provides enough flexibility for advanced applications. Users may choose to use a multitude of its features or just a few in isolation. AndroMeta is a multi-purpose software system. Some of its intended uses include:





-AndroMeta includes a variety of data type classes, covering numerics, strings, containers, variants, and symbolic nodes.
-These classes provide an extensive library of operations, many taking advantage of C++ operator-overloading.
-The types provide a high degree of interoperability and strike a proper balance between implicit and explicit type conversion.
-MVar, perhaps the most centrally used component of the framework, provides a union of the more basic types, allowing recursion for representation of arbitrarily complex data.
-In many cases MVar alleviates the need for data structures which provides greater dynamic/run-time flexibility and simplifies many common programming situations.
-The following is an example of an MVar with nested data, represented in MML code:
[color:[0.306309,0.885713,0.0972619],
p:[[u:[-5.82034,2.44742,14.1256],
v:[0.0239208,0.214343,-0.0160897]],
[u:[-11.9655,6.41404,9.85531],
v:[-0.0626363,-0.016249,0.403458]],
senderId:372]
-MNode is the most complex type, subsuming all others by adding symbols and recursively defined functions.
-MNode allows code to be constructed and executed dynamically. The following is an example MNode function:
Set(z,Add(Sub(x,1),Mul(2,y)))
-AndroMeta features a powerful graph-based concurrent processing system which is useful in a variety of situations.
-MProc’s are connected to each other to form a “network” where chaining order determines execution sequence whereby parallel execution paths may be formed or joined with other paths.
-The semantics of the MProc system are highly configurable allowing maximum application flexibility and general usability.
-MProc’s signal each other with MVar’s. The signals provide a mapping that the MProc uses to determine whether or not activate when signaled.
-MProc’s once activated, are queued to an associated MProcTask. MProcTask’s coordinate a specific processing goal, providing high-level thread-pooling and queueing with optional application-specific priority. Tasks may be halted, cleared, resumed or waited upon for completion.
-MProc data may be entirely localized, passing state through signals so that several instances of the MProc may run unhindered in parallel.
Data types
Concurrency
Above: A “network” of MProc’s A,B,C,D,E,F, and G are connected as shown. All of which are configured such that they activate upon receiving signals from all of their incoming edges. To start this process, A is queued to the specified MProcTask. MProc A runs and at its completion, signals its outgoing edges, activating B,C, and D. Depending on the queue priority and the number of threads the task was set to run with B,C, and D may essentially run simultaneously, causing a new execution path from B to F to run in parallel to C and D. These parallel execution paths rejoin at G which is not activated until receiving a signal from both F and C. In this scenario, one would typically perform a blocking call to await completion on G.
Networking
Machine Learning and General AI
Miscellaneous
2. MCommunicator offers an easy-to-use socket abstraction allowing arbitrarily complex data in the form of MVar’s to be sent and received asynchronously. The communicator internally handles buffering, encoding/decoding and transmission in compressed binary form.
AndroMeta supports networking in varying levels of complexity allowing applications to choose whichever form is appropriate for a given scenario.
1. The most basic form of networking is accomplished with TCP/IP sockets sending and receiving binary data. MSocket provides a typical socket implementation.
4. AndroMeta leverages its technical foundations as discussed so far to implement the MBroker -- a high performance distributed object broker which allows objects to be distributed and obtained across a TCP/IP network. MObject provides an interface for setting up methods in C++ for remote invocation which is often as simple as:
The peer-to-peer system is flexible enough to be used in a variety of scenarios. The most common scenario is to use the peer-to-peer system as a “cluster”, allowing users to submit a CPU-intensive SIMD program/process to be run on a designated number of peers. The peer-to-peer application uses the MPeerProc class to communicate with the cluster. MPeerProc supports unicast, broadcast, and barrier synchronization operations.
Another scenario is to use the peer-to-peer system in conjunction with an MPeerBroker. This is the most complex and powerful form of networking that AndroMeta supports whereby users perform calls on remote objects as distributed by other peers with communication being routed through the peer-to-peer system.
3. MServer and MClient provide a general-purpose means to implement network client/server applications. Upon receiving or initiating a connection an MNetProc is spawned. MNetProc’s combine the functionality of MCommunicator and MProc to provide a flexible means to implement concurrent and (recurrent) request/response processes.
int CentralObject::increase(int delta){
if(isRemote()){
return remoteProcess(mfunc(“increase”) + mnode(delta));
}
else if(isDistributed()){
mutex_.lock();
int count = sharedCount_ += delta;
mutex_.unlock();
return count;
}
}
The following diagram details the sequence of events that occur when a remote call is performed. To start the process off, externally, increase() is called as if it were any ordinary C++ method, then:
A. MObject’s isRemote() determines that this is a client-side object therefore remoteProcess() is called, forwarding the request to the MBroker.
B. The client’s MBroker communicates the request to the server-side MBroker. The server-side broker forwards the request to the appropriate object.
C. The MObject dispatches the call to the increase() method.
D. MObject’s isDistributed() determines that this is a server-side distributed object. Locking is performed because the server assumes that multiple clients will call increase() simultaneously. increase() returns its value and the communication chain is followed back to the client.
E. Finally, the client receives the return value. If the call included output reference/pointer parameters these would be passed back to the caller as well.
5. AndroMeta features a specialized peer to-peer system as provided by MHub and MPeer which may be run either over a local network to provide a “cluster” or over a wider area network such as the Internet. The hub
provides the meeting place for peers whereby peers connect to a hub in order to receive updates about other connected peers. The hub is capable of connecting and updating a large number of peers as it is a low network-traffic agent which does not provide centralized messaging. For messaging between peers to be possible, they must either be directly reachable over the network in question or there must exist a MPeer that is reachable, connected to the hub which acts as a “router.”
Machine learning and artificial intelligence in general are major drivers in AndroMeta’s development. Building on AndroMeta’s core foundation, MAgent provides the functional backbone for much of AndroMeta’s AI capabilities, adding sophisticated algorithms based on neural networks, genetic algorithms including genetic programming, and more.
Central to this effort, is AndroMeta’s ability to evolve M code. Using supervised learning, MAgent is supplied a training set of data, a grammar which restricts and characterizes the evolved code, and a number of parameters which control the evolutionary process.
MAgent also supports code evolution via unsupervised learning. Usually in this context, the code to be evolved is part of a larger M program. In each iteration, the program is passed the generated code “module”, which it executes in the context of the larger program. Here the program judges its performance in any way appropriate then passes back to MAgent a metric measuring the generated module’s “error.” The evolutionary process may be configured such that it halts upon achieving a desired target error or after a timeout is reached.
Similar to code evolution, AndroMeta provides parameter optimization facilities through MOptRun or as integrated into MML. An optimization run seeks to minimize or maximize a metric, which like unsupervised code evolution, is an application-specific judgement of its running performance given the iteration’s input parameters.
MAgent provides a number of other features, some of which are yet to be fully developed, including:
-The ability to reduce mathematical functions to simpler form.
-Knowledge base support.
-MAgent may be optionally configured so that some of its processing runs through a local AndroMeta peer-to-peer network.
AndroMeta includes a variety of other features which were not covered here, including:
-A mechanism for storing/restoring objects to MVar.
-Precise/exact math routines.
-Extensive exception classes, exception handling, and exception safe code.
-Message buffer and message handling classes.
-A Mathematica interface.
-Random number generation and probability distributions.
-MProc’s as a powerful means to perform parallel AI search.
-An experimental application metamodel with included source code that uses the MAgent in supervised learning mode to derive relationships and functions from visual data as part of a larger interpreted MML program.
Many of the framework classes were designed from the beginning to to be used in the context of threading while finer-grained operations such as operations on types, for performance reasons, do not have thread-safety built in. Operations such as submitting a message to a MMessageBuffer (in conjunction with MMessageHandler) or queueing an MProc to a task are inherently thread-friendly -- in fact all methods on MMessageBuffer and MProc are completely thread-safe so that users need not worry about wrapping calls to such classes with mutexes. Another aspect in which the framework is thread-friendly is with calls which are required to be executed on the main thread, e.g: GUI / OpenGL functions. The framework uses events to transparently defer, as needed, such calls to the main thread.
Though not described in detail in this overview, MML is a substantial feature of AndroMeta. MMLEntity and other MML-prefixed classes provide a sort of sub-framework that draws upon the larger AndroMeta framework discussed in this overview. MML is best learned by reading the AndroMeta User’s Guide and exploring and interactively experimenting with the numerous examples included in the AndroMeta distribution.
MML provides a number of specialized and general-purpose scenes. Some are implemented in OpenGL directly but the more visually impressive ones use the OGRE 3D Graphics Engine for visualization. Scene animation may be captured and encoded to MPEG. The scenes provide an easy-to-use interface for specifying/manipulating objects, configuring scene details, dynamic plotting, event-based GUI controls, and keyboard/mouse events.
Numeric operations (MNum, MMath, and elsewhere) involving disparate operand types yield an appropriate output type, tending to preserve precision/exactness. For example, arithmetic operations on integers and rationals (MRational) always produce integers or rationals as appropriate. However, when an operation involves a float, integer/rational operands are internally converted to floating point in order to produce a float output.
Languages
-The AndroMeta framework offers a unique approach to language design, allowing dynamic construction and interpretation of code and translation/generation to various target languages.
-Central to this system is AndroMeta’s M language. Based on functional programming principles and a minimal syntax, M serves as the input that is both directly executable by interpreters, and at the same, the AST (abstract syntax tree) used for code generation (MGenerator, MCPPGenerator, MMLGenerator, etc.)
-Using this approach, AndroMeta provides a powerful language construction system which eases some of the difficulties typically associated with programming language design and implementation. AndroMeta provides the AST and semantics side such that a major part of the task of designing a language has already been completed. The remaining portion is to supply the front-end parser which constructs and emits M code in the form of MNode’s. Parsers (MParser, MMLParser, etc.) conforming to the M code interface can then immediately take advantage of interpretation and translation to supported target languages such as C++.
-MML (Meta Modeling Language), specializing in modeling and simulation, is one such language derived from M and the AndroMeta language framework.
-Each MObject is effectively a thread-safe M interpreter with complete state and scoping. Subclassing an MObject allows symbols/attributes and functions/methods to be dynamically defined and processed within.
-Agent-based modeling, discrete-event simulation, and hybrid simulation. Coding may be done in C++ or in MML (Meta Modeling Language) -- an easy-to-use language designed specifically for modeling and simulation.
-Powerful yet easy-to-use network constructs for building client/server applications, distributed objects, and peer-to-peer systems.
-Simplified 3D visualization (underlying implementation uses OpenGL and the OGRE graphics engine).
-High-precision numerics (implemented with the GMP and MPFR libraries).
-Language design: AndroMeta eases some of the difficulties associated with implementing a domain-specific language.
-Dynamic code: AndroMeta includes a powerful system for creating and executing/interpreting code at runtime.
-AndroMeta uses advanced artificial intelligence techniques to provide the ability to evolve code based on supplied training data or as part of larger program which judges its running performance. Similarly, parameter optimization is also supported.
-AndroMeta features a powerful graph-based concurrency system which allows an application to easily take advantage of the processing power of multiple cores/CPU’s.
-This PDF guide introduces the AndroMeta framework from the perspective of MML.
The following pages describe in more detail the features that make each of these possible.
Copyright 2009 AndroMeta LLC. All rights reserved.