MACS Programmer's manual

Scope

This document describes the inner architecture of MACS itself, independently from the surrounding framework allowing an agent to interact with an environment. It is intended to provide an overview, rather than a detailled description. For a more detailled description, please read the comments in the code and our papers about MACS. The code has been written by Pierre Gérard and deeply re-engineered by Olivier Sigaud. In case of any question concerning this code, please contact Olivier Sigaud.

Overview

MACS is decomposed into two packages: the package Classifier and the package MACS.

The package Classifier

The package Classifier is completely independent from the package MACS. As a result, it can be re-used for building any other Learning Classifier System. The package Classifier contains all the classes necessary to represent different sorts of classifiers. It can be decomposed into two mains parts: classes representing components of a classifier, and classes representing classifiers themselves.

In the first category, we have the classes Token, Message, Action, Perception, Anticipation and their derivatives, as shown in the next pictures.

A Message is made out of Tokens. Each token can take either a "don't care" (#) value, a "don't change" (=) value, a "don't know" (?) value, or an integer value in a range between 0 and a maximum value specified in the Message format.

Classes representing tokens in MACS

The TokenRepository is an optimization trick used to create less objects. Any possible Token is created just once and for all and stored in the repository. The repository delivers a pointer on it each time it is necessary. This also makes the comparisons easier, since just addresses need to be compared.

An Action, Perception, and Anticipation is a Message. Anticipation is an interface, different classes of Classifiers containing different kinds of Anticipations implementing this interface. But an Anticipation is also a particular kind of Perception, thus concrete Anticipations must extend Perception.

Classes representing parts of classifiers in MACS

The following picture represents different sorts of Classifiers available. The BasicClassifier contains the common core of all classifiers : a condition part and an action part.

More characteristic of this package is the AnticipatoryClassifier class. As BasicClassifier, it contains a Condition and an Action part, but it also contains an Anticipation part. AnticipatoryClassifiers in YACS and MACS just differ from the kind of Anticipation they use. The MACSAnticipation class is ready for use, while the YACSAnticipation class must be programmed (up to now it is just a copy of MACSAnticipation).

Classes representing classifiers in MACS

The package MACS

The package MACS heavily relies on the package Classifier. Two layers can be distinguished in it: the high level layer represents important classes in MACS, while the lower level layer is just made of lists (Vectors) or Sets (TreeSets) of Classifiers providing useful services. The lower level layer will be described further in the text.

The main class in the package MACS is ModularClassifierSystem. It comes with a ClassifierSystemLoader class whose role is to load an ALCS, a ClassifierSystemParameters class containing all the experimental parameters listed in configuration files and two TraceManagers, ModularClassifierSystemTraceManager and ClassifierSystemTraceManager, whose role is to display everything happening in MACS.

The ModularClassifierSystem's processes are split in two parts: those which take care of the model of transitions, and those which take care of the ActionSelection processes.

The top view of MACS

The model of transitions in MACS

The model of transitions in MACS is stored in the
ClassifierSystem class, which itself derives from AnticipatoryClassifierList, deriving from ClassifierList.

With this class come three Managers whose role is to improve the model of transitions: the GeneralizationManager, the SpecializationManager and the ConditionCoveringManager.

Each of these Managers is called through the method run(). Detailled algorithms are explained in papers on MACS.

The model of transitions part in MACS

The action selection process in MACS

The action selection part is probably the most complex part in MACS, and also the one which is currently changing most from version to version (thus the code is not stabilized yet). The mains components are an ActionSelector class and a MultiModelOfPayoff class, itself containing at least one PayoffModel.

The action selection part in MACS

The MultiModelOfPayoff is a quite flexible class with which you can represent different kinds of models of payoffs with different priority levels among the different criteria that you want to use. The list of criteria and their hierarchical organization into level is read in the parameter file that goes with MACS. The action selection mechanism requires the construction of a list of anticipated situations. This process is performed by the Integrator class in conjunction with the Anticipator class. Since the Integrator algorithms are computationnally expensive and should be called several times per time step if the system performs mental rehearsal of its model, we have added a memory of all anticipated situations recheable from each possible Perception. This memory is implemented by the AnticipatedSituationsMap class.

The model of the reward part in MACS

The PayoffModel class implements a list of immediate values and expected values associated to each possible perception. It is organized as a Map whose key is a Perception and whose value is a couple of doubles: the immediate value and the expected value.

The lower level of MACS package

Most classes of the model of transitions in MACS rely on lists or sets of Perceptions or Classifiers. In order to represent such lists or sets, the MACS package contains a few classes providing basic or more advanced services by extending standard containers. In particular, we call XXXList a class implementing a Vector of XXXs, and XXXSet a class implementing a TreeSet of XXXs.

As shown in the picture below, the ClassifierSystem class itself extends an AnticipatoryClassifierList. Similarly, the set of all encountered Perceptions is implemented as a PerceptionList.

The lower level of the MACS package : useful sets

Conceptually, a Set is a container where an item can appear only once while it can appear more than once in Lists. Also, we more often access to items in sequence in Lists than in Sets. Ordering Sets is efficient if you often have to look for a particular item.