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

java.lang.Objectcz.cuni.amis.pogamut.episodic.episodes.Episode
public class Episode
The Episode class represents one episode experienced
by an agent. It can be pictured as customized tree structure
consisting of EpisodeNodes and more. It has a root node
and that represents top-level goal. Its child is actions
performed to achieve that goal, its children are goals needed
to perform that action etc. In the leaves of the tree are nodes
representing atomic actions. Moreover actions and intentions can
have several affordance slots that need to be filled by applicable
ObjectNodes.
Episode is open until it dissappears from agent's short-term memory. Once it is finished no nodes should be added into it, nodes should only be forgotten.
| Field Summary | |
|---|---|
boolean |
deleted
When last of episode nodes (root) of this episode is deleted. |
boolean |
finished
An indicator whether the episode was finished. |
int |
idEpisode
This ID is different than other node IDs in memory. This is not used for visualize purposes. |
IdGenerator |
idGen
A reference to ID generator structure, that will provide the unique IDs to all inside node. |
AgentMemory |
mem
|
ArrayList<Episode> |
next
The next field links Episode |
ArrayList<Episode> |
previous
The previous field contains Episode |
| Constructor Summary | |
|---|---|
Episode(Chronobag parent)
Instantiate the class by providing reference to a parent Chronobag. |
|
Episode(Episode other)
Instantiate the class by providing reference to an already instantiated Episode. |
|
| Method Summary | |
|---|---|
boolean |
addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances)
This method should be called for current episode each time agent executes an atomic action. |
boolean |
addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances,
String time)
|
double |
calculateCopyScore()
|
Episode |
createCopy(Chronobag c)
Creates a copy of the episode structure. |
Episode |
deriveEpisode()
|
double |
episodeSimilarity(Episode other)
Calculates the similarity of two episodes. |
boolean |
finishNode(String node,
ArrayList<String> trace,
boolean succeeded)
Marks specified episodic node as finished. |
boolean |
getCopied()
A getter method for the copied variable. |
double |
getCopyScore()
A getter method for the copyScore variable. |
int |
getIdEpisode()
Getter method for the episode id. |
Chronobag |
getParentChronobag()
Getter method for the parentChronobag variable. |
EpisodeNode |
getRoot()
Getter method for the root variable. |
boolean |
mergeWith(Episode other)
|
boolean |
setCopied()
Sets the copied indicator to True |
boolean |
setParentChronobag(Chronobag c)
Sets the reference to parent chronobag unless it was set before. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public boolean finished
Episode can be transferred into finishedEpisodes list
in a chronobag even when it is not finished. This happens to all
episodes that had to be interrupted because agent went to sleep
at the end of a day. But once it is finished, it cannot appear in
the currentEpisodes list in a chronobag.
public final int idEpisode
public final IdGenerator idGen
public boolean deleted
public ArrayList<Episode> next
next field links Episodes of a chronobag
in order they were executed. It contains episodes executed
just after current episode.
If episode was interrupted it can have more than one successor.
Episodes in next list are ordered in order they were executed -
first interruptions are at the beginning, final successor is at the end.
public ArrayList<Episode> previous
previous field contains Episodes of
a chronobag that were executed just before this episode.
If episode was interrupted it can have more than one predecessor.
Episodes in next list are ordered in reverse order than they
were executed - first predecessors are at the end,
last interruption is at the beginning.
public final AgentMemory mem
| Constructor Detail |
|---|
public Episode(Chronobag parent)
Chronobag.
Make sure episode is also added to the episodes of the parent chronobag -
to the currentEpisodes list.
parent - reference to the parent Chronobag structure.public Episode(Episode other)
Episode. This can be used to create episode copies with
identical episode IDs.
Make sure episode is also added to the episodes of the parent chronobag -
to the currentEpisodes list.
other - reference to instantiated Episode structure.| Method Detail |
|---|
public boolean addNewNode(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances)
EpisodeNodes into the Episode.
If episode was just started it is responsible for creating
the root node. It then makes sure all trace nodes, node
representing current atomic action, slots and objects used are created.
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 boolean finishNode(String node,
ArrayList<String> trace,
boolean succeeded)
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.
Cannot be empty.succeeded - True if node was finished successfully.
public Chronobag getParentChronobag()
parentChronobag variable.
Chronobag
this episode belongs to. The age of an episode has to be deduced
from the age of its parent chronobag.public boolean setParentChronobag(Chronobag c)
c - Reference to the parent chronobag.
public EpisodeNode getRoot()
root variable.
EpisodeNode representing
top-level goal of this episode (root of episode tree).public double episodeSimilarity(Episode other)
other - Reference to the episode that should be compared with
the current one.
public Episode createCopy(Chronobag c)
public boolean setCopied()
True
public boolean getCopied()
copied variable.
public double getCopyScore()
copyScore variable.
Returns -1 if episode was already copied.
public double calculateCopyScore()
public int getIdEpisode()
public boolean mergeWith(Episode other)
public Episode deriveEpisode()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||