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

java.lang.Objectcz.cuni.amis.pogamut.episodic.episodes.Chronobag
public class Chronobag
The Chronobag class is one of the most significant class
in this project. It is a collection of episode memories
from one time period. Chronobags can consist of episode from one
particular day or from a longer time period.
One special instance of this class is a chronobag of episodes from the current day. Any time some action is executed, it is added to this chronobag and then into the current episode.
Each night a new present day chronobag is created and other chronobags are shifted by one day. It is clear, the episodes in chronobags are subjects to forgetting, so as new episodes are created in current day chronobag, episodes in all chronobags can be forgotten each night when the process of forgetting is triggered.
| Field Summary | |
|---|---|
int |
id
ID of this chronobag. |
IdGenerator |
idGenerator
A reference to ID generator structure, that will provide the unique IDs to all inside node. |
boolean |
newNodeAdded
An indicator whether new node was added into this chronobags since its visualization was last refreshed. |
HashMap<String,ObjectNode> |
objectNodes
Map of ObjectNodes remembered by the agent. |
| Constructor Summary | |
|---|---|
Chronobag(IdGenerator idGen,
AgentMemory mem)
Instantiate the class by providing references to a common ID generator and parent AgentMemory structure. |
|
Chronobag(IdGenerator idGen,
AgentMemory _mem,
Chronobag last)
Instantiate the class by providing references to a common ID generator, parent AgentMemory structure
and older chronobag of the same level that will be added
behind the new chronobag in temporal chain. |
|
| Method Summary | |
|---|---|
boolean |
addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances)
This method should be called each time agent executes an atomic action. |
boolean |
addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances,
String time)
|
double |
calculateChronobagScore()
Method used to compute the score of this chronobag based on its current properties and node it consists. |
boolean |
copyEpisodeToAbstractChronobag(Episode e)
Creates a copy of specified episode from this chronobag and copies it to the more abstract chronobag. |
Chronobag |
createMoreAbstractChronobag()
Creates a chronobag on higher level of time abstraction whose interval will include whole interval of this chronobag. |
ObjectNode |
createObjectNode(String item)
Adds new node to the map of ObjectNodes remembered
by the agent. |
void |
decideToForgetNodes()
|
void |
deleteChronobag()
|
void |
deleteEpisode(Episode e)
|
void |
finish()
Moves all the episodes from current episode list to finished episodes list. |
boolean |
finishNode(String node,
ArrayList<String> trace,
boolean succeeded)
Marks specified episodic node as finished. |
AgeInterval |
getAge()
Getter method for the age structure. |
Episode |
getEpisode(Integer id)
|
Collection<Episode> |
getEpisodes()
Creates and returns a collection of all episodes in a chronobag. |
Episode |
getFirstEpisode()
A getter method for the firstEpisode variable. |
Integer |
getLastEpisodeId()
|
int |
getLevel()
Getter method for the level variable. |
int |
getMaxNumberOfNodes()
Getter method for maxNumberOfNodes Maximum number of nodes the chronobag could contain. |
AgentMemory |
getMemory()
Getter method for the mem variable. |
Chronobag |
getMoreAbstractChronobag()
Returns a chronobag belonging to a higher level of time abstraction chronobags that contains episode from time interval that includes whole time interval of this chronobag |
int |
getNumberOfEpisodeNodes()
Getter method for the numberOfEpisodeNodes variable. |
Chronobag |
getOlderChronobag()
Getter method for the older variable. |
double |
getScore()
Getter method for the score structure. |
Chronobag |
getYoungerChronobag()
Getter method for the younger variable. |
void |
increaseDay()
Method used to increase the age of a chronobag by one day. |
void |
increaseMaxNumberOfNodes(Chronobag c)
Increases the maxNumberOfNodes variable by the number of nodes
in a chronobag. |
boolean |
isLandmark()
Getter method for the landmark variable. |
void |
reviewActiveEpisodes(ArrayList<String> list)
|
String |
toString()
Returns a String object representing this
Chronobag's info. |
boolean |
uniteEpisode(Episode e)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final IdGenerator idGenerator
public final int id
public boolean newNodeAdded
public HashMap<String,ObjectNode> objectNodes
ObjectNodes remembered by the agent.
This map is shared among the chronobags so it is possible
to find all usages of specified object. Object are indexed
by their unique name.
In episodes object nodes are connected with the affordance slots they were used in.
| Constructor Detail |
|---|
public Chronobag(IdGenerator idGen,
AgentMemory mem)
AgentMemory structure.
The ID of a chronobag is also generated in constructor.
idGen - Reference to common IdGenerator.mem - Reference to the AgentMemory structure.
public Chronobag(IdGenerator idGen,
AgentMemory _mem,
Chronobag last)
AgentMemory structure
and older chronobag of the same level that will be added
behind the new chronobag in temporal chain.
The ID of a chronobag is also generated in constructor.
idGen - refernce to common IdGenerator.mem - reference to the AgentMemory structure.last - chronobag of the same level containing episodes
preceding those added to this chronobag.| Method Detail |
|---|
public String toString()
String object representing this
Chronobag's info. It is used to provide detailed
information about chronobag when it is invoked from
the visualization structures.
toString in class Objectpublic Chronobag getYoungerChronobag()
younger variable.
Chronobags can appear on different levels of abstraction, e.g. daily chronobags, week chronobags... This points to this next chronobag in the same level of abstraction. Chronobags of other levels forms separate chain of chronobags.
public Chronobag getOlderChronobag()
older variable.
Chronobags can appear on different levels of abstraction, e.g. daily chronobags, week chronobags... This points to this next chronobag in the same level of abstraction. Chronobags of other levels forms separate chain of chronobags.
public AgentMemory getMemory()
mem variable.
AgentMemory structure.
It should be possible to access decision tree, schemas or other
parts of memory via this reference.public int getNumberOfEpisodeNodes()
numberOfEpisodeNodes variable.
EpisodeNode nodes
in the chronobag.public Chronobag getMoreAbstractChronobag()
null if
no such chronobag exists.public Chronobag createMoreAbstractChronobag()
getMoreAbstractChronobag
method.
public void increaseDay()
There is no reversal to calling this method - age of chronobags or episodes cannot be decreased.
If age passes landmark threshold, chronobag is also marked as landmark.
public AgeInterval getAge()
age structure.
public double getScore()
score structure.
public boolean addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances)
EpisodeNodes into the Episodes.
It finds (or creates) the current Episode according to
the top level goal in trace. And invokes the addNewNode
method on that episode while passing it the same parameters.
It is also responsible for maintaining the correct episode sequence within the chronobag.
atomicAction - Name of an atomic action that was executed.trace - List of names of decision nodes that lead to
the atomic action executed. The top-level goal is first in the list and
parent of atomic action is last item in the list.affordances - List of AffordanceUsed objects.
Each object represent one filled affordance slot that was
needed for the execution of current atomic action.
public boolean addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances,
String time)
public ObjectNode createObjectNode(String item)
ObjectNodes remembered
by the agent. This map is shared among the chronobags so
it is possible to find all usages of specified object.
Object are indexed by their unique name.
New node is not created if it already exists.
item - Unique name of an object.
ObjectNode representing
the item in the parameter.
public boolean finishNode(String node,
ArrayList<String> trace,
boolean succeeded)
currentEpisodes list to finishedEpisodes list.
node - Name of a node that was finished.trace - Names of traces nodes that lead to the finished node,
beginning with top-level goal and ending with node's parent.
Should be empty if node itself is top-level goal.succeeded - True if node was finished successfully.
public Collection<Episode> getEpisodes()
public Episode getFirstEpisode()
firstEpisode variable.
public int getLevel()
level variable.
public double calculateChronobagScore()
public boolean copyEpisodeToAbstractChronobag(Episode e)
e - Episode to be copied.
public boolean isLandmark()
landmark variable.
public void finish()
public void decideToForgetNodes()
public void reviewActiveEpisodes(ArrayList<String> list)
public boolean uniteEpisode(Episode e)
public void deleteEpisode(Episode e)
public void deleteChronobag()
public int getMaxNumberOfNodes()
public void increaseMaxNumberOfNodes(Chronobag c)
maxNumberOfNodes variable by the number of nodes
in a chronobag. maxNumberOfNodes is initially zero and it increase
only via this method. For daily chronobags it should be called just
once just before forgetting process is triggered for the first time
as the chronobag is no longer the present chronobag. For abstract
chronobag it is called once for each daily chronobag whose age belongs
to the age period of abstract chronobag.
c - Daily chronobag whose actual number of nodes will be added
to the maximum number of nodes for this chronobag.public Integer getLastEpisodeId()
public Episode getEpisode(Integer id)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||