|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jason.asSemantics.Agent
public class Agent
The Agent class has the belief base and plan library of an AgentSpeak agent. It also implements the default selection functions of the AgentSpeak semantics.
Field Summary | |
---|---|
protected java.lang.String |
aslSource
|
protected BeliefBase |
bb
|
protected java.util.logging.Logger |
logger
|
protected PlanLibrary |
pl
|
protected TransitionSystem |
ts
|
Constructor Summary | |
---|---|
Agent()
|
Method Summary | |
---|---|
void |
abolish(Literal bel,
Unifier un)
Removes all occurrences of bel in BB. |
boolean |
addBel(Literal bel)
Adds bel in belief base (calling brf) and generates the events. |
void |
addFunction(java.lang.Class<? extends ArithFunction> c)
register an arithmetic function implemented in Java |
void |
addFunction(java.lang.String function,
int arity,
java.lang.String literal)
register an arithmetic function implemented in AS (by a rule, literal, or internal action) |
void |
addInitialBel(Literal b)
Belief b will be stored to be included as an ordinary belief when the agent will start running. |
protected void |
addInitialBelsFromProjectInBB()
|
void |
addInitialBelsInBB()
add the initial beliefs in BB and produce the corresponding events |
void |
addInitialGoal(Literal g)
goal g will be stored to be included as an initial goal when the agent will start running |
protected void |
addInitialGoalsFromProjectInBB()
|
void |
addInitialGoalsInTS()
includes all initial goals in the agent reasoner |
boolean |
believes(LogicalFormula bel,
Unifier un)
Returns true if BB contains the literal bel (using unification to test). |
java.util.List<Literal>[] |
brf(Literal beliefToAdd,
Literal beliefToDel,
Intention i)
This function should revise the belief base with the given literal to add, to remove, and the current intention that triggered the operation. |
void |
buf(java.util.List<Literal> percepts)
Belief Update Function: adds/removes percepts into belief base |
Agent |
clone(AgArch arch)
Clone BB, PL, Circumstance. |
static Agent |
create(AgArch arch,
java.lang.String agClass,
ClassParameters bbPars,
java.lang.String asSrc,
Settings stts)
Setup the default agent configuration. |
boolean |
delBel(Literal bel)
If the agent believes in bel, removes it (calling brf) and generate the event. |
Literal |
findBel(Literal bel,
Unifier un)
Find a literal in BB using unification to test. |
org.w3c.dom.Document |
getAgProgram()
Gets the agent program (Beliefs and plans) as XML |
org.w3c.dom.Document |
getAgState()
Gets the agent "mind" (Beliefs, plans and circumstance) as XML |
org.w3c.dom.Element |
getAsDOM(org.w3c.dom.Document document)
Gets the agent "mind" as XML |
java.lang.String |
getASLSrc()
Returns the .asl file source used to create this agent |
BeliefBase |
getBB()
|
ArithFunction |
getFunction(java.lang.String function,
int arity)
get the object the implements the arithmetic function function/arity, either global (like math.max) or local (like .count). |
InternalAction |
getIA(java.lang.String iaName)
|
java.util.List<Literal> |
getInitialBels()
|
java.util.logging.Logger |
getLogger()
|
PlanLibrary |
getPL()
|
java.util.concurrent.ScheduledExecutorService |
getScheduler()
|
TransitionSystem |
getTS()
|
boolean |
hasCustomSelectOption()
|
void |
importComponents(Agent a)
Imports beliefs, plans and initial goals from another agent. |
void |
initAg()
Initialises the TS and other components of the agent |
TransitionSystem |
initAg(AgArch arch,
BeliefBase bb,
java.lang.String asSrc,
Settings stts)
Deprecated. Prefer the initAg method with only the source code of the agent as parameter. A call of this method like TransitionSystem ts = ag.initAg(arch, bb, asSrc, stts)can be replaced by new TransitionSystem(ag, new Circumstance(), stts, arch); ag.setBB(bb); // only if you use a custom BB ag.initAg(asSrc); TransitionSystem ts = ag.getTS(); |
void |
initAg(java.lang.String asSrc)
parse and load the agent code, asSrc may be null |
void |
initDefaultFunctions()
|
void |
load(java.lang.String asSrc)
parse and load the agent code, asSrc may be null |
boolean |
parseAS(java.io.File asFile)
Adds beliefs and plans form a file |
void |
parseAS(java.io.InputStream asIn)
|
void |
parseAS(java.io.Reader asIn)
|
boolean |
parseAS(java.net.URL asURL)
Adds beliefs and plans form an URL |
ActionExec |
selectAction(java.util.List<ActionExec> actList)
|
Event |
selectEvent(java.util.Queue<Event> events)
|
Intention |
selectIntention(java.util.Queue<Intention> intentions)
|
Message |
selectMessage(java.util.Queue<Message> messages)
|
Option |
selectOption(java.util.List<Option> options)
|
void |
setASLSrc(java.lang.String file)
|
void |
setBB(BeliefBase bb)
|
void |
setLogger(AgArch arch)
|
void |
setPL(PlanLibrary pl)
|
void |
setTS(TransitionSystem ts)
TS Initialisation (called by the AgArch) |
boolean |
socAcc(Message m)
Follows the default implementation for the agent's message acceptance relation and selection functions |
void |
stopAg()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected BeliefBase bb
protected PlanLibrary pl
protected TransitionSystem ts
protected java.lang.String aslSource
protected java.util.logging.Logger logger
Constructor Detail |
---|
public Agent()
Method Detail |
---|
public static Agent create(AgArch arch, java.lang.String agClass, ClassParameters bbPars, java.lang.String asSrc, Settings stts) throws JasonException
JasonException
public void initAg()
public void initAg(java.lang.String asSrc) throws JasonException
JasonException
public void load(java.lang.String asSrc) throws JasonException
JasonException
public TransitionSystem initAg(AgArch arch, BeliefBase bb, java.lang.String asSrc, Settings stts) throws JasonException
TransitionSystem ts = ag.initAg(arch, bb, asSrc, stts)can be replaced by
new TransitionSystem(ag, new Circumstance(), stts, arch); ag.setBB(bb); // only if you use a custom BB ag.initAg(asSrc); TransitionSystem ts = ag.getTS();
JasonException
public void stopAg()
public Agent clone(AgArch arch)
public void setLogger(AgArch arch)
public java.util.logging.Logger getLogger()
public java.util.concurrent.ScheduledExecutorService getScheduler()
public java.lang.String getASLSrc()
public void setASLSrc(java.lang.String file)
public boolean parseAS(java.net.URL asURL)
public boolean parseAS(java.io.File asFile)
public void parseAS(java.io.InputStream asIn) throws jason.asSyntax.parser.ParseException, JasonException
jason.asSyntax.parser.ParseException
JasonException
public void parseAS(java.io.Reader asIn) throws jason.asSyntax.parser.ParseException, JasonException
jason.asSyntax.parser.ParseException
JasonException
public InternalAction getIA(java.lang.String iaName) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public void initDefaultFunctions()
public void addFunction(java.lang.Class<? extends ArithFunction> c)
public void addFunction(java.lang.String function, int arity, java.lang.String literal)
public ArithFunction getFunction(java.lang.String function, int arity)
public void addInitialBel(Literal b)
public java.util.List<Literal> getInitialBels()
public void addInitialBelsInBB() throws RevisionFailedException
RevisionFailedException
protected void addInitialBelsFromProjectInBB()
public void addInitialGoal(Literal g)
public void addInitialGoalsInTS()
protected void addInitialGoalsFromProjectInBB()
public void importComponents(Agent a) throws JasonException
JasonException
public boolean socAcc(Message m)
public Event selectEvent(java.util.Queue<Event> events)
public Option selectOption(java.util.List<Option> options)
public Intention selectIntention(java.util.Queue<Intention> intentions)
public Message selectMessage(java.util.Queue<Message> messages)
public ActionExec selectAction(java.util.List<ActionExec> actList)
public void setTS(TransitionSystem ts)
public TransitionSystem getTS()
public void setBB(BeliefBase bb)
public BeliefBase getBB()
public void setPL(PlanLibrary pl)
public PlanLibrary getPL()
public void buf(java.util.List<Literal> percepts)
public boolean believes(LogicalFormula bel, Unifier un)
public Literal findBel(Literal bel, Unifier un)
public java.util.List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException
In its return, List[0] has the list of actual additions to the belief base, and List[1] has the list of actual deletions; this is used to generate the appropriate internal events. If nothing change, returns null.
RevisionFailedException
public boolean addBel(Literal bel) throws RevisionFailedException
source(self)
. (the belief is not cloned!)
RevisionFailedException
public boolean delBel(Literal bel) throws RevisionFailedException
RevisionFailedException
public void abolish(Literal bel, Unifier un) throws RevisionFailedException
RevisionFailedException
public boolean hasCustomSelectOption()
public org.w3c.dom.Document getAgState()
public java.lang.String toString()
toString
in class java.lang.Object
public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
public org.w3c.dom.Document getAgProgram()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |