cz.cuni.amis.pogamut.episodic.decisions
Class Node

Package class diagram package Node
java.lang.Object
  extended by cz.cuni.amis.pogamut.episodic.decisions.Node
All Implemented Interfaces:
INode, Serializable
Direct Known Subclasses:
Action, AtomicAction, Intention

public abstract class Node
extends Object
implements INode, Serializable

Node class is an abstract class representing nodes from the decision tree in decision making process in pogamut end part of the project. Node can be either Action (the OR node), Intention (goal, the AND node) or AtomicAction.

It is possible to attach affordance slots to the Nodes in the decision tree, but no affordances should be attached to atomic actions. All nodes that were performed at least once by an agent are associated with equivalent nodes in the schema tree in agent's memory.

Every EpisodeNode in agent's memory of experienced episodes is associated with its equivalent Node in decision trees. The only way how to add a new memories to agent's memory is to provide a specific trace of Nodes starting with a top-level goal and ending with atomic action.

Author:
Michal Cermak
See Also:
Action, Intention, AtomicAction, EpisodeNode, Serialized Form

Field Summary
 Node parent
          A reference to the parent node in the decision tree.
 
Constructor Summary
Node(String _name, int _attractivity, NodeType _type)
          Instantiate the class by providing its name, attractivity and type.
 
Method Summary
 void addAffordance(AffordanceSlot affordance)
          Actions and Intetions can have AffordanceSlots attached to them.
 AffordanceSlot getAffordance(String type)
           
 Collection<AffordanceSlot> getAffordances()
          Getter method for the affordances variable.
 SchemaEpisodeNode getAssociatedNode()
          Getter method for the associatedSchemaNode variable.
 int getAttractivity()
          A getter method for attractivity variable.
 int getId()
          Getter method for the id variable.
 String getName()
          Getter method for the name variable.
 NodeType getType()
          Getter method for the type variable.
 boolean setAssociatedSchemaNode(SchemaEpisodeNode node)
          This method sets the associatedSchemaNode variable.
 boolean setId(int newId)
          This method sets the unique ID of the node.
 String toString()
          Returns a String object representing this EpisodeNode's info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.episodic.decisions.INode
getAllChildrenNodes, getSubNode
 

Field Detail

parent

public Node parent
A reference to the parent node in the decision tree. Parents of intentions (goals) and atomic action will be actions. Parents of actions will be intention nodes. Only nodes without a parent are the top-level goals - roots of decision tree.

Constructor Detail

Node

public Node(String _name,
            int _attractivity,
            NodeType _type)
Instantiate the class by providing its name, attractivity and type.

Name of the node is used to identify and index the nodes agent's memory. Therefore no two nodes in the same level can have identical names (e.g. no two top-level goals, no two children of another node). There can be two nodes with same name though, if they are not children of the same parent node.

Type of the Node can be either action, intention (goal) or atomic action.

Parameters:
_name - Name of the node.
_attractivity - Specified in XML file. Helps determine when to forget node.
_type - Type of the node.
Method Detail

toString

public String toString()
Returns a String object representing this EpisodeNode's info. It is used to provide tooltips for the node when it is invoked from the visualizion structures.

Overrides:
toString in class Object
Returns:
A string representation of the value of this object, consisting of its ID and name.

setId

public boolean setId(int newId)
This method sets the unique ID of the node. Once set it cannot be changed. It is the ID of vertex representing this node when visualizing decision tree.

Parameters:
newId - The ID of this node.

getId

public int getId()
Getter method for the id variable.

Returns:
Returns the unique ID of the slot that is used as an ID of vertex representing this node when visualizing decision tree.
Throws:
Throws - exception when trying to retrive ID that was not set yet.

getType

public NodeType getType()
Getter method for the type variable.

Returns:
Returns the type of the Node. Node can be either action, intention (goal) or atomic action.

getName

public String getName()
Getter method for the name variable.

Returns:
Returns the name of the node.

addAffordance

public void addAffordance(AffordanceSlot affordance)
Actions and Intetions can have AffordanceSlots attached to them. These slots are kept in the affordances list. In order to perform an action or satisfy a goal, all its slots have to be filled first.

This method attaches a new slot to this Node. There should be no two slots of same type attached to one node.

Parameters:
affordance - Already instantiated AffordanceSlot that should be attached to this node.

setAssociatedSchemaNode

public boolean setAssociatedSchemaNode(SchemaEpisodeNode node)
This method sets the associatedSchemaNode variable. All nodes are associated with equivalent nodes in schemabag once the equivalent node is created there. SchemaNodes can be used to create average episodes or count number of experienced of an episode.

It should only be called from the newly created schema node when making the mutual association. New schema node association to this node has to be performed first, otherwise the association is not made.

Parameters:
node - Newly created SchemaEpisodeNode that this node should be associated with.
Returns:
Returns true if the association is mutual and associating was successful, returns false otherwise.
See Also:
SchemaEpisodeNode

getAssociatedNode

public SchemaEpisodeNode getAssociatedNode()
Getter method for the associatedSchemaNode variable.

Specified by:
getAssociatedNode in interface INode
Returns:
Returns a reference to equivalent node in schemabag once the equivalent node is created there. SchemaNodes can be used to create average episodes or count number of experienced of an episode. Returns null of the associated node does not exist yet.
See Also:
SchemaEpisodeNode

getAffordances

public Collection<AffordanceSlot> getAffordances()
Getter method for the affordances variable.

Specified by:
getAffordances in interface INode
Returns:
Returns a list of affordance slots attached to this node. In order to perform an action or satisfy a goal, all its slots have to be filled first. Once the slot is filled, its equivalent in memory of experienced episode will be linked with the object that satisfied the slot.

getAffordance

public AffordanceSlot getAffordance(String type)

getAttractivity

public int getAttractivity()
A getter method for attractivity variable.

Specified in XML file. Helps determine when to forget node.

Returns:
Returns the attractivity of this node. Value between 0-100. 0 means unattractive, 100 means very attractive.


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.