hu.birot.OTKit.multiagent
Class Agent

java.lang.Object
  extended by hu.birot.OTKit.multiagent.Agent

public class Agent
extends java.lang.Object

A single agent, with a linguistic competence, performance, learning method, age, etc.


Field Summary
protected  double age
           
 Grammar grammar
           
 Learning learning
           
 OfflineLearning offlineLearning
           
 OnlineLearning onlineLearning
           
 Production production
           
 
Constructor Summary
Agent()
          By default, the age of a newly created agent is set to 0.
 
Method Summary
 double age()
          This method returns the age of the agent.
 boolean offlineLearning(java.util.Vector<Candidate> cand)
          The agent learns off-line.
 boolean onlineLearning(Candidate cand)
          The agent learns on-line.
 Candidate produceCandidate(float rnd)
          The agent produces a candidate, defined by rnd.
 java.util.Vector<Form> produceUtterance(float rnd)
          The agent utters a form, defined by rnd.
 void turnsOlder()
          The agent turns older by one "year".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

age

protected double age

grammar

public Grammar grammar

production

public Production production

learning

public Learning learning

onlineLearning

public OnlineLearning onlineLearning

offlineLearning

public OfflineLearning offlineLearning
Constructor Detail

Agent

public Agent()

By default, the age of a newly created agent is set to 0.

Method Detail

age

public double age()

This method returns the age of the agent. As you know, the age of an agent is not a public information. Yet, you may want to ask her age. If she is in a good mood, she will answer your question.

Returns:
The age of the agent.

turnsOlder

public void turnsOlder()

The agent turns older by one "year". By default, the age value of the agent is increased by 1. Yet, it may be useful to override this method, so that for instance parameters of the agent's learning or production methods be also adjusted.

Remember that the age of an agent is not a public field, because it cannot be changed randomly.


produceUtterance

public java.util.Vector<Form> produceUtterance(float rnd)

The agent utters a form, defined by rnd. The output is a vector of Forms, with the base at position 0, the underlying form at position 1, the surface form at position 2 and finally (unless the grammar's utter object is not defined) the overt form at position 3. The agent's grammar and production algorithm are used as follows:

  1. Position 0 is set to an empty Form (that is, to Form()).
  2. Position 1 is generated by the random() method of the agent's grammar.base, which maps the empty Form in position 0 using value rnd.
  3. Position 2 is generated from position 1, employing the produce() method of the agent's production object and the agent's grammar.
  4. If the agent's grammar also includes an utter object, then position 3 is the mapping of position 2 by the random() method of this utter object, employing a random number locally generated.

Thus, the method returns every information of the randomized production process. It is up to the listener agent to employ exclusively the overt form (for instance, in an unsupervised learning situation), or to deploy the underlying form, as well (in supervised learning or when the context provides clues about what the speaker agent has meant).

Parameters:
rnd - A number between 0 and 1 that determines the choice of the underlying form.
Returns:
A Vector of Forms corresponding to a chain of (base, underlying form, surface form [, overt form]), as explained above.

produceCandidate

public Candidate produceCandidate(float rnd)

The agent produces a candidate, defined by rnd. The underlying form of the candidate produced is generated by the random() method of the base object in the agent's grammar, with the use of the value rnd. Subsequently, the surface form in the candidate to be returned is computed by the produce() method of the agent's production object (which also makes use of the agent's grammar).

Parameters:
rnd - A number between 0 and 1 that determines the choice of the underlying form.
Returns:
A candidate corresponding to a "random" (i.e., based on parameter rnd) utterance of the agent.

offlineLearning

public boolean offlineLearning(java.util.Vector<Candidate> cand)

The agent learns off-line. Using its offlineLearning object, the agent creates its grammar based on the learning data in the Vector of Candidates cand.

Parameters:
cand - The learning data
Returns:
the output of the learn() method of the agent's offlineLearning, with the agent's grammar and cand as parameters.

onlineLearning

public boolean onlineLearning(Candidate cand)

The agent learns on-line. Using its onlineLearning object, the agent updates its grammar based on the single piece of learning data cand.

Parameters:
cand - The piece of learning data (aka winner candidate)
Returns:
the output of the learn() method of the agent's onlineLearning, with the agent's grammar and cand as parameters.