The Process of A-R Mapping 1. 2. 3. 4. 5/26/2005 Initialization: The agent society  makes a request to the role space  to instantiate the major LeadingRole class defined in the role organization , and create a role instance for it. Role assignment: for each agent  in the agent society , do the following: a. When agent  receives any sensor data from its environment, it may decide to generate some new goals or subgoals based on the sensor data and agent ’s motivations. b. With its reasoning mechanisms, agent  further deduce a set  of needed roles of types defined in the role organization . If none of the roles in set  is of type LeadingRole, go to step 2.d. c. If any role in role set  is a leading role of type LeadingRole, agent  takes the corresponding role instance from the role space , if available, updates the hiring number of other roles as needed, and makes requests to the role space  to create role instances for those roles under hiring. d. Repeat the following for a period of time : Search the role space  for any role instances that match roles in role set . If there is a match, agent  takes that role instance. If all roles in role set  have been matched with some role instances in the role space , go to Step 3. e. If any role in the role set  cannot be matched with a role instance in the role space , agent  may decide to release all role instances or keep its current occupations. Marking role incompatibility: for each agent , mark its role incompatibility as the following: for any role instances r1, r2  .rolesTaken, if .relationship(r1.getClass, r2.getClass) == incompatibility, mark agent  as potential role incompatibility with a self-loop. Setting up interaction relationships: for each agent , set up the interaction relationship between agent  and other agents from the same agent society  as the following : for any agent instance   .agentInstances, where   , if  r1  .rolesTaken, r2  .rolesTaken such that .relationship(r1.getClass, r2.getClass) == association, then (, )  dom .interaction. CIS Dept., UMass Dartmouth 14
View full slide show




The Process of A-R Mapping 1. 2. 3. 4. Initialization: The agent society  makes a request to the role space  to instantiate the major LeadingRole class defined in the role organization , and create a role instance for it. Role assignment: for each agent  in the agent society , do the following: a. When agent  receives any sensor data from its environment, it may decide to generate some new goals or subgoals based on the sensor data and agent ’s motivations. b. With its reasoning mechanisms, agent  further deduce a set  of needed roles of types defined in the role organization . If none of the roles in set  is of type LeadingRole, go to step 2.d. c. If any role in role set  is a leading role of type LeadingRole, agent  takes the corresponding role instance from the role space , if available, updates the hiring number of other roles as needed, and makes requests to the role space  to create role instances for those roles under hiring. d. Repeat the following for a period of time : Search the role space  for any role instances that match roles in role set . If there is a match, agent  takes that role instance. If all roles in role set  have been matched with some role instances in the role space , go to Step 3. e. If any role in the role set  cannot be matched with a role instance in the role space , agent  may decide to release all role instances or keep its current occupations. Marking role incompatibility: for each agent , mark its role incompatibility as the following: for any role instances r1, r2  .rolesTaken, if .relationship(r1.getClass, r2.getClass) == incompatibility, mark agent  as potential role incompatibility with a self-loop. Setting up interaction relationships: for each agent , set up the interaction relationship between agent  and other agents from the same agent society  as the following : for any agent instance   .agentInstances, where   , if  r1  .rolesTaken, r2  .rolesTaken such that .relationship(r1.getClass, r2.getClass) == association, then (, )  dom .interaction. 10/21/2005 CIS Dept., UMass Dartmouth 17
View full slide show




Schreiber, Schwöbbermeyer [12] proposed flexible pattern finder (FPF) in a system Mavisto.[23] It exploits downward closure , applicable for frequency concepts F2 and F3. The downward closure property asserts that the frequency for sub-graphs decrease monotonically by increasing the size of sub-graphs; but it does not hold necessarily for frequency concept F1. FPF is based on a pattern tree (see figure) consisting of nodes that represents different graphs (or patterns), where the parent is a sub-graph of its children nodes; i.e., corresp. graph of each pattern tree’s node is expanded by adding a new edge of its parent node. At first, FPF enumerates and maintains info of all matches of a sub-graph at the root of the pattern tree. Then builds child nodes of previous node by adding 1 edge supported by a matching edge in target graph, tries to expand all of previous info about matches to the new sub-graph (child node).[In next step, it decides whether the frequency of the current pattern is lower than a predefined threshold or not. If it is lower and if downward closure holds, FPF can abandon that path and not traverse further in this part of the tree; as a result, unnecessary computation is avoided. This procedure is continued until there is no remaining path to traverse. It does not consider infrequent sub-graphs and tries to finish the enumeration process as soon as possible; therefore, it only spends time for promising nodes in the pattern tree and discards all other nodes. As an added bonus, the pattern tree notion permits FPF to be implemented and executed in a parallel manner since it is possible to traverse each path of the pattern tree independently. But, FPF is most useful for frequency concepts F2 and F3, because downward closure is not applicable to F1. Still the pattern tree is still practical for F1 if the algorithm runs in parallel. It has no limitation on motif size, which makes it more amenable to improvements. ESU (FANMOD) Sampling bias of Kashtan et al. [9] provided great impetus for designing better algs for NM discovery, Even after weighting scheme, this method imposed an undesired overhead on the running time as well a more complicated impl. It supports visual options and is time efficient. But it doesn’t allow searching for motifs of size 9. Wernicke [10] RAND-ESU is better than jfinder, based on the exact enumeration algorithm ESU, has been implemented as an app called FANMOD.[10] Rand-esu is a discovery alg applicable for both directed and undirected networks. It effectively exploits an unbiased node sampling, and prevents overcounting sub-graphs. RAND-ESU uses DIRECT for determining sub-graph significance instead of an ensemble of random networks as a Null-model. DIRECT estimates sub-graph # w/oexplicitly generating random networks.[10] Empirically, DIRECT is more efficient than random network ensemble for sub-graphs with a very low concentration. But classical Null-model is faster than DIRECT for highly concentrated sub-graphs.[3][10] ESU alg: We show how this exact algorithm can be modified efficiently to RAND-ESU that estimates sub-graphs concentrations. The algorithms ESU and RAND-ESU are fairly simple, and hence easy to implement. ESU first finds the set of all induced sub-graphs of size k, let Sk be this set. ESU can be implemented as a recursive function; the running of this function can be displayed as a tree-like structure of depth k, called the ESU-Tree (see figure). Each of the ESU-Tree nodes indicate the status of the recursive function that entails two consecutive sets SUB and EXT. SUB refers to nodes in the target network that are adjacent and establish a partial sub-graph of size |SUB|≤k. If |SUB|=k, alg has found induced complete sub-graph, Sk=SUB ∪Sk. If |SUB|v} graphs of size 3 in the target graph. call ExtendSubgraph({v}, VExtension, v) endfor Leaves: set S3 or all of size-3 induced sub-graphs of the target graph (a). ESUtree nodes incl 2 adjoining sets: adjacent ExtendSubgraph(VSubgraph, VExtension, v) nodes called SUB and EXT=all adjacent if |VSubG|=k output G[VSubG] return 1 SUB node and where their numerical While VExt≠∅ do Remove arbitrary vertex w from VExt labels > SUB nodes labels. EXT set is VExtension′←VExtension∪{u∈Nexcl(w,VSubgraph)|u>v} utilized by the alg to expand a SUB set call ExtendSubgraph(VSubgraph ∪ {w}, VExtension′, v) until it reaches a desired size placed at return lowest level of ESU-Tree (or its leaves).
View full slide show




Syntatic Sugar - a bunch of static’s public static Tree leaf () { return new Tree(); } public static Tree node (Object val, Tree lt, Tree rt) { return new Tree(val, lt, rt); } public static boolean isLeaf (Tree t) { return t.isLeaf; } public static Object getValue(Tree t) { return t.getValue(); } public static Tree getLeft(Tree t) { return t.getLeft(); } public static Tree getRight(Tree t){ return t.getRight(); } public static void setValue (Tree t, Object newValue) { t.setValue(newValue); } public static void setLeft (Tree t, Tree newLeft) { t.setLeft(newLeft); } public static void setRight (Tree t, Tree newRight) { t.setRight(newRight); } // using the new notation: Tree T = leaf(); T = node("A", leaf(), leaf()); Tree tl = node("B", leaf(), leaf()); Tree tr = node("C", leaf(), leaf()); setLeft(T, tl); setRight(T, tr); setValue(getLeft(T),new Integer(5)); setRight(T, getRight(getRight(T)) ); 17 - 18
View full slide show




Syntatic Sugar public static Tree leaf () { return new Tree(); } public static Tree node (Object val, Tree lt, Tree rt) { return new Tree(val, lt, rt); } public static boolean isLeaf (Tree t) { return t.isLeaf; } public static Object getValue(Tree t) { return t.getValue(); } public static Tree getLeft(Tree t) { return t.getLeft(); } public static Tree getRight(Tree t){ return t.getRight(); } public static void setValue (Tree t, Object newValue) { t.setValue(newValue); } public static void setLeft (Tree t, Tree newLeft) { t.setLeft(newLeft); } public static void setRight (Tree t, Tree newRight) { t.setRight(newRight); } Tree T = leaf(); T = node("A", leaf(), leaf()); Tree tl = node("B", leaf(), leaf()); Tree tr = node("C", leaf(), leaf()); setLeft(T, tl); setRight(T, tr); setValue(getLeft(T),new Integer(5)); setRight(T, getRight(getRight(T)) );17 - 22
View full slide show




IEEE Std 1076.3 Packages Numeric_Bit  Comparison operators - various combinations of signed and unsigned arguments FUNCTION FUNCTION “>” “>” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean; FUNCTION “<” (l,r:unsigned) RETURN boolean; FUNCTION “<” (l,r:unsigned) RETURN boolean; FUNCTION FUNCTION “<=” “<=” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean; FUNCTION “>=” (l,r:unsigned) RETURN boolean; FUNCTION “>=” (l,r:unsigned) RETURN boolean; FUNCTION FUNCTION “=” “=” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean; FUNCTION FUNCTION “/=” “/=” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean;  Shift and rotate functions FUNCTION FUNCTION shift_left shift_left (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION shift_right (arg:unsigned; count:natural) RETURN FUNCTION shift_right (arg:unsigned; count:natural) RETURN unsigned; unsigned; FUNCTION rotate_left (arg:unsigned; count:natural) RETURN unsigned; FUNCTION rotate_left (arg:unsigned; count:natural) RETURN unsigned; FUNCTION FUNCTION rotate_right rotate_right (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION FUNCTION sll sll (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION slr (arg:unsigned; count:natural) RETURN unsigned; FUNCTION slr (arg:unsigned; count:natural) RETURN unsigned; FUNCTION FUNCTION rol rol (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION ror (arg:unsigned; count:natural) RETURN unsigned; FUNCTION ror (arg:unsigned; count:natural) RETURN unsigned; 24/03/19 UAH-CPE528 8
View full slide show




IEEE Std 1076.3 Packages Numeric_Bit  Comparison operators - various combinations of signed and unsigned arguments FUNCTION FUNCTION “>” “>” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean; FUNCTION “<” (l,r:unsigned) RETURN boolean; FUNCTION “<” (l,r:unsigned) RETURN boolean; FUNCTION FUNCTION “<=” “<=” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean; FUNCTION “>=” (l,r:unsigned) RETURN boolean; FUNCTION “>=” (l,r:unsigned) RETURN boolean; FUNCTION FUNCTION “=” “=” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean; FUNCTION FUNCTION “/=” “/=” (l,r:unsigned) (l,r:unsigned) RETURN RETURN boolean; boolean;  Shift and rotate functions FUNCTION FUNCTION shift_left shift_left (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION shift_right (arg:unsigned; count:natural) RETURN FUNCTION shift_right (arg:unsigned; count:natural) RETURN unsigned; unsigned; FUNCTION rotate_left (arg:unsigned; count:natural) RETURN unsigned; FUNCTION rotate_left (arg:unsigned; count:natural) RETURN unsigned; FUNCTION FUNCTION rotate_right rotate_right (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION FUNCTION sll sll (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION slr (arg:unsigned; count:natural) RETURN unsigned; FUNCTION slr (arg:unsigned; count:natural) RETURN unsigned; FUNCTION FUNCTION rol rol (arg:unsigned; (arg:unsigned; count:natural) count:natural) RETURN RETURN unsigned; unsigned; FUNCTION ror (arg:unsigned; count:natural) RETURN unsigned; FUNCTION ror (arg:unsigned; count:natural) RETURN unsigned; 24/03/19 UAH-CPE528 24
View full slide show




Sample Driver For Array Implementation // Program file: TreeDriver.cpp ////////////////////////////////// // This program illustrates the // // creation of a binary tree. // ////////////////////////////////// #include #include "BinTree.h" using namespace std; void print_tree(binary_tree &tree); // The main function queries the // // user for new tree elements. // void main() { binary_tree tree; int number; cout << "Enter a number: "; cin >> number; while (number > 0) { tree.insert(number); tree.display_array(); cout << "Enter a number: "; cin >> number; } } CS 240 // The print_tree function outputs the final // // contents of the tree, first by displaying // // the entire array, then by printing out // // the non-vacant tree elements in inorder, // // preorder, and postorder. // void print_tree(binary_tree &tree) { cout << "Array contents:" << endl; tree.display_array(); cout << endl << "Inorder traversal: " << endl; tree.inorder_traverse(0); cout << endl; cout << "Preorder traversal: " << endl; tree.preorder_traverse(0); cout << endl; cout << "Postorder traversal: " << endl; tree.postorder_traverse(0); cout << endl << endl; } print_tree(tree); 14
View full slide show




IEEE Std 1076.3 Packages Numeric_Bit  Resize functions FUNCTION FUNCTION resize resize (arg:unsigned;new_size:natural) (arg:unsigned;new_size:natural) RETURN RETURN unsigned; unsigned; FUNCTION resize (arg:signed;new_size:natural) RETURN signed; FUNCTION resize (arg:signed;new_size:natural) RETURN signed;  Conversion functions FUNCTION FUNCTION to_integer to_integer (arg:unsigned) (arg:unsigned) RETURN RETURN natural; natural; FUNCTION to_unsigned (arg,size:natural) RETURN FUNCTION to_unsigned (arg,size:natural) RETURN unsigned; unsigned;  Logical operators FUNCTION FUNCTION “not” “not” (l:unsigned) (l:unsigned) RETURN RETURN unsigned; unsigned; FUNCTION “and” (l,r:unsigned) RETURN FUNCTION “and” (l,r:unsigned) RETURN unsigned; unsigned; FUNCTION FUNCTION “or” “or” (l,r:unsigned) (l,r:unsigned) RETURN RETURN unsigned; unsigned; FUNCTION “nand” (l,r:unsigned) RETURN FUNCTION “nand” (l,r:unsigned) RETURN unsigned; unsigned; FUNCTION “nor” (l,r:unsigned) RETURN unsigned; FUNCTION “nor” (l,r:unsigned) RETURN unsigned; FUNCTION FUNCTION “xnor” “xnor” (l,r:unsigned) (l,r:unsigned) RETURN RETURN unsigned; unsigned;  Edge detection functions FUNCTION FUNCTION rising_edge(SIGNAL rising_edge(SIGNAL s:bit) s:bit) RETURN RETURN boolean; boolean; FUNCTION falling_edge(SIGNAL s:bit) RETURN FUNCTION falling_edge(SIGNAL s:bit) RETURN boolean; boolean; 24/03/19 UAH-CPE528 9
View full slide show




IEEE Std 1076.3 Packages Numeric_Bit  Resize functions FUNCTION FUNCTION resize resize (arg:unsigned;new_size:natural) (arg:unsigned;new_size:natural) RETURN RETURN unsigned; unsigned; FUNCTION resize (arg:signed;new_size:natural) RETURN signed; FUNCTION resize (arg:signed;new_size:natural) RETURN signed;  Conversion functions FUNCTION FUNCTION to_integer to_integer (arg:unsigned) (arg:unsigned) RETURN RETURN natural; natural; FUNCTION to_unsigned (arg,size:natural) RETURN FUNCTION to_unsigned (arg,size:natural) RETURN unsigned; unsigned;  Logical operators FUNCTION FUNCTION “not” “not” (l:unsigned) (l:unsigned) RETURN RETURN unsigned; unsigned; FUNCTION “and” (l,r:unsigned) RETURN FUNCTION “and” (l,r:unsigned) RETURN unsigned; unsigned; FUNCTION FUNCTION “or” “or” (l,r:unsigned) (l,r:unsigned) RETURN RETURN unsigned; unsigned; FUNCTION “nand” (l,r:unsigned) RETURN FUNCTION “nand” (l,r:unsigned) RETURN unsigned; unsigned; FUNCTION “nor” (l,r:unsigned) RETURN unsigned; FUNCTION “nor” (l,r:unsigned) RETURN unsigned; FUNCTION FUNCTION “xnor” “xnor” (l,r:unsigned) (l,r:unsigned) RETURN RETURN unsigned; unsigned;  Edge detection functions FUNCTION FUNCTION rising_edge(SIGNAL rising_edge(SIGNAL s:bit) s:bit) RETURN RETURN boolean; boolean; FUNCTION falling_edge(SIGNAL s:bit) RETURN FUNCTION falling_edge(SIGNAL s:bit) RETURN boolean; boolean; 24/03/19 UAH-CPE528 25
View full slide show




Step 2: Tree class • Create a new Tree class • Has 2 fields: a triangle for the top & a rectangle for the trunk • Has 3 constructors: – Default – One with 4 parameters: x, y, width, & height – One with 6 parameters: x, y, width, height, topColor, trunkColor • Getters/setters for topColor, trunkColor • Has a public setBounds method that takes: x, y, width, height – (Might want to add this method to Triangle and Rectangle, but you don’t need to as you can use setX, setY, setWidth, and setHeight) – Tree should start at x, y and extend to width & height – Top and trunk should be relative to one another and to size of tree: • Trunk 1/4 height of tree, 1/5 width • Top 3/4 height of tree, full width • Has a paintComponent method that has a Graphics parameter and calls the corresponding paintComponent methods for the 2 fields • Test: add Tree(s) to Picture class, use different constructors, change the size of the Tree in the constructor or init method and test that it Created by Emily Hill & Jerry Alan Fails works
View full slide show