|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.ObjectdecisionMakingSystem.DecisionModuleImpl
public class DecisionModuleImpl
main decision making module - presents the logic of the bot! it takes care about everything about the main logic cycle choice of intention to be performed, action to be performed, update of fadeout, attractivity, rollback when something fails, update of attractivity of intentions etc. basicaly all you need to know about the usage in Agent is that you has to call prepareLogic() in the prePrepareAgent() and doReasoning() in the doLogic, before using this module you need to specify couple XML files and if necessary atomicActions. The XML files are Loader.xml and then one for each root intention. All available atomic actions are in the atomicactions package and all affordance types are in the Enum AffordanceType so you will might need to change those as well. Items are handeled in the itemParameters.xml file. And note that if you add a new AtomicAction you need to add it to the BasicIntentionLoader to importIntentionForest() so it will be proceeded correctly.
| Field Summary | |
|---|---|
Action |
actualAction
currently choosen action |
Intention |
actualIntention
currently choosen intention |
Bot |
agent
link to agent |
AgentParameters |
agentParameters
agent parameters -> used for stres count and filter of attention, etc. |
ArrayList<Intention> |
allIntentions
list of all intentions |
ArrayList<Intention> |
basicIntentions
list of basic intentions - for the current day |
int |
counter
time counter |
PogamutEndEventSource |
eventSource
|
ArrayList<Intention> |
intentionArea
list of intentions which are currently active or preactive |
Inventory |
inventory
agent inventory - handles picked up things |
Logger |
log
fast access to agent log |
ItemMemory |
memory
|
HashMap<String,Intention> |
nameToIntention
|
PerceptiveField |
perceptiveField
link on perceptive field to access actions, perceived items etc. |
ThingsManager |
things
link to thing manager -> takes care about all visible items |
| Constructor Summary | |
|---|---|
DecisionModuleImpl()
|
|
DecisionModuleImpl(ItemMemory itemMemory)
|
|
| Method Summary | |
|---|---|
protected void |
actionFailed(Action action)
Recursive action which is executed when action fails. |
protected void |
actionSucceeded(Action action)
success of an action means its removal from preactive actions and success of parental intention |
void |
addIntention(String name,
Interval actInterval)
This method adds dynamicaly new intention to the daily plan. |
void |
changeLifestyle(String directory,
String planningFilename,
int i)
|
protected Action |
chooseAction(Intention intention)
Start of a recursive proceeding, where we start from intention and ends up with action which is ready to execute its atomic actions. |
protected Intention |
chooseIntention(Action action)
recursive function to choose current intention to fullfill |
DMSMemoryVO |
doReasoning(int myCounter)
main function of DecisionModuleImpl, the only one that should be called from doLogic of Agent. |
void |
doReasoningItemScenario()
a test case which serves to check if Want works correctly - e.g. |
Action |
getActualAction()
|
AtomicAction |
getActualAtomicAction()
|
Intention |
getActualIntention()
|
int |
getCounter()
|
double |
getGMTTime()
|
AtomicAction |
getOldAtomicAction()
|
protected void |
intentionFailed(Intention intention)
Intention fails => parental action fails as well. |
protected void |
intentionSucceeded(Intention intention)
When intention succeeds, parental action can continue with next intention. |
static DecisionModuleImpl |
loadFromFile(String filename,
Logger log,
Bot agent,
String directory)
|
protected Action |
prepareAction(Action action)
Part of recursive call. |
void |
prepareLogic(Bot agent,
String directory,
String planningFilename)
quite close to the constructor, prepares everything in the logic (loads intentions from XML, initialize all structures). |
protected void |
removeActionAndDescendantIntentions(Action actualAction)
removes action from processArea removes descendant intentions of action be careful about Want intentions as they can be descendants of more than one action |
protected void |
removeIntention(Intention intention)
so far just removes intention from intention area without anything else as intentions are rolling back differently and when one fails it doesn't mean a disaster - so just the parent action failed as well. |
void |
saveToFile(String filename)
|
void |
sensing()
|
void |
setDMSLogger(DMSLogger logger)
|
void |
setGMT(double gmtTime)
set GMT and replan the schedule for the day |
DMSMemoryVO |
test()
procedure which executes all testcases should be put in the agent.doLogic() instead of doReasoning() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public PogamutEndEventSource eventSource
public transient Logger log
public transient Bot agent
public transient PerceptiveField perceptiveField
public ArrayList<Intention> basicIntentions
public ArrayList<Intention> allIntentions
public ArrayList<Intention> intentionArea
public transient ThingsManager things
public int counter
public transient Inventory inventory
public Intention actualIntention
public Action actualAction
public AgentParameters agentParameters
public HashMap<String,Intention> nameToIntention
public ItemMemory memory
| Constructor Detail |
|---|
public DecisionModuleImpl()
public DecisionModuleImpl(ItemMemory itemMemory)
| Method Detail |
|---|
public void changeLifestyle(String directory,
String planningFilename,
int i)
public void prepareLogic(Bot agent,
String directory,
String planningFilename)
agent - - pointer to agentdirectory - - path, where are located Loader.xml and XML files of root intentionspublic void sensing()
public void setGMT(double gmtTime)
GMTTime - protected Action chooseAction(Intention intention)
intention - intention to start from
protected Action prepareAction(Action action)
action - which should be prepared
protected Intention chooseIntention(Action action)
action - action to start from
protected void actionFailed(Action action)
action - action which failedprotected void actionSucceeded(Action action)
action - action which succeededprotected void intentionFailed(Intention intention)
intention - which failedprotected void intentionSucceeded(Intention intention)
intention - public DMSMemoryVO doReasoning(int myCounter)
doReasoning in interface DecisionModuleprotected void removeActionAndDescendantIntentions(Action actualAction)
actualAction - protected void removeIntention(Intention intention)
public void addIntention(String name,
Interval actInterval)
addIntention in interface DecisionModulename - - name of the intentionactInterval - - activation interval of the inserted intentionpublic DMSMemoryVO test()
public void doReasoningItemScenario()
public Action getActualAction()
getActualAction in interface DecisionModulepublic Intention getActualIntention()
getActualIntention in interface DecisionModulepublic int getCounter()
getCounter in interface DecisionModulepublic AtomicAction getActualAtomicAction()
getActualAtomicAction in interface DecisionModulepublic AtomicAction getOldAtomicAction()
getOldAtomicAction in interface DecisionModulepublic double getGMTTime()
getGMTTime in interface DecisionModulepublic void saveToFile(String filename)
public static DecisionModuleImpl loadFromFile(String filename,
Logger log,
Bot agent,
String directory)
public void setDMSLogger(DMSLogger logger)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||