Class Manager

java.lang.Object
  |
  +--Manager
All Implemented Interfaces:
java.io.Serializable

public class Manager
extends java.lang.Object
implements java.io.Serializable

This class is a manager, containing the main loop of the manager's XCS. The XCS is implemented following Martin V. Butz and Steward Wilson (2001) "An algorithmic description of XCS". Moreover, it handles the evaluation of performance.

Since:
JDK 1.3
See Also:
Serialized Form

Field Summary
(package private)  int actionWinner
          The index of the last best agent
private static XCSConstantsManager cons
          Stores the relevant constants for XCS.
private  XClassifierSetManager gpop
          Stores the current population of XCS.
private  XClassifierSetManager matchSet
          The Match set for each problem
private static int nrActions
          The number of actions of the manager (=total number of agents)
private  double reward
          The reward the manager receives from the environment for a given answer
private  java.lang.String state
          the environment state corresponding to the actual problem
 
Constructor Summary
Manager(int conditionLength, int nrAgents)
          Constructs the XCS system of the manager.
 
Method Summary
 int getActualAgent(java.lang.String actualState, int time, AgentsPopulations wholePopulation, int selector0)
          The task of the manager is to choose the most qualified agent to fulfill the task submitted by the environment (to answer the problem submitted by the environment).
 double getPerformance()
          return the reward received by the agent
 XClassifierSetManager getPopulation()
          Return the population of rules of an agent
 int pickUpAgentAtRandom(AgentsPopulations wholePop, java.lang.String actualState, int time, int selector0)
          Choose an agent to perform the task at hand.
 void showPopStructure()
          Display the proportion of each advocated action in the set of rules of the manager
 void updatePop(double reward, int counter)
          The manager learns from the reward it received from the environment after the chosen agent has answered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nrActions

private static int nrActions
The number of actions of the manager (=total number of agents)


gpop

private XClassifierSetManager gpop
Stores the current population of XCS.


matchSet

private XClassifierSetManager matchSet
The Match set for each problem


actionWinner

int actionWinner
The index of the last best agent


cons

private static XCSConstantsManager cons
Stores the relevant constants for XCS.

See Also:
XCSConstantsManager

reward

private double reward
The reward the manager receives from the environment for a given answer


state

private java.lang.String state
the environment state corresponding to the actual problem

Constructor Detail

Manager

public Manager(int conditionLength,
               int nrAgents)
Constructs the XCS system of the manager.

Parameters:
conditionLength - The bit-string length of the condition parts of classifiers
nrAgents - Total number of agents in the population; also the number of possible actions for the manager.
See Also:
XCSConstantsManager.XCSConstantsManager(), XClassifierSetManager.XClassifierSetManager(int, int)
Method Detail

getPerformance

public double getPerformance()
return the reward received by the agent


getPopulation

public XClassifierSetManager getPopulation()
Return the population of rules of an agent


getActualAgent

public int getActualAgent(java.lang.String actualState,
                          int time,
                          AgentsPopulations wholePopulation,
                          int selector0)
The task of the manager is to choose the most qualified agent to fulfill the task submitted by the environment (to answer the problem submitted by the environment). In this routine, the manager tries to find in its memory the best suited agents (the best classifier).

Parameters:
actualState - The current problem
time - A time counter (nb of experiments)
wholePopulation - Total number of Agents in the system
selector0 - mode of classifier selection by the manager (1->bestAction; 0->rouletteWheel)
See Also:
XClassifierSetManager.XClassifierSetManager(String, XClassifierSetManager, int, AgentsPopulations, int), PredictionArray.PredictionArray(XClassifierSetManager, int), PredictionArray.bestActionWinner(), PredictionArray.rouletteActionWinner()

updatePop

public void updatePop(double reward,
                      int counter)
The manager learns from the reward it received from the environment after the chosen agent has answered.

Parameters:
reward - The reward received from the environment after an answer to the problem has been fired. It is used to update both manager's and agent's classifier
counter - A time counter
See Also:
XClassifierSetManager.XClassifierSetManager(XClassifierSetManager, int), XClassifierSetManager.updateSet(double, double), XClassifierSetManager.runGAManager(int, String, int)

pickUpAgentAtRandom

public int pickUpAgentAtRandom(AgentsPopulations wholePop,
                               java.lang.String actualState,
                               int time,
                               int selector0)
Choose an agent to perform the task at hand. The agent is chosen among those that are unused (low average performance of the agent) and that, at the same time, declares that the problem is in their core domains (closeState=true) . If an agent is chosen, a new rule is inserted in the manager's memory (signal:name of the agent). This routine is thus a sort of directed covering. It is used by the manager when getActualAgent() failed to provide an answer.

Parameters:
wholePop - The total population of agents
actualState - the current problem
time - A time counter
selector0 - mode of classifiers selection
See Also:
Agent.getCloseState(String, AgentsPopulations), XClassifierManager#XClassifierManager(int, int, String, int), XClassifierSetManager.addXClassifierToPopulation(XClassifierManager), XClassifierSetManager.deleteFromPopulation(), XClassifierSetManager.XClassifierSetManager(String, XClassifierSetManager, int, AgentsPopulations, int), PredictionArray.PredictionArray(XClassifierSetManager, int), PredictionArray.bestActionWinner(), PredictionArray#roultetteActionWinner()

showPopStructure

public void showPopStructure()
Display the proportion of each advocated action in the set of rules of the manager