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

Package class diagram package DecisionTree
java.lang.Object
  extended by cz.cuni.amis.pogamut.episodic.decisions.DecisionTree
All Implemented Interfaces:
Serializable

public class DecisionTree
extends Object
implements Serializable

Name of this class can be a little misleading because DecisionTree is actually a forest constiting of several trees. Roots of these trees are all possible agent's top-level goals. It is a copy of decision plans from pogamut end part of the project.

These trees have to be constructed before any information can be added to agent's memory structures.

Each action agent performs is representing by equivalent node in decision tree. This node is located through this class by locating the correct top-level goal first and by going through tree structure until the specified node is located. Each time agent performs an action it is added to memory by providing trace of such nodes that lead to a node representing atomic action that was just executed.

Author:
Michal Cermak
See Also:
Node, Serialized Form

Field Summary
 ArrayList<Integer> branchFactor
           
 int numberOfAtomicActions
           
 int numberOfNodes
          This number is without atomic actions.
 HashMap<String,Intention> topLevelGoals
          Map of all possible top-level goals agent can have.
 
Constructor Summary
DecisionTree()
           
 
Method Summary
 boolean ensureNodes(String atomicAction, ArrayList<String> trace, ArrayList<AffordanceUsed> affordances, IdGenerator gen)
          In case actions performed were not included in xmls.
 ArrayList<Integer> getBranchFactor()
           
 ArrayList<Node> getTrace(ArrayList<String> trace)
          This method is used in schemabag when the trace specified by a list of node names is not enough and other information on nodes are needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

topLevelGoals

public HashMap<String,Intention> topLevelGoals
Map of all possible top-level goals agent can have. They are indexed by their name (so there cannot be two top-level goals with identical names). Through here it is possible to get to any node in the decision trees.


numberOfAtomicActions

public int numberOfAtomicActions

numberOfNodes

public int numberOfNodes
This number is without atomic actions. It only includes intentions and actions.


branchFactor

public ArrayList<Integer> branchFactor
Constructor Detail

DecisionTree

public DecisionTree()
Method Detail

getBranchFactor

public ArrayList<Integer> getBranchFactor()

getTrace

public ArrayList<Node> getTrace(ArrayList<String> trace)
This method is used in schemabag when the trace specified by a list of node names is not enough and other information on nodes are needed. It transforms the trace of node names into the equivalent trace of references to node themselves.

Parameters:
trace - Ordered list of names of nodes beginning with a name of one top-level goal a next item being always a name of one child node of previous node.
Returns:
Returns the equivalent trace of references to the Node structures that was specified by the names in parameter.

If there is non-existent node name in the middle of the list, method returns references to the nodes named by previous correct entries only.


ensureNodes

public boolean ensureNodes(String atomicAction,
                           ArrayList<String> trace,
                           ArrayList<AffordanceUsed> affordances,
                           IdGenerator gen)
In case actions performed were not included in xmls. This method creates nodes in decision tree, representing these actions.

Parameters:
trace - Ordered list of names of nodes beginning with a name of one top-level goal a next item being always a name of one child node of previous node.
Returns:
Return true if a new node was added, false otherwise.


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