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

java.lang.Objectcz.cuni.amis.pogamut.episodic.schemas.SchemaBag
public class SchemaBag
The SchemaBag is one of the important classes when it comes
to agent's memories. It does not hold any particular episode, insteas it
is responsible for creating an average episodes, so called schemas. It
accumullates all different experiences instances of one episode into one
aggregated schema. Apart from the capability to retrieve universal episodes
it gives us a way how to tell what sub-episodes happen more often that
others and it helps us to more efficiently store the concrete episodes by
providing a way to derive some of the nodes from what is only a part of
complete episode tree.
Schemabag consist of SchemaEpisodeNodes which are equivalent to
EpisodeNodes and SchemaObjectNodes which are
equivalent to ObjectNodes. Counters are kept for number of
experiences containing particular nodes and for all set of nodes up to
specified size. Theses SchemaCounters are kept in
SchemaBag and indexed in a way that it is always fast to find
all the counters representing subsets or supersets of a set of nodes
represented by a specified counter.
| Nested Class Summary | |
|---|---|
class |
SchemaBag.SchemaMessageCommand
Because counters in the schemabag are updated more often than the individual nodes, it is convenient not to redraw all whole schemabag visualization each time they are increased. |
| Field Summary | |
|---|---|
int |
id
ID of the schemabag. |
SchemaBag.SchemaMessageCommand |
schemaMessageCommand
Instantion of a SchemaMessageCommand class that is passed
to visualizer so that it can recieve up to date information about
SchemaCounters. |
| Constructor Summary | |
|---|---|
SchemaBag(IdGenerator idGen,
AgentMemory mem)
Instantiate the class by providing references to a common ID generator and parent AgentMemory structure. |
|
| Method Summary | |
|---|---|
void |
generateStatistics(String fileName)
|
Collection<SchemaCounter> |
getAllExistingSubSets(Collection<SchemaEpisodeNode> schemaNodes,
Collection<SlotContent> objectNodes,
int maxSize)
|
Integer |
getCount(Collection<SchemaEpisodeNode> schemaNodes,
Collection<SlotContent> objectNodes)
Retrieve the current total count of collective appearences of a set of specified schema nodes. |
SchemaCounter |
getCounter(Collection<SchemaEpisodeNode> schemaNodes,
Collection<SlotContent> objectNodes,
int maxCombination)
Retrieve the counter representing total count of collective appearences of a set of specified schema nodes. |
int |
getNumberOfNodes()
Getter method for the numberOfNodes variable. |
SchemaEpisodeNode |
getSchemaENode(String name)
Method used to return a single SchemaEpisodicNode. |
Collection<SchemaEpisodeNode> |
getSchemaENodes()
Basically a getter method for the schemaENodes variable. |
Collection<SchemaObjectNode> |
getSchemaONodes()
Basically a getter method for the schemaONodes variable. |
String |
toString()
Returns a String object representing the
SchemaBag's info. |
void |
updateSchema(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances)
The main method of SchemaBag is the updateSchema
method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final int id
public SchemaBag.SchemaMessageCommand schemaMessageCommand
SchemaMessageCommand class that is passed
to visualizer so that it can recieve up to date information about
SchemaCounters.
SchemaBag.SchemaMessageCommand| Constructor Detail |
|---|
public SchemaBag(IdGenerator idGen,
AgentMemory mem)
AgentMemory structure.
The ID of the schemabag is also generated in constructor.
idGen - Reference to common IdGenerator.mem - Reference to the AgentMemory structure.| Method Detail |
|---|
public String toString()
String object representing the
SchemaBag's info. It is used to provide detailed
information about schemabag when it is invoked from
the visualizion structures.
toString in class Objectpublic int getNumberOfNodes()
numberOfNodes variable.
public SchemaEpisodeNode getSchemaENode(String name)
SchemaEpisodicNode.
Schema episodic nodes are indexed by IDs of associated decision nodes.
SchemaEpisodicNode specified by
the id in paremeter.public Collection<SchemaEpisodeNode> getSchemaENodes()
schemaENodes variable.
SchemaEpisodicNodes
in the SchemaBag.public Collection<SchemaObjectNode> getSchemaONodes()
schemaONodes variable.
SchemaObjectNodes
in the SchemaBag.
public Integer getCount(Collection<SchemaEpisodeNode> schemaNodes,
Collection<SlotContent> objectNodes)
schemaNodes - Set of SchemaEpisodeNodes of the counter.objectNodes - Set of SlotContents of the counter.
public SchemaCounter getCounter(Collection<SchemaEpisodeNode> schemaNodes,
Collection<SlotContent> objectNodes,
int maxCombination)
schemaNodes - Set of SchemaEpisodeNodes of the counter.objectNodes - Set of SlotContents of the counter.
SchemaCounter representing
count of collective appearences of specified nodes.
If no counter for specified set of nodes exists in schemabag, it means
there is too much nodes in the set or that no counter was created because
the specified nodes did not appear collectively in short-term memory when
performing agent's action. Based on the reason the method returns either
null when the set of nodes can never contribute to one counter or zero
when the set of nodes did not happen collectively yet.
public Collection<SchemaCounter> getAllExistingSubSets(Collection<SchemaEpisodeNode> schemaNodes,
Collection<SlotContent> objectNodes,
int maxSize)
public void updateSchema(String atomicAction,
ArrayList<String> trace,
ArrayList<AffordanceUsed> affordances)
SchemaBag is the updateSchema
method. It is the only method that should be called from outside structures
apart from the getter methods. Calling this method ensures all necessary
schema information are added to the memory.
Parameters are the same as the ones that are used to call addNewNode
method in AgentMemory. They specifies the atomic action
that was executed and its trace nodes and all the affordances used on
the trace nodes.
With the use of associated decision nodes this method locates all
the SchemaEpisodeNodes that were in short-term memory
during the execution of atomic action and it slot locates all necessary
SlotContent nodes for all the items that were used.
When both sets of nodes are aquired, increaseCounts
method is called ensuring all necessary counts will be updated.
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 void generateStatistics(String fileName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||