LGames
Class HolisticAgent

java.lang.Object
  |
  +--LGames.Agent
        |
        +--LGames.HolisticAgent

public class HolisticAgent
extends Agent

The HolisticAgent class implements the structure and behaviours of the holistic agent with only one layer in the conceptual space.

Copyright (c) 2004 Paul Vogt


Field Summary
protected  int DG
           
protected  double eta
           
protected  double etaN
           
protected  double etaS
           
protected  int gamesPlayed
           
protected  int iMeaning
           
protected  int iSymbols
           
protected  java.util.List lexicon
           
protected  int lg
           
protected  double[][] lScore
           
protected  int[][] lUse
           
protected  int maxMeanings
           
protected  int maxNSymbols
           
protected  java.lang.String mString
           
protected  int nMeanings
           
protected  int nrDGSuccess
           
protected  int nSymbols
           
protected  java.util.List ontology
           
protected  double thresholdForgetting
           
protected  double thresholdForgettingS
           
protected  int utteranceID
           
 
Fields inherited from class LGames.Agent
age, cxt, dimension, id, topic, TOPIC, topicID, utterance
 
Constructor Summary
HolisticAgent()
           
HolisticAgent(int n, int a, double e, double s, char u, int nM, int nS, boolean[] fv)
          Constucts an agent with identity n
 
Method Summary
 void adaptLexiconHearer(Symbols u, int T, char type, char utype)
          Adaptation function for the hearer
 void adaptLexiconSpeaker(Symbols u, int T, char type, char utype)
          Adaptation function for the speaker
 double calcInterpretationCoherence(HolisticAgent hearer, int nMeanings)
          Function for an artificially created lexicon.
 double calcProductionCoherence(HolisticAgent hearer, int nMeanings)
          Function for an artificially created lexicon.
protected  boolean context_member(int id)
          Function to check whether a category relates to an object in the context
 void createArtificialLexicon(int nMeanings)
          Function for an artificially created lexicon.
 void createArtificialOntology(int nMeanings)
          Function for an artificially created lexicon.
 void forget(char type)
          This function implements the search for elements that can be forgotten based on their effectiveness
protected  void forget(char type, char rc, int n)
          This function implements the removal of categories or symbols in case of forgetting.
 int getDim()
          Returns the dimensionality of the feature/conceptual space
 double getDS()
           
 java.lang.String getGame()
          Constructs a string that can be written to the logfile
 int getLexSize()
           
 java.lang.String getMeaning(java.lang.String word, char type)
          This function is used to find the meaning that best fits a given word.
 double[][] getMeanings(java.lang.String w, char t)
          Function used to construct a matrix representation of meanings of word w.
 int getOntSize()
           
 Meaning getTOPIC()
          returns the topic's meaning.
 java.lang.String[] getWords()
          Used to form the lexicon for the UI
 void getWords(java.util.List bag)
          This function is used to produce a bag of words that are used by the entire population
 Symbols guess(Symbols u, char utype)
          This function processes the interpretation of the hearer for the guessing and selfish game.
 Symbols hear(Symbols u, char type)
          This function processes the interpretation of the hearer for the observational game.
 void merge(int dim, char type)
          This function implements the merging of meanings.
 void playDGame(char type, char uType, boolean b)
          This function is not implemented...
 void playDGame(char type, char uType, int n, boolean adapt)
          This function lets the agent play a discrimination game
 void print()
          prints the final language game.
 void print(java.io.PrintWriter outfile, char type)
          This function prints the ontology and lexicon of the agent to a file
 void printScore(java.io.PrintWriter outfile, char type, java.lang.String u, int lg)
          prints the score of string u to the outfile
 void setTopic(int t)
          specifies which element in the context is the topic.
 void setTopicID(int t)
          Sets some topic value, used in a test function.
 void setTOPICID(int t)
          Sets some topic value, used in a test function.
 Symbols speak(double probability, char type)
          This function produces an utterance for the speaker
 
Methods inherited from class LGames.Agent
getAge, getFV, getID, getLabels, getMaxLayer, getTopic, getUtterance, initDGame, initialise, playDGame, printLexiconColumns, printLexiconLatexTabel, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ontology

protected java.util.List ontology

lexicon

protected java.util.List lexicon

maxMeanings

protected int maxMeanings

maxNSymbols

protected int maxNSymbols

lUse

protected int[][] lUse

lScore

protected double[][] lScore

iSymbols

protected int iSymbols

iMeaning

protected int iMeaning

nMeanings

protected int nMeanings

nSymbols

protected int nSymbols

nrDGSuccess

protected int nrDGSuccess

DG

protected int DG

utteranceID

protected int utteranceID

eta

protected double eta

etaS

protected double etaS

etaN

protected double etaN

mString

protected java.lang.String mString

thresholdForgetting

protected final double thresholdForgetting
See Also:
Constant Field Values

thresholdForgettingS

protected final double thresholdForgettingS
See Also:
Constant Field Values

gamesPlayed

protected int gamesPlayed

lg

protected int lg
Constructor Detail

HolisticAgent

public HolisticAgent()

HolisticAgent

public HolisticAgent(int n,
                     int a,
                     double e,
                     double s,
                     char u,
                     int nM,
                     int nS,
                     boolean[] fv)
Constucts an agent with identity n

Parameters:
n - the identity of the agent
a - the agent's `birthdate' (i.e. language game nr.)
e - the standard learning rate eta
s - the learning rate eta for the speakers in case we wish to distinguish
u - the type score-update
nM - the memory size for meanings
nS - the memory size for symbols
fv - the array of features that were selected
Method Detail

setTopicID

public void setTopicID(int t)
Sets some topic value, used in a test function.


setTOPICID

public void setTOPICID(int t)
Sets some topic value, used in a test function.


setTopic

public void setTopic(int t)
specifies which element in the context is the topic. Used in guessing.

Overrides:
setTopic in class Agent
Parameters:
t - the topic number to be set

getTOPIC

public Meaning getTOPIC()
returns the topic's meaning.

Overrides:
getTOPIC in class Agent
Returns:
TOPIC the whole meaning structure of the topic

forget

protected void forget(char type,
                      char rc,
                      int n)
This function implements the removal of categories or symbols in case of forgetting.

Specified by:
forget in class Agent
Parameters:
type - type of the game that is being played
rc - indicates whether it concerns a category (o) or symbol (otherwise)
n - the index of the element to be removed

forget

public void forget(char type)
This function implements the search for elements that can be forgotten based on their effectiveness

Specified by:
forget in class Agent
Parameters:
type - type of game that is being played

getLexSize

public int getLexSize()
Returns:
lexiconSize

getOntSize

public int getOntSize()
Returns:
ontologySize

speak

public Symbols speak(double probability,
                     char type)
This function produces an utterance for the speaker

Specified by:
speak in class Agent
Parameters:
probability - The word-creation probability
type - The way the scores are updated ('s' for score-based, 'u' for usage-based)
Returns:
utterance representation of the utterance

hear

public Symbols hear(Symbols u,
                    char type)
This function processes the interpretation of the hearer for the observational game.

Specified by:
hear in class Agent
Parameters:
u - The Symbols representation of the speaker's utterance
Returns:
Symbols representation of the hearer's utterance (interpretatation)

guess

public Symbols guess(Symbols u,
                     char utype)
This function processes the interpretation of the hearer for the guessing and selfish game.

Overrides:
guess in class Agent
Parameters:
u - The Symbols representation of the speaker's utterance
utype - The way scores are adapted ('s' for score-based, 'u' for usage-based)
Returns:
Symbols representation of the hearer's utterance (interpretatation)

context_member

protected boolean context_member(int id)
Function to check whether a category relates to an object in the context

Overrides:
context_member in class Agent
Parameters:
id - ID of the category to be checked.
Returns:
true if category belongs to the context, false otherwise

adaptLexiconSpeaker

public void adaptLexiconSpeaker(Symbols u,
                                int T,
                                char type,
                                char utype)
Adaptation function for the speaker

Specified by:
adaptLexiconSpeaker in class Agent
Parameters:
u - utterance of the hearer
T - the topic
type - the type of game
utype - the score-update type

adaptLexiconHearer

public void adaptLexiconHearer(Symbols u,
                               int T,
                               char type,
                               char utype)
Adaptation function for the hearer

Specified by:
adaptLexiconHearer in class Agent
Parameters:
u - utterance of the speaker
T - the topic
type - the type of game

playDGame

public void playDGame(char type,
                      char uType,
                      boolean b)
This function is not implemented...

Specified by:
playDGame in class Agent
Parameters:
type - the type of game
uType - the type of update score- or usage-based
b - boolean to indicate whether or not to adapt the ontology

playDGame

public void playDGame(char type,
                      char uType,
                      int n,
                      boolean adapt)
This function lets the agent play a discrimination game

Overrides:
playDGame in class Agent
Parameters:
type - not used
uType - type of method with prototypes are shifted (default: centre-of-mass)
n - language game number
adapt - wether or not the learning is on or off.

merge

public void merge(int dim,
                  char type)
This function implements the merging of meanings.

Overrides:
merge in class Agent
Parameters:
dim - number of dimensions
type - score-update type

getDS

public double getDS()
Overrides:
getDS in class Agent
Returns:
DS rate of discriminative success in the current language game

print

public void print()
prints the final language game.

Overrides:
print in class Agent

getGame

public java.lang.String getGame()
Constructs a string that can be written to the logfile

Specified by:
getGame in class Agent

print

public void print(java.io.PrintWriter outfile,
                  char type)
This function prints the ontology and lexicon of the agent to a file

Overrides:
print in class Agent
Parameters:
outfile - The file to which the data is written
type - score-update type

printScore

public void printScore(java.io.PrintWriter outfile,
                       char type,
                       java.lang.String u,
                       int lg)
prints the score of string u to the outfile

Overrides:
printScore in class Agent
Parameters:
outfile - The file to which the data is written
type - the type of update (score- or usage-based)
u - the word of the lexical entry
lg - the language game number

getWords

public void getWords(java.util.List bag)
This function is used to produce a bag of words that are used by the entire population

Overrides:
getWords in class Agent

getWords

public java.lang.String[] getWords()
Used to form the lexicon for the UI

Overrides:
getWords in class Agent
Returns:
words all the words in the lexicon

getDim

public int getDim()
Description copied from class: Agent
Returns the dimensionality of the feature/conceptual space

Overrides:
getDim in class Agent
Returns:
dimension the dimension of the conceptual space

getMeaning

public java.lang.String getMeaning(java.lang.String word,
                                   char type)
This function is used to find the meaning that best fits a given word.

Overrides:
getMeaning in class Agent

getMeanings

public double[][] getMeanings(java.lang.String w,
                              char t)
Function used to construct a matrix representation of meanings of word w. This function is used for the lexicon display in the UI.

Overrides:
getMeanings in class Agent
Parameters:
w - the word under consideration
t - score-update type
Returns:
matrix

createArtificialLexicon

public void createArtificialLexicon(int nMeanings)
Function for an artificially created lexicon. The lexicon created is a one-to-one lexicon with no synonymy nor homonymy.


createArtificialOntology

public void createArtificialOntology(int nMeanings)
Function for an artificially created lexicon. The ontology is just an integer. Meanings are created in order not to conflict other procedures.


calcProductionCoherence

public double calcProductionCoherence(HolisticAgent hearer,
                                      int nMeanings)
Function for an artificially created lexicon. This function calculates the production coherence for two agents.


calcInterpretationCoherence

public double calcInterpretationCoherence(HolisticAgent hearer,
                                          int nMeanings)
Function for an artificially created lexicon. This function calculates the interpretation coherence.