art.cs
Class CsManager

java.lang.Object
  extended byart.ga.GaManager
      extended byart.cs.CsManager

public class CsManager
extends GaManager

This is the most important class for the user.

It allows to create an instance of cs and manage all the related operations. For a standard use of the Classifier System two steps are sufficient:

  1. Define a configuration file as described in the documentation or using the axample's one as template, and pass to the constructor of the class the configuration file name and the project name.
  2. Create a custom class that implement the interface Detector defining the method get condition as described in the class documentation. Create an instance of the implemented Detector class and pass it to the constructor.

Once the CsManager is created call the buildMessage() method to invoke the Detector and create a message. When the desired number of message are created call go() to make the cs compute the action(s).

After the actions are computed use getEffector() to obtain an instance of Effector and extract the actions using Effector.hasNext() and @see{Effector#getNextAction}.

IMPORTANT: Every action must be evaluated and the reward of the action must be set one by one using setReward(double).

Author:
Marco Lamieri and Gianluigi Ferraris

Constructor Summary
CsManager(java.lang.String ConfigurationFileName, java.lang.String project, Detector detect)
          Constructor of the class
 
Method Summary
 boolean buildMessage()
          Used to pass to the CS the messages, this method call the interface Detector.getMessage() that must be implemented.
 void clearMsgList()
          Clear the message list, can be used to initialize the CS or in special case when chains of CS are realized
 Effector getEffector()
          Method used to obtain an instance of Effector.
 int getMAWinners()
          Get the number of winner actions within the time lag specified by the parameter "movingAverageLag".
 void go()
          Method that execute one cycle of computations of the CS.
 void printClassifierList()
          Print the current classifiers present in classifierList and some complementary information to screen.
 void saveClassifierList(java.lang.String fileName)
          Save the current classifiers present in classifierList and some complementary information in a file.
 void setReward(double reward)
          For every action returned by the Effector a reward must be set by this method.
 
Methods inherited from class art.ga.GaManager
computeBestSolution, getGenerationNumber, getNextSolution, setFitness
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsManager

public CsManager(java.lang.String ConfigurationFileName,
                 java.lang.String project,
                 Detector detect)
Constructor of the class

Parameters:
ConfigurationFileName - File name included relative path to the configuration file.
project - Project name in the configuration file
detect - Detector implemented by the user from the interface Detector
Method Detail

go

public void go()
Method that execute one cycle of computations of the CS. Use it after buildMessage().


clearMsgList

public void clearMsgList()
Clear the message list, can be used to initialize the CS or in special case when chains of CS are realized


buildMessage

public boolean buildMessage()
Used to pass to the CS the messages, this method call the interface Detector.getMessage() that must be implemented. This method must be used many times as many message must be compute togethers (in a standard easy case only once).

Returns:
if the message has been build

setReward

public void setReward(double reward)
For every action returned by the Effector a reward must be set by this method. Use it one by one with the actions.

Parameters:
reward - Reward of the current action.

getEffector

public Effector getEffector()
Method used to obtain an instance of Effector.

Returns:
Effector's instance.

printClassifierList

public void printClassifierList()
Print the current classifiers present in classifierList and some complementary information to screen.


saveClassifierList

public void saveClassifierList(java.lang.String fileName)
Save the current classifiers present in classifierList and some complementary information in a file.

Parameters:
fileName - Destination filename with relative path.

getMAWinners

public int getMAWinners()
Get the number of winner actions within the time lag specified by the parameter "movingAverageLag".

Returns:
winner actions.