|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.ie.cowbots.bdi.brf.CRevisionComponent
edu.udo.cs.ie.cowbots.bdi.brf.CowbotRevision
public class CowbotRevision
This class manages the components of the epistemic state in the Cowbot-BDI-model, namely the belief base, the belief state and the belief set. It also invokes the corresponding belief operators to perform belief base changes and revising an agents beliefs.
Nested Class Summary | |
---|---|
(package private) static class |
CowbotRevision.LiteralRewrite
|
Field Summary | |
---|---|
protected java.util.List<ELPLiteral> |
belAdd
|
protected java.util.List<ELPLiteral> |
belDel
|
protected BeliefBase |
beliefBase
|
protected BeliefSet |
beliefSet
|
protected boolean |
bsOldUpdate
|
protected boolean |
directMessageAccept
|
protected DLV |
dlv
|
protected java.util.List<ELPLiteral> |
exploredCells
|
protected boolean |
extendedRevision
|
protected IInferenceOperator |
infop
|
protected boolean |
prn
|
protected boolean |
reviseFull
|
protected java.util.Map<java.lang.String,CowbotRevision.LiteralRewrite> |
rewrite
|
protected GridMap |
scenarioMap
|
protected int |
simulationID
|
protected ICowbotUI |
ui
|
Constructor Summary | |
---|---|
CowbotRevision()
default constructor to create a cowbot revision instance (the setup has to be done with the init method). |
Method Summary | |
---|---|
protected void |
addBelief(Literal beliefToAdd)
adds a fact to an agents beliefs |
void |
addProgram(ELP program,
java.lang.String source)
adds a logical program to an agents beliefs |
void |
addUserProgram(java.lang.String name,
ELP program)
this method adds a logical program to the program storage |
protected BeliefSet |
computeBeliefs(ELP extraRules)
computes a new belief set based upon the belief state and optinal extra rules. |
protected void |
copyMap(java.util.Collection<ELPLiteral> target)
experimental function, copies |
protected void |
delBelief(Literal beliefToDel)
removes a literal from an agents beliefs |
void |
dumpBB()
test function, prints bb contents to stdout |
BeliefBase |
getBeliefBase()
this method returns the logical belief base of an agent. |
java.util.List<Literal> |
getBeliefs(ELP elp)
Deprecated. |
ELP |
getBeliefsAsELP()
returns the belief set as an elp |
BeliefSet |
getBeliefSet()
this method returns an agents belief set. |
java.util.List<Literal>[] |
getChangeOfBeliefs()
returns a tupel of two lists describing changes in an agent's beliefs. this is used to update the jason belief base properly after the epistemic state was revised. |
IEpistemicState |
getEpistemicState()
returns the epistemic state of an agent |
java.util.List<ELPLiteral> |
getExploredCells()
this method returns a list of new, but not not necessarily revised, perceptions. |
GridMap |
getMap()
this function returns the beliefs about an agents environment as a gridmap. |
java.util.Queue<Message> |
getMessages()
this function returns the queue of unprocessed messages |
ELP |
getProgram(java.lang.String name)
returns a user program identified by a unique name (user programs are not part of the belief revision process over the epistemic state) |
int |
getWorldTime()
returns the time of the world (this is the time the agent beliefs in) |
void |
init(Settings stts,
DLV dlv,
ICowbotUI ui)
initialization routine, allows the cowbot revision to be configured with user parameters. |
void |
internalInit(org.w3c.dom.Element brfConfig,
java.lang.String configName,
DLV dlv,
ICowbotUI ui)
initialization routine, allows the cowbot revision to be configured with user parameters. |
boolean |
newRevisionMode()
only used internally, do not care about! |
java.util.List<Literal>[] |
processMessages(java.lang.String agName)
a very simple way to handle communication: every information send by a "tell" is accepted. the information (encoded by literals) within the message is appended to the belief base. |
protected void |
pruneBeliefBase(java.util.Set<java.lang.String> predicates,
java.util.Set<ELPLiteral> facts)
this method removes facts from the belief base |
void |
queueMessage(Message m)
this method queues an incoming message. the deliberation may then decide to handle the message |
void |
reset()
resets the revision component (is set back to a fresh initialized state). |
java.util.List<Literal>[] |
revise_belief(Literal beliefToAdd,
Literal beliefToDel,
Intention i)
revision method that is called from jason's "brf" method |
boolean |
revise_percepts(java.util.List<Literal> per,
java.util.List<ELPLiteral> explored)
this method is used to integrate percepts from the environment into the agent's belief base. |
protected void |
reviseEx()
extended revision. makes extensive use of the map and identtable operators. can purge elps from the belief base if the reject set of an inference operator tells to reject something. |
protected void |
reviseSimple()
simple revision, more or less good enough to support the massim scenario using elp or java operators |
protected void |
reviseState()
internal method, usually called by the update methods after the belief base was changed. this computes a new belief state and a new belief set. |
protected void |
setNewBeliefs(java.util.Set<ELPLiteral> newBS)
applies a new belief set to the epistemic state |
protected java.util.List<Literal> |
transformELP2Jason(java.util.List<ELPLiteral> ll)
auxiliary function, transforms an elp literal into a jason literal |
protected java.util.List<ELPLiteral> |
transformJasonToELP(java.util.List<Literal> literals)
auxiliary function, transforms a list of jason literals into a list of elp literals |
protected ELPLiteral |
transformJasonToELP(Literal beliefToAdd)
auxiliary function, transforms jason literals into elp literals |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected BeliefBase beliefBase
protected BeliefSet beliefSet
protected DLV dlv
protected IInferenceOperator infop
protected boolean prn
protected GridMap scenarioMap
protected ICowbotUI ui
protected boolean reviseFull
protected boolean bsOldUpdate
protected int simulationID
protected java.util.Map<java.lang.String,CowbotRevision.LiteralRewrite> rewrite
protected boolean extendedRevision
protected java.util.List<ELPLiteral> belAdd
protected java.util.List<ELPLiteral> belDel
protected java.util.List<ELPLiteral> exploredCells
protected boolean directMessageAccept
Constructor Detail |
---|
public CowbotRevision()
Method Detail |
---|
public java.util.List<Literal>[] revise_belief(Literal beliefToAdd, Literal beliefToDel, Intention i)
revise_belief
in class CRevisionComponent
beliefToAdd
- single literal to add to an agents beliefsbeliefToDel
- single literal to remove from an agents beliefsi
- intention that issued the brf call (always ignored)
protected void addBelief(Literal beliefToAdd)
beliefToAdd
- literal to addprotected void delBelief(Literal beliefToDel)
beliefToDel
- literal to removepublic boolean revise_percepts(java.util.List<Literal> per, java.util.List<ELPLiteral> explored)
CRevisionComponent
revise_percepts
in class CRevisionComponent
per
- the list of environmental percepts
@Deprecated public java.util.List<Literal> getBeliefs(ELP elp)
IEpistemicState
getBeliefs
in interface IEpistemicState
elp
- (optional) inference rules
public ELP getBeliefsAsELP()
IEpistemicState
getBeliefsAsELP
in interface IEpistemicState
protected BeliefSet computeBeliefs(ELP extraRules)
extraRules
- additional elp expressions
public IEpistemicState getEpistemicState()
CRevisionComponent
getEpistemicState
in class CRevisionComponent
protected void reviseState()
public void dumpBB()
public void queueMessage(Message m)
CRevisionComponent
queueMessage
in class CRevisionComponent
public java.util.Queue<Message> getMessages()
IEpistemicState
getMessages
in interface IEpistemicState
public GridMap getMap()
IEpistemicState
getMap
in interface IEpistemicState
public BeliefSet getBeliefSet()
IEpistemicState
getBeliefSet
in interface IEpistemicState
protected void reviseSimple()
protected void reviseEx()
protected void setNewBeliefs(java.util.Set<ELPLiteral> newBS)
newBS
- new set of beliefsprotected void pruneBeliefBase(java.util.Set<java.lang.String> predicates, java.util.Set<ELPLiteral> facts)
predicates
- functor names of predicates to removefacts
- set of facts to removepublic java.util.List<Literal>[] getChangeOfBeliefs()
CRevisionComponent
getChangeOfBeliefs
in class CRevisionComponent
protected java.util.List<Literal> transformELP2Jason(java.util.List<ELPLiteral> ll)
ll
-
protected ELPLiteral transformJasonToELP(Literal beliefToAdd)
beliefToAdd
-
protected java.util.List<ELPLiteral> transformJasonToELP(java.util.List<Literal> literals)
literals
-
public boolean newRevisionMode()
CRevisionComponent
newRevisionMode
in class CRevisionComponent
protected void copyMap(java.util.Collection<ELPLiteral> target)
target
- public java.util.List<Literal>[] processMessages(java.lang.String agName)
processMessages
in class CRevisionComponent
public java.util.List<ELPLiteral> getExploredCells()
IEpistemicState
getExploredCells
in interface IEpistemicState
public int getWorldTime()
IEpistemicState
getWorldTime
in interface IEpistemicState
public void addProgram(ELP program, java.lang.String source)
CRevisionComponent
addProgram
in class CRevisionComponent
program
- logical program to addsource
- source (agent name) of programpublic void init(Settings stts, DLV dlv, ICowbotUI ui) throws java.lang.Exception
CRevisionComponent
init
in class CRevisionComponent
dlv
- instance of dlv asp solver
java.lang.Exception
public void internalInit(org.w3c.dom.Element brfConfig, java.lang.String configName, DLV dlv, ICowbotUI ui) throws java.lang.Exception
brfConfig
- XML Node named "brf" containing setup dataconfigName
- user configuration override from mas2jdlv
- instance of dlv asp solver
java.lang.Exception
public ELP getProgram(java.lang.String name)
IEpistemicState
getProgram
in interface IEpistemicState
name
- unique name of program
public void addUserProgram(java.lang.String name, ELP program)
CRevisionComponent
addUserProgram
in class CRevisionComponent
public BeliefBase getBeliefBase()
CRevisionComponent
getBeliefBase
in class CRevisionComponent
public void reset()
CRevisionComponent
reset
in class CRevisionComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |