|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.agentfactory.cldc.logic.Agent
public class Agent
The Agent class includes the actuators, perceptors, commitment rules, resource constraints, and roles that represent an AFME agent. It contains the core control algorithm that governs agent behaviour. In AFME, agents follow a sense, deliberate, act cycle. The agent's perceptors are initially fired. The desires are then identified through the use of resolution-based reasoning. The intentions are then identified in the knapsack procedure. Finally, depending on the nature and degree of the commitments adopted, various actuators are fired.
| Constructor Summary | |
|---|---|
Agent(TerImplication[] commitmentRules,
java.util.Hashtable actuators,
Perceivable[] perceptors,
java.util.Hashtable mods,
RoleLibrary lib,
int res)
Constructs an agent from a combination of its actuators, perceptors, commitment rules, roles, and the amount of resources available to the agent. |
|
| Method Summary | |
|---|---|
void |
addActBelief(FOS fos)
This method adds a belief to the agent and is called by the affect manager when an actuator is adding a belief. |
void |
addFOSBelief(FOS belief)
Adds a first order structure to the agents belief set. |
void |
addToMod(java.lang.String s,
Commitment c)
Associates a commitment with a label. |
void |
adoptChild(Commitment commit)
Adds a child commitment to the agent's current commitment set. |
void |
adoptCommitment(Commitment commit)
Adds a commitment to the agent's current commitment set. |
void |
belBuf(java.lang.StringBuffer bel)
Appends the agent's current and temporal beliefs to a string buffer. |
void |
commitBuf(java.lang.StringBuffer commit)
Appends a string representation of each of the agent's current commitments to a string buffer. |
void |
handleTrigger(FOS[] trigger,
java.util.Hashtable table,
RoleTemplate template)
For each trigger of a role template, checks if the trigger matches a current belief. |
boolean |
processFOS(FOS fos,
SubstitutionSet set)
Adds variables to the substitution set for the specified first order structure if there are current beliefs that match with the first order structure and provided the substitution set is not null. |
void |
removeFromMod(java.lang.String s)
This method removes the commitment that is associated with the specified label from the update table( See addToMod(String, Commitment)). |
void |
retractBelief(FOS fos)
This method causes an agent to drop a belief. |
void |
solveRule(TerImplication[] rule)
Solves a list of commitment rules and subsequently clears the solutions. |
void |
step()
Performs a step in the agent's control algroithm. |
void |
updateBeliefs()
This method updates the agent's current belief set. |
void |
updateResources(FOS fos)
Updates the amount of resources available to the agent. |
void |
updateValues(FOS value,
FOS cost,
java.lang.String id)
Updates the cost and value of the commitment that has the specified label. |
void |
writeToStream(java.io.DataOutputStream dos)
Writes the agent's internal state to a data output stream. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Agent(TerImplication[] commitmentRules,
java.util.Hashtable actuators,
Perceivable[] perceptors,
java.util.Hashtable mods,
RoleLibrary lib,
int res)
commitmentRules - the set of rules that are used to identify the agent's
desired states.actuators - a hash table that maps action identifiers to concrete Actions.
Actions typically take the form of Actuators.perceptors - the set of perceptors (software sensors) that are
fired on each iteration of the agent's control algorithm.mods - a hash table of modules that belong to the agent.lib - a library of roles that the agent adopts under various circumstances.res - the amount or resources available to the agent.| Method Detail |
|---|
public void updateResources(FOS fos)
fos - a first order structure representation of the amount of resources available to the agent.
public void addToMod(java.lang.String s,
Commitment c)
s - the label of the commitment.c - the commitment to be labeled.public void removeFromMod(java.lang.String s)
addToMod(String, Commitment)).
s - the label of the commitment.
public void updateValues(FOS value,
FOS cost,
java.lang.String id)
value - the new value of the commitment.cost - the new cost of the commitment.id - the label of the commitment.
public void writeToStream(java.io.DataOutputStream dos)
throws java.io.IOException
dos - the data output stream that the state is written to.
java.io.IOException - if there is an I/O error.public void addActBelief(FOS fos)
addFOSBelief(FOS), which is called by the
perception manager. The belief is not added to
the belief set during the current cycle. The reason for this is that commitment
execution is nondeterministic. That is, the order in which commitments
are fired in the current cycle is irrelevant at a logical level
and will not have a consequence on the resolution based resaoning
process for determining the desired states in the current cycle. Beliefs
added using this method will only be added to the agents current belief
set after all of the commitments in the current cycle have been executed.
fos - the belief to be added.public void addFOSBelief(FOS belief)
belief - fos the first order structure to be added to the agent's beliefs.public void retractBelief(FOS fos)
addActBelief(FOS).
The belief is not retracted until the current control process
has finished determining the desired states. If the agent does not
contain the specified belief, no error is thrown.
fos - the belief that is to be retracted.public void updateBeliefs()
public void step()
public void belBuf(java.lang.StringBuffer bel)
bel - the string buffer that the beliefs are appended to.public void commitBuf(java.lang.StringBuffer commit)
commit - the string buffer that the string representation of the
commitments are appended to.
public void solveRule(TerImplication[] rule)
throws MalformedLogicException
rule - the list of rules to be evaluated.
MalformedLogicException - if there is a logic error.public void adoptCommitment(Commitment commit)
commit - the commitment that is to be added.public void adoptChild(Commitment commit)
commit - the child commitment to be added.
public void handleTrigger(FOS[] trigger,
java.util.Hashtable table,
RoleTemplate template)
throws MalformedLogicException
trigger - an array of triggers for the role template.table - the hash table that the role instance is to be added to.template - the specified role template.
MalformedLogicException - if there is a logic error.
public boolean processFOS(FOS fos,
SubstitutionSet set)
throws MalformedLogicException
fos - the specified first order structure.set - the substitution set to add variable mappings to.
MalformedLogicException - if there is a logic error.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||