280 likes | 391 Views
Taems / MASS Technical Overview. Bryan Horling University of Massachusetts bhorling@cs.umass.edu. R égis Vincent SRI vincent@ai.sri.com. Overview. Taems - a language for modeling the quantitative behavior of tasks and task interactions
E N D
Taems / MASS Technical Overview Bryan Horling University of Massachusetts bhorling@cs.umass.edu Régis Vincent SRI vincent@ai.sri.com
Overview • Taems - a language for modeling the quantitative behavior of tasks and task interactions • MASS - a simulation environment that uses Taems as the basis of agent activity
Source and Licensing • Java implementations of Taems and MASS are available • Java 1.3+ • Source is included • Apache 2.0 License • http://mas.cs.umass.edu/download.html (Forthcoming from GITI as well)
Documentation • Implementation • JavaDoc APIs available online • Topic-specific HOWTOs online • Sample code in JAF distribution • These slides • Concepts • Taems white paper • Various publications (see Taems and MASS webpages) http://mas.cs.umass.edu/
High-Level Overview Agent Agent Agent New Taems Structure Action Started Communication Action Completed Communication MASS Manages Time Simulates Method Execution Enforces Taems Semantics Reports Activity Results
Taems at a glance • Task groups represent goals • Tasks represent a sub-goal • Methods are executable primitives • Resources model resource state • Interrelationships model interactions between nodes • QAFs specify how quality is accrued from sub-tasks
Inside a Taems Structure • Directed graph, made up of nodes • Each node has a set of defined properties • Methods have outcomes • Interrelationships define effect, etc. • These fields are explained in the white paper method name Vacuum-Floor agent Me supertasks Clean-Floor quality_distribution 5.0 1.0 duration_distribution 10.0 1.0 cost_distribution 0.0 1.0 facilitates name Facilitates_1 from Vacuum-Floor to Wash-Floor quality_power 0.3 1.0 duration_power 0.2 1.0 cost_power 0.0 1.0 nodes
Constructing Taems Structures • Textual Taems (ttaems) (spec_agent (label Me) ) (spec_task_group (label Clean-Kitchen) (agent Me) (subtasks Clean-Floor Wash-Counters Put-Away-Dishes) (qaf q_sum) ) (spec_task (label Clean-Floor) (agent Me) (subtasks Vacuum-Floor Wash-Floor) (supertasks Clean-Kitchen) (qaf q_max) ) (spec_task (label Put-Away-Dishes) (agent Me) (subtasks Slow-And-Safe Quick-And-Dirty) (supertasks Clean-Kitchen) (qaf q_exactly_one) ) (spec_method (label Vacuum-Floor) (agent Me) (supertasks Clean-Floor) (outcomes (Outcome_1 (density 1.0) (quality_distribution 5.0 1.0) (duration_distribution 10 1.0) (cost_distribution 0 1.0) ) ) ) (spec_method (label Wash-Floor) (agent Me) (supertasks Clean-Floor) (outcomes (Outcome_1 (density 1.0) (quality_distribution 7.0 1.0) (duration_distribution 15 1.0) (cost_distribution 0 1.0) )
Constructing Taems Structures • Visual Editor - taemsview
Pre-Taems • Preprocessed Taems (ptaems) • Taems template language • Parameterizable, dynamically generate many structures from one specification • Conceptually similar to C preprocessor directives • Variables (#define) • Control structures (e.g., #if, #while) • Functions (e.g., #sum, #prod, #random_float) foo.ptaems foo.ttaems parameters preprocess parse foo
Reading Taems • Taems library includes a parser: ReadTTaems reader = new ReadTTaems(null) Taems task = reader. readTTaems(stream); • pTaems: PreProcessorParser parser = new PreProcessorParser(stream); PreProcessor preprocessor = parser.Input(); Hashtable parameters = new Hashtable(); String processed = preprocessor.toTTaems(parameters); Taems task = readTTaems(new StringReader(processed )); • Parsers are created by JavaCC, source is included
Writing Taems • Taems object may be converted to its textual representation • For communication, storage, etc. String text = task.toString() String text = task.toTTaems(Taems.V1_0) • Individual nodes may be stringified similarly • Taems object is also serializable
Visualizing Taems • Taems object is a JPanel • Simply add it to a frame to visualize JFrame frame = new JFrame("Taems Task Structure"); frame.getContentPane().add(task, BorderLayout.CENTER); frame.setVisible(true); • Display is updated as changes are made • Can also edit using this interface (danger!)
Accessing Nodes • Node is the base class for most Taems structures (tasks, methods, IRs, resources, etc.) • The Taems object itself is a container for Node objects (among other things) for (Enumeration e = task.getNodes(); e.hasMoreElements(); ) { Node node = (Node)e.nextElement(); if (node instanceof Task && ((Task)node).isTaskGroup()) n++; } // end countTaskGroups • Graph structure exists in the relationships each Node possesses, e.g., Task.getSubtasks() TaskBase.getSupertasks() Interrelationship.getFrom() & getTo()
Modifying Nodes • All of the structure’s characteristics can be modified using accessors Task.setQAF() Method.addOutcome() Interrelationship.setEndpoints() Resource.setState() Node.setAgent() Interrelationship.setActive() ConsumesInterrelationship.setConsumes() etc… • These can be used to read and change structural properties
Analyzing Taems • Finding classes of nodes Enumeration e = t.findNodes(new Resource()); while (e.hasMoreElements()) { Resource r = (Resource)e.nextElement(); } // end resourceWalker Enumeration e = t.findNodes(new Node(“Foobar”)); while (e.hasMoreElements()) { Node r = (Node)e.nextElement(); } // end foobarFinder • Automatic state propagation • (e.g., cost, quality, duration) method.setCurrentQuality() taskgroup.getCurrentQuality()
Things not covered here… • Schedule, ScheduleElement • For storing activity schedules • Commitments • Represent results of coordination • Attributes • For tagging nodes with arbitrary data • Nonlocal methods • Actions that one cannot perform locally • Merging Taems structures • See Taems.unionTaems
MASS • Interface/GUI • Demo • Time/pulse driven • Pulse cycle • Scripting
Event queue Script queue Global Task Structure Display Control Environment Resources MASS GUI
Features • Resources modeling • Scripting capabilities • Separate “actual” and “perceived” states • what the participants believe may not be true • Time and Event based • Logging • Deterministic • to allow for the re-testing of modified components
Agent Manager Clock • Centralized (at simulation controller) • Discrete, pulse-based • During each cycle • a pulse is sent to each attached client • each client converts the pulse to actual CPU time • upon completion, each client responds to the simulator • when all responses have been received, simulation continues start finished
Event Queue • Event based system • simulated execution • message transfer • environmental • Events have both a start and duration time • During each cycle • the list of extant events is retrieved for that time slot • each event is given a time slice to run in events 1 2 3 4 1 2 time 3 4 5
Scripting • Highly customizable scripting language • Format: Script, ScriptClassName, ScriptSpecificName, Data Assertion, Assertion1ClassName, Data … Assertion, Assertion3ClassName, Data Reaction, Reaction1ClassName, Data … Reaction, Reaction2ClassName, Data • Over 50 pre-defined scripts: Assertion, AgentConnected, Agent:WaterHeater Assertion, ResourceLevelCompare, Resource1:Kitchen_Temp, Op:>, Resource2:LivingRoom_Temp Reaction, SendMessage, Agent:WaterHeater, Perf:ask, CW:disconnect, Control:True Reaction, SendCommitment, Label:tests, Importance:30, MinQuality:60, EarliestStartTime:10, Deadline:20, TimeSatisfied:450, ToAgent:* • Example: Script, AndScript, Agent Disconnect Status, Assertion, NumAgentConnected, Op:<, Value:5 Assertion, Time, Op:>, Value:10 Reaction, Write, Line:Stopping Simulation! Reaction, StopSim
MASS Agents • GITI/Grid Agent • CoABS grid agent • Interfaces to MASS • Available shortly • JAF (Java Agent Framework) • Component-based agent framework • Uses Taems • Available at http://mas.cs.umass.edu
MASS Interface • Hand-shake: • A->S: (register :sender ExampleAgent :type control :content :receiver simulator :language KQML) • S->A: (tell :sender simulator :type control :content (Name ExampleAgent ) :receiver ExampleAgent :language KQML) • Init: • S->A: (tell :sender simulator :type control :content (RandomSeed 889210829049 ) :receiver ExampleAgent :language KQML) • S->A: (tell :sender simulator :type control :content (Time 0 ) :receiver ExampleAgent :language KQML) • Pulsing: • S->A: (tell :sender simulator :content (pulse) :type control :reply-with (pulse) :receiver ExampleAgent :language KQML) • A->S: (reply :sender ExampleAgent :in-reply-to pulse :content (ack pulse) :receiver simulator :language KQML)
MASS Interface 2 • New TAEMS structure: • A->S: (tell :sender ExampleAgent :content (AddTaems….) :receiver simulator :language KQML) • Execution of method: • Activation: • Termination • Query of resources: • S->A: (reply :sender simulator :content (R1 value min max) :in-reply-to ??? :receiver ExampleAgent :type control :language KQML) • Reset: • S->A: (ask :sender simulator :content (reset) :receiver ExampleAgent :type control :reply-with (reset) :language KQML)
MASS Interface 3: Inter-agent communications: • Point-to-point • Broadcast