• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

International Conference on Cognitive Modeling 2010 Brahms tutorial

on

  • 1,484 views

This presentation is the course work for the Brahms tutorial given at the 2010 International Conference on Cognitive Modeling. Brahms is a Multi-Agent Modeling and Simulation Environment for Human ...

This presentation is the course work for the Brahms tutorial given at the 2010 International Conference on Cognitive Modeling. Brahms is a Multi-Agent Modeling and Simulation Environment for Human Behavior and Work Practice.

Statistics

Views

Total Views
1,484
Views on SlideShare
1,484
Embed Views
0

Actions

Likes
2
Downloads
17
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • One of the biggest objectives of the Apollo 12 mission was to deploy the Apollo Lunar Surface Experiments Package (ALSEP). All the ALSEP instruments and tools used for deployment, were stored on 2 sub-pallets (“packages”) in the Scientific Equipment Bay (SEQ Bay) during flight.

International Conference on Cognitive Modeling 2010 Brahms tutorial International Conference on Cognitive Modeling 2010 Brahms tutorial Presentation Transcript

  • Introduction to Brahms Multi-Agent Activity Modeling with the Brahms Environment Maarten Sierhuis, Ph.D. Area Manager Knowledge, Language & Interaction Palo Alto Research Center (PARC ® ) [email_address] NASA Ames Associate [email_address]
  • NASA ARC Brahms Team
    • Co-PI - William J. Clancey, Ph.D.
    • Co-PI - Maarten Sierhuis, Ph.D.
    • Software Architect - Ron van Hoof
    • Software Developer - Mike Scott
    • Brahms Modeler - Chin Seah
  • Download This Tutorial From
    • http://public.me.com/msierhuis/ICCM2010/Brahms ICCM 2010 Tutorial (final).ppt
  • Schedule
    • 1:00pm – 2:00pm
      • Work Practice Modeling
      • Brahms Overview + Demo
    • 2:00pm – 2:30pm
      • Agents, Groups, Beliefs and Facts
      • Classes and Objects
    • 2:30pm – 3:00pm
      • Break
    • 3:00pm – 3:30pm
      • Thoughtframes
      • Geography
    • 3:30pm – 4:30pm
      • Activities and Workframes
      • Composite Activities
      • Agent Communication
  • Human-Centered Design
    • A different engineering approach
    • Start with understanding people’s practice
      • Both the way people collaborate, as well as the culture of an organization is encompassed in the communities of practice of an organization—the work practices of the people (Wenger, 1998)
    • What is Practice?
      • People’s collaboration, “off-task” behaviors, multi-tasking, interrupted and resumed activities, informal interaction, knowledge and use of space (geography)
      • It’s the way people work
    • Human-Centered Design Methodology
      • Understanding or designing a work system by modeling and simulating people’s work practice
    • Design information systems in the context of work
      • It’s all about understanding the context
    • Hermeneutics and Work Practice (Winograd & Flores)
      • Interpreting the world in order to act
    • Situated Action Models (Suchman, Lave)
      • Moment-by-moment analysis of interaction between people, tools and environment in a particular situation (or setting).
    • Activity Theory (Vygotsky, Leont’ev, Nardi)
      • An activity creates and encompasses the context through its enactment of actions and operations of the people engaged, and the artifacts used.
    • Distributed Cognition (Hutchins)
      • The study of representation of knowledge both inside people’s heads and in the artifacts and systems they use, i.e. the total cognitive system (e.g. the pilots and the cockpit).
    Understanding Context
  • What is practice?
    • Sierhuis’ Definition:
    • situated activities of a group of people
    • synchronously or asynchronously
    • collaborating and communicating
    • gaining experience
    • Practice is “doing-in-action” (Suchman, ’87)
    • “ Collective learning results in practices.” (Wenger, ‘97)
    What is it that results? Can it be described? Can it be modeled?
  • Work Practice Modeling
    • Groups & Agents
      • work as activities
      • beliefs trigger work
      • bounded rationality is socially and culturally defined
    • Collaboration between Agents
      • agents react to and interact with other agents
      • same time/same place
      • same time/different place
      • different time/same place
      • different time/different place
  • WPM cont’d
    • Tools & Artifacts
      • tools used in activities
      • artifacts created in activities
    • Environment/Geography
      • agents have a location
      • artifacts have a location
      • detecting real-world facts
    • Communication
      • is situated
      • the means of communication depends on the situation (e.g. voice loop, f2f communication, telephone, faxing, e-mail)
      • impacts efficiency of work
  • “ Day in the life” (DITL) Model
    • Description of a day in the life of a …
      • Person
      • Group of people
    • Abstraction of what people do during the day …
      • Activities
      • Interactions
      • Locations
      • Use of systems and artifacts
  • Brahms
    • How people work together
    • How people get to participate in a collaborative activity
    • Role of the environment / use of space
    • How communication happens
    • The tools and artifacts used
    • Individual motives, history and culture
    • Not just problem-solving activities
    • Brahms is a agent-based modeling and simulation environment
    • Simulation as a work system design/analysis tool
    • Agents represent social and collaborative Humans
    • Agents are situated, deliberative, cognitive and reactive
    • Understanding how people really work
    • Developing multi-agent systems
    Theoretical Practical
  • From Simulation to Implementation
  • 2 4 6 8 10 TRL 1992 1996 2000 2004 2008 NYNEX/IRL JPL JSC APOLLO VICTORIA ISS Mission Control BRAHMS – HISTORY OF APPLICATIONS ISS Surface Hab Mobile Agents Onboard ISS 2011
  • Brahms Overview The Language
  • Brahms Work is like a symphony, Well rehearsed, but always different
  • History Social Systems of Work Work Practice Communities of Practice Work Process Modeling Expert Systems 1992 - 1997 1998 - Now Agents Simulation Ethnography CommonKADS
  • Types of Agent Languages Goal
  • Brahms Agent Environment
    • Composer for building models.
      • (or Integrated Development Environment).
    • Compiler for compiling models.
    • Virtual Machine for simulating models.
      • (or Simulation Engine).
    • Agent Viewer for viewing simulations.
  • Where to download Brahms?
  • Brahms Use License
    • Brahms Research License
      • Free use for research purposes
      • Download Brahms from AiS website
      • Receive license file to be installed on your machine
    • Brahms Commercial License
      • Used for any commercial application of Brahms
      • Contact Maarten Sierhuis
  • Brahms Download
    • “ Brahms Agent Environment”.
      • Go to http://www.agentisolutions.com/download/index.htm
    • Requires MySQL 5.x. database to be installed.
      • Go to http://www.mysql.com
      • Note: Read AgentViewer_Readme.html to set the appropriate privileges for the anonymous database user.
    • Requires a Brahms License file.
      • Sent to you when signed up
    • Install Brahms Eclipse Plugin from AiS
  • Brahms Installation Check out Brahms Files
    • Files created by the Brahms installation are in:
    • C:Program Files BrahmsAgentEnvironment
  • Language Documentation
  • Brahms Tutorial
  • Brahms Language
    • Agent Oriented / BDI
      • Agents are first-class citizens
      • Agents are belief based
      • Agents are intention based:
        • Beliefs become intentions that trigger reasoning- and/or situation-action rules
      • Agents can communicate
    • Organizational Modeling
      • Agents can be modeled within a hierarchical member-of inheritance structure
    • Object-based
      • Objects can represent physical artifacts, data and concepts to reason with
      • Integration of Java objects as data objects, Java activities and Java agents
    • Geography-based
      • Areas can be conceptual representations of locations
      • Areas can be located within other areas, creating a hierarchical environment model
      • Agents and objects can be located within an area
  • Anatomy of a Brahms Model
    • Groups and Agents
      • Groups contains agents which are located in a
    • Geography
      • and these situated agents have
    • Beliefs and Facts
      • that lead them to engage in
    • Activities
      • that take a certain amount of time which are specified within an agent’s
    • Workframes
      • that are triggered by agent’s beliefs. Activities can change an agent’s beliefs or affect
    • Classes and Objects
      • which could then change facts in the world. Facts can be detected by agents and change an agent’s beliefs which might triggers an agent’s
    • Thoughtframes
      • that can further change an agent’s beliefs and trigger an agent’s workframe.
    Group = Student, Agent = Alex Geography = Berkeley, CA Belief = Alex is hungry Activity = Eating Workframe = When hungry go eat Object = Money, Debit card, ATM Thoughtframe = If no money go to the ATM machine
  • Anatomy of a Brahms Model Language Concepts
    • Groups
    • Agents
    • Classes
    • Objects
    • AreaDefs
    • Areas
    • Paths
    • Conceptual Classes
    • Conceptual Objects
    • Attributes (OA-V)
    • Relations (ORO)
    • Beliefs
    • Facts
    • Activities
    • Workframes
    • Preconditions
    • Consequences
    • Detectables
    • Thoughtframes
    agent-based object-based geo-based object flows mental state/world state activity-based/ subsumption rule-based reactive inferences
  • Time-based Situation-Action
    • Production Rules represent Qualitative Relationships !!
    • Situation-action Rules
    World State F1, F2, F4 ….. E4 Detect F4
  • Brahms: agent-oriented language Symbolic Discrete Event BDI System
    • Production and Situation-action Rules
    WF1 C1 and C2 and C3 => Detect F4, Activity1(t), B5, B7 WF2 C4 => Activity2(t), B6 WF3 C5 and C6 and C7 => Detect F8, Activity1(t), F9 F1, F2, F4 ….. Workframe Rule Memory Belief Memory Agent World State B1, B2, B3, ……….. Next time event State at next time event TF1 C1 and C5 => B2 TF2 C8 => B9 TF3 C9 and C6 and C8 => B10 Thoughtframe Rule Memory
  • Brahms Agent Engine Beliefs (atomic formulas) Desires (workframes thoughtframes belief matching) Plans (workframes Thoughtframes activities) Intentions (workframes thoughtframes instantiations) input action output Beliefs-Desires-Intentions
  • Multiagent Language BRAHMS Virtual Machine Java VM Event Scheduler T:0 belief X T:1 fact Y … . … . T:N belief Z World State fact F1 . fact Fn fact Y Java Activity class Activity2 extends AbstractExternalActivity { …. } class Agent5 extends AbstractExternalAgent { …. } Java Agent 5 Brahms Geography
  • Brahms: Distributed MAS Agent Directory Service
  • Brahms Agent Engine
  • Architecture Interactive Development Environment Brahms Composer (Eclipse Plugin) Brahms: the environment
  • Model Development Cycle
    • Build Model in Composer
    • Compile Model
    • Fix compiler errors
    • Run Simulation
    • Parse History File  MySQL DB
    • Display Results in AgentViewer
    1 2
  • Composer: Eclipse Plugin
  • Model File
  • Composer: Eclipse Plugin
  • Compile Model
  • Model in UML (Poseidon) Compiler generates .XMI file
  • Simulate
  • Parse History File
  • History File Format
  • Brahms AgentViewer
  • DEMO
  • Schedule
    • 1:00pm – 2:00pm
      • Work Practice Modeling
      • Brahms Overview + Demo
    • 2:00pm – 2:30pm
      • Agents, Groups, Beliefs and Facts
      • Classes and Objects
    • 2:30pm – 3:00pm
      • Break
    • 3:00pm – 3:30pm
      • Thoughtframes
      • Geography
    • 3:30pm – 4:30pm
      • Activities and Workframes
      • Composite Activities
      • Agent Communication
  • Agents, Groups, Beliefs and Facts
  • What is a Brahms agent?
    • Agents model human behavior .
    • Agents could be autonomous intelligent systems
    • Attributes of an agent:
      • autonomy,
      • social ability,
      • reactivity,
      • pro-activeness,
      • mobility
      • bounded rationality.
  • Brahms Agent
    • agent agent-name { GRP. group-membership }
    • {
    • { display : ID. literal-string ; }
    • { cost : ID. number ; }
    • { time_unit : ID. number ; }
    • { location : ARE. area-name ; }
    • { icon : ID. literal-string ; }
    • { GRP. attributes }
    • { GRP. relations }
    • { GRP. initial-beliefs }
    • { GRP. initial-facts }
    • { GRP. activities }
    • { GRP. workframes }
    • { GRP. thoughtframes }
    • }
    • external agent agent-name ;
      • See Brahms Language Reference
    • http://www.agentisolutions.com/documentation/language/ls_agt_stx.htm
    • You can refer to an agent using an agent reference:
    • agent-name
    • the keyword current
      • This refers to the current agent,
      • Like this in Java
    • frame variable
    • activity parameter
  • What is a Brahms group?
    • A Brahms group describes the abstract properties and behaviors of a group of agents
    • Types of groups:
      • Functional
      • Organizational
      • Social
      • Community of Practice
    • Groups can be members of multiple groups
    • Agents can be members of multiple groups
  • Brahms Group
    • group group-name { group-membership }
    • {
    • { display : ID. literal-string ; }
    • { cost : ID. number ; }
    • { time_unit : ID. number ; }
    • { icon : ID. literal-string ; }
    • { attributes }
    • { relations }
    • { initial-beliefs }
    • { initial-facts }
    • { activities }
    • { workframes }
    • { thoughtframes }
    • }
    • group-membership ::= memberof group-name [ , group-name ]*
      • See Brahms Language Reference
    • http://www.agentisolutions.com/documentation/language/ls_grp_stx.htm
  • Groups
    • group BaseGroup { … }
    • group Student memberof BaseGroup { … }
    • agent Alex memberof Student, BrahmsModeler { … }
    BaseGroup Student Alex Brahms Modeler
  • NASA Mission Control Org Chart Divisions Branches Groups Roles Agents
  • Apollo 12 Groups and Agents Roles Functions Agents
  • Brahms Groups, Agents and Attributes: What are Brahms attributes?
    • Attributes represent a property of a group/class or agent/object.
    • Attributes have values.
    • Scope of an attribute:
      • Private – cannot be inherited.
      • Protected – access only for members of group.
      • Public – access by any group or agent.
    • Attribute values are assigned or changed by asserting new beliefs or facts.
  • Typed Language
    • Value Types
    • Collection Types
    • Java Types
    • Meta Types
    • Value Assignments
      • See Brahms Language Reference
    • http://www.agentisolutions.com/documentation/language/ls_att_stx.htm
  • Value Types
    • Value Types are attribute types that assign a specific value
      • [ int | long | double | symbol | string | boolean ]
    • All types can have the value unknown
      • group Student {
      • attributes:
      • public boolean male; [unknown | true | false]
      • public int howHungry; [unknown | { + | - } unsigned]
      • private double preferredCashOut; [unknown | [ integer.unsigned ]
      • private long perceivedtime; [unknown | { + | - } unsigned { l | L }
      • public symbol colorHair; [unknown | [ letter ][ letter | digit | ‘ - ’ ]* ]
      • protected string name; [unknown | " [ letter | digit | ‘ - ’ | ‘ : ’ | ‘ ; ’ | ‘ . ’ ] ” ]
      • }
    • The only Collection Type is the map attribute type
      • [ map ]
    • Allows for the assignment of multiple values to the attribute where each value is addressable using an index or key.
    • The attribute values are index/value or key/value pairs . The index or key can be any positive integer or string value.
    • All types can have the value unknown
      • group Student {
      • attributes:
      • public map myMap;
      • }
    Collection Types myMap(1) = 10 myMap(2) = 20L myMap(3) = current myMap(4) = true myMap(5) = “a string” myMap(6) = asymbol myMap(7) = unknown myMap(“string1”) = 10 myMap(“string2”) = 20L myMap(“string3”) = current myMap(“string4”) = true myMap(“string5”) = “a string” myMap(“string6”) = asymbol myMap(“string7”) = unknown
    • The only Java Type
      • [ java ]
    • Allows direct references from Brahms to Java objects.
    • The compiler must be able to load the Java class for the type, the compiler uses this method to ensure that the Java type is valid. The Java classes for the types used in the Brahms language must therefore be in the Java classpath.
    • The Java type name must be resolvable to a fully qualified name using the Java import statements (jimport).
      • jimport gov.nasa.arc.brahms.modat.kfx.KfxFile;
      • group Student {
      • attributes:
      • public java(KfxFile) javaKfxFile;
      • }
    Java Types gov.nasa.arc.brahms.modat.kfx.KfxFile.java : public class KfxFile implements Serializable { }
    • Meta Types allow for binding of concepts that are considered to be a subtype of the meta types
    • Meta Types allow Brahms User Defined types as values of attributes, variables and parameters.
      • group Student {
      • attributes:
      • public Group myGroup;
      • }
    Meta Types Group ::= any group Agent ::= any agent Class ::= any class Object ::= any object ActiveClass := any group or class ActiveInstance ::= any agent or object ActiveConcept ::= any active class and active instance Concept ::= any active concept, conceptual concept and geography concept Example: Maarten.myGroup = Student
  • Brahms Facts & Beliefs: What is a Brahms belief?
    • Represents an agent’s interpretation of a fact in the world.
      • “ South Hall is 65 degrees but Alex believes its 80 degrees.”
    • Represents an agent’s conception of the world (s)he lives in.
      • “ I am a student at University of California, Berkeley.”
    • Beliefs are “local” to an agent.
    • Agents can reason about their beliefs.
    • Agents can communicate their beliefs.
  • Brahms Facts & Beliefs: What is a Brahms fact?
    • Represent some physical state of the world.
      • Alex is male is true.
    • Facts are globally true in the world.
    • Agents do not reason with or act directly on facts.
    • Agents can detect facts in the world ( noticing or sensing ).
  • Belief & Fact Grammar
    • ( [ value-expression | relational-expression ] )
    • value-expression ::= obj-attr equality-operator value | obj-attr equality-operator sgl-object-ref
    • equality-operator ::= = | !=
    • value ::= ID. literal-string | ID. number | PAC. param-name | unknown
    • Examples: (Alex.male = true)
    • (Alex.male != false)
    • (Alex.hasCash = cash-obj-1)
    • relational-expression ::= tuple-object-ref REL. relation-name sgl-object-ref { is ID. truth-value }
    • Examples: (Alex isMarriedTo Kim)
    • (Alex isMarriedTo Kim is false)
  • Belief Creation & Changes
    • Initial beliefs can be defined in agent or group
    • Initial beliefs are inherited via group membership
    • Beliefs can be created/changed using a conclude statement
    • Beliefs can be communicated by other agents or objects
    • Beliefs can be created by detecting facts
    • Beliefs can be automatically created by the agent’s engine
  • Initial Beliefs
    • group Student {
    • attributes:
    • public boolean male;
    • initial_beliefs:
    • (current.male = unknown);
    • }
    • agent Alex memberof Student {
    • }
    • agent Kim memberof Student {
    • initial_beliefs:
    • (current.male = false);
    • }
  • Beliefs versus Object Attribute values
    • Object Orientation
    • object Alex instanceof class student {
      • Public Boolean male = true;
    • }
    • object Kim instanceof class student {
      • Public Boolean male = false;
    • }
    • Belief-based
    • agent Alex memberof Student {
    • attributes:
    • public boolean male;
    • initial_beliefs:
    • (current.male = true);
    • (Kim.male = false);
    • }
    • agent Kim memberof Student {
    • attributes:
    • public boolean male;intial_beliefs:
    • (Alex.male = false);
    • (current.male = false);
    • }
  • Conclude a belief
    • The conclude statement can be used to create a new, or change an existing belief
    • conclude ( ( resultcomparison ) { , belief-certainty } { , fact-certainty } ) ;
    • resultcomparison::= [ result-val-comp | PRE. rel-comp ]
    • result-val-comp::= BEL. obj-attr BEL. equality-operator PRE. expression |BEL. obj-attr BEL. equality-operator ID. literal-symbol
    • |BEL. obj-attr BEL. equality-operator ID. literal-string
    • |BEL. obj-attr BEL. equality-operator BEL. sgl-object-ref
    • |BEL. tuple-object-ref BEL. equality-operator BEL. sgl-object-ref
    • belief-certainty::= bc : ID. unsigned
    • fact-certainty::= fc : ID. unsigned
    • conclude((current.male = true), bc:100, fc:0);
  • Relationship between Brahms Facts and Beliefs
  • Brahms Facts & Beliefs World Fact: (It is 10:40AM) Fact: (It is Thursday Nov. 19, 1969) Fact: (the door of the SEQBay is closed) Fact: (AlBean is located in the SEQBayArea) Fact: (PeteConrad is located in the SEQBayArea) Agent Al Bean belief: (the door of the SEQBay is closed) belief: (AlBean is located in the SEQBayArea) Agent Pete Conrad belief: (AlBean is located in the SEQBayArea) belief: (PeteConrad is located in the SEQBayArea) belief: (PeteConrad is ready to offload the ALSEP) belief: (PeteConrad is located in the SEQBayArea detect open open belief: (the door of the SEQBay is closed) belief: (PeteConrad is ready to offload the ALSEP) communicate
  • Classes and Objects
  • Brahms Objects
    • Objects are data and real world artifacts .
    • Objects could be inanimate objects or computational objects .
    • Why objects and agents?
      • Most agent languages only represent agents.
      • Brahms incorporates our theory of work practice, and from a social and practice perspective people do differentiate between intentional agents (i.e. humans) and artifacts
    • Examples:
      • Fax machines
      • Database
      • Instruments
      • Rock samples
      • Photo Cameras
      • Space Suits
      • ATM
  • Brahms Class
    • Describes the properties/behavior of abstract object classes
    • Types of classes:
      • Physical artifacts
      • Computers
      • Data
    • Multiple Inheritance
  • More on Brahms Objects
    • Objects do not need a location to exist and act in the world.
      • For example, Alex’s bank account.
    • Objects, unlike agents, can react to both facts and beliefs.
      • For example, data in a computer are beliefs but might not necessarily be facts.
    • Facts about objects defines the context
    • Agent beliefs about objects
      • Defines how people get to do what they do …
  • BREAK!!!
  • Schedule
    • 1:00pm – 2:00pm
      • Work Practice Modeling
      • Brahms Overview + Demo
    • 2:00pm – 2:30pm
      • Agents, Groups, Beliefs and Facts
      • Classes and Objects
    • 2:30pm – 3:00pm
      • Break
    • 3:00pm – 3:30pm
      • Thoughtframes
      • Geography
    • 3:30pm – 4:30pm
      • Activities and Workframes
      • Composite Activities
      • Agent Communication
  • Thoughtframes
  • What are some of Alex’s thoughts?
  • Example Thoughtframes
    • When student is studying Do
      • Read While You Study
    • While Reading, continously
      • Assess How Hungry You Are
      • Based on norms about how much you want to spend for lunch and how hungry you are, select how much cash you need
      • Based on needed cash and norms decide if you need to get money and how much
  • Need Cash To Eat?
    • IF amount of cash < preferred cash in pocket THEN need cash
    • IF amount of cash >= preferred cash in pocket THEN don’t need cash
  • How much cash needed?
    • IF need cash AND very hungry THEN take out $15 (remember it’s a student!)
    • IF need cash AND not very hungry THEN take out $10
    • IF need cash AND not hungry at all THEN take out $5
  • How hungry am I?
    • IF my hunger level > 20 THEN my hungriness is high
    • IF my hunger level <= 10 THEN my hungriness is low
    • IF 10 >= my hunger level <= 20 THEN my hungriness is medium
  • How long before I am hungry?
    • IF an hour has gone by THEN my hunger level goes up by 3
  • Thoughtframes
    • Thoughtframes are production rules
    • Conclude new beliefs
    • Do NOT take time
    • Allows representation of agent’s reasoning (inference).
    • Can be located inside composite activities
      • Activities constrain when an agent uses specific reasoning
    • Fire immediately whenever preconditions match beliefs.
    • Allows for implementation of problem solving activities
      • While “in” an activity, the agent reasons using its thoughtframes
      • Conclusions of new beliefs in TFs can execute new TFs, WFs and activities
  • Thoughtframes Syntax
    • thoughtframe thoughtframe-name {
    • display: literal-string;
    • repeat: truth-value;
    • priority: unsigned;
    • variables: variable declaration
    • when (precondition-declaration)
    • do {
    • thoughtframe-body-element
    • }
    • }
    • thoughtframe-name ::= name
    • thoughtframe-body-decl ::= do { [ thoughtframe-body-element ; ]* }
    • thoughtframe-body-element ::= CON.consequence
  • Preconditions
    • thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
    • when (knownval(current.needCash = true) and knownval(current.hungryness = high))
    • do conclude((current.preferredCashOut = 15), bc:100, fc:0);
    • }
    • }
    • precondition ::= [ known | unknown ] ( novalcomparison ) |
    • [ knownval | not ] ( evalcomparison )
      • See Brahms Language Reference
    • http://www.agentisolutions.com/documentation/language/ls_tfr_stx.htm
  • Knownval Precondition
    • thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
    • when ( knownval (current.needCash = true) and knownval (current.hungryness = high))
    • do { conclude((current.preferredCashOut = 15), bc:100, fc:0);
    • }
    • }
    • Assume agent Alex has the following beliefs:
      • (Alex.needCash = true)
      • (Alex.hungryness = high)
    • Knownval matches on Exists(belief b) [ (ObjOrAgt.attr = value) ] in agent’s belief-set
    • Both knownval preconditions are TRUE
    • You are allowed to leave the knownval keyword out
  • Not Precondition
    • thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
    • when ( not (current.needCash = true) and knownval(current.hungryness = high))
    • do { conclude((current.preferredCashOut = 15), bc:100, fc:0);
    • }
    • }
    • Assume agent Alex has the following beliefs:
      • (Alex.needCash = false)
      • (Alex.hungryness = high)
    • Not matches on Forall(belief b) [ not(ObjOrAgt.attr = value) ] in agent’s belief-set
    • Knownval precondition is TRUE
    • Not Precondition is TRUE, because not(Alex.needCash = true) equal to TRUE
  • Known Precondition
    • thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
    • when ( known (current.needCash) and knownval(current.hungryness = high))
    • do { conclude((current.preferredCashOut = 15), bc:100, fc:0);
    • }
    • }
    • Assume agent Alex has the following beliefs:
      • (Alex.needCash = true)
      • (Alex.hungryness = high)
    • Known matches on Exists(belief b) [ (ObjOrAgt.attr = <any-value>) ] in agent’s belief-set
    • Knownval precondition is TRUE
    • Known Precondition is TRUE, because (Alex.needCash = true)
  • Unknown Precondition
    • thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
    • when ( unknown (current.needCash) and knownval(current.hungryness = high))
    • do { conclude((current.preferredCashOut = 15), bc:100, fc:0);
    • }
    • }
    • Assume agent Alex has the following beliefs:
      • (Alex.needCash = true)
      • (Alex.hungryness = high)
    • Unknown matches on Forall(belief b) [ not(ObjOrAgt.attr = <any-value>) ] in agent’s belief-set
    • Knownval precondition is TRUE
    • Unknown Precondition is FALSE, because (Alex.needCash = true)
  • Where to define thoughtframes?
    • Within a group or agent
    • At the “top-level”
    • group Student {
    • attributes:
    • relations:
    • initial_beliefs:
    • initial_facts:
    • activities:
    • workframes:
    • thoughtframes:
    • thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
    • when ( (current.needCash = true) and
    • (current.hungryness = high) )
    • do {
    • conclude((current.preferredCashOut = 15), bc:100, fc:0);
    • } //do
    • } //tf_HowMuchMoneyToGet_HungryEQhigh
    • } //group Student
  • Where to define thoughtframes?
    • Inside a composite activity within a group or agent
    • Model problem-solving as an activity
    • group Student {
    • attributes:
    • relations:
    • initial_beliefs:
    • initial_facts:
    • activities:
    • composite_activity SolveCashOutProblem( ) {
    • activities:
    • workframes:
    • thoughtframes:
    • thoughtframe tf_PreferredCashOut {
    • when (( Alex_Cash .amount < 10.00))
    • do {
    • conclude( ( Alex_Cash .amount = Alex_Cash .amount + 10.00), bc:100, fc:0);
    • } //do
    • } //tf_PreferredCashOut
    • } // composite_activity SolveCashOutProblem
    • } //group Student
  • What are Brahms Variables?
    • Variables can be used in a Workframe or Thoughtframe to write more generic Workframes and Thoughtframes.
    • Before a variable can be used it has to be declared.
    • The scope of the variable is bound to the frame it is declared in.
  • Using Variables in Thoughtframe
    • thoughtframe tf_PreferredCashOut {
    • when( ( Alex_Cash .amount < 10.00))
    • do {
    • conclude(( Alex_Cash .amount = Alex_Cash .amount + 10.00));
    • } //do
    • } //tf_PreferredCashOut
    • thoughtframe tf_PreferredCashOut {
    • variables:
    • forone(Cash) cashobj ;
    • when((current.myCash = cashobj )
    • and
    • ( cashobj .amount < 10.00))
    • do {
    • conclude(
    • ( cashobj .amount = cashobj .amount + 10.00));
    • } //do
    • } //tf_PreferredCashOut
    Without Variable With Variable
  • Brahms Variable Types
    • Did you notice “ forone (cash) myCash” declaration statement?
    • Variables supports three quantifiers:
    • Foreach
      • binds to each belief-instance that can be bound to the variable, a separate frame instantiation is created.
    • Forone
      • binds to only one belief-instance, and only one frame is created. A forone variable binds to the first belief-instance found and ignores other possible matches.
    • Collectall
      • binds to more than one belief-instance. The variable is bound to all matching belief-instances, but only one frame is created .
      • See Brahms Language Reference
      • http://www.agentisolutions.com/documentation/language/ls_var_stx.htm
  • Forone Variable
    • Let’s assume three Cash objects: Cash-1, Cash-2, Cash-3
    • Forone binds to one of the Cash objects, e.g. Cash-3
    • Thoughtframe fires once!
    • Belief about Cash-3.amount is changed
    • thoughtframe tf_PreferredCashOut {
    • variables:
    • forone(Cash) cashobj ;
    • when(knownval(current.myCash = cashobj )
    • and
    • knownval( cashobj .amount < 10.00))
    • do {
    • conclude(
    • ( cashobj .amount = cashobj .amount + 10.00), bc:100, fc:100);
    • } //do
    • } //tf_PreferredCashOut
  • Foreach Variable
    • Let’s assume three Cash objects: Cash-1, Cash-2, Cash-3
    • Foreach binds to every Cash object, Cash-1, Cash-2, and Cash-3
    • Thoughtframe fires three times!
    • Once for each variable binding to one of the Cash objects
    • Beliefs about Cash-1.amount, Cash-2.amount and Cash-3.amount are changed
    • All at the same time, because thoughtframes take zero time!!
    • thoughtframe tf_PreferredCashOut {
    • variables:
    • foreach(Cash) cashobj ;
    • when( (current.myCash = cashobj )
    • and
    • ( cashobj .amount < 10.00))
    • do {
    • conclude(
    • ( cashobj .amount = cashobj .amount + 10.00));
    • } //do
    • } //tf_PreferredCashOut
  • Collectall Variable
    • Let’s assume three Cash objects: Cash-1, Cash-2, Cash-3
    • Collect creates a list with every Cash object, Cash-1, Cash-2, and Cash-3 in it
    • Thoughtframe fires one time!
    • Loops over the entire list
    • Beliefs about Cash-1.amount, Cash-2.amount and Cash-3.amount are changed
    • All at the same time, because the thoughtframe fires only once!!
    • thoughtframe tf_PreferredCashOut {
    • variables:
    • collectall(Cash) cashobj ;
    • when( (current.myCash = cashobj )
    • and
    • ( cashobj .amount < 10.00))
    • do {
    • conclude(
    • ( cashobj .amount = cashobj .amount + 10.00));
    • } //do
    • } //tf_PreferredCashOut
  • Need Cash To Eat?
    • IF amount of cash < $12 and want preferred cash in pocket THEN need cash
    • IF amount of cash > $11 THEN don’t need cash
    thoughtframe tf_cash_Needed { variables: forone(Cash) cs; when(knownval(current.needCash = false) and knownval(current.calculatedCash = false) and knownval(current.howHungry > 20.00) and knownval(current hasCash cs) and unknown(current.chosenDiner) and knownval(cs.amount < 12.00) and knownval(current.preferredCashOut > 0.00)) do { conclude((current.calculatedCash = true), bc:100); conclude((current.needCash = true), bc: 100); } } thoughtframe tf_cash_Not_Needed { variables: forone(Cash) cs; when(knownval(current.needCash = false) and knownval(current.howHungry > 20.00) and knownval(current.calculatedCash = false) and knownval(current hasCash cs) and unknown(current.chosenDiner) and knownval(cs.amount > 11.00)) do{ conclude((current. calculatedCash = true), bc:100); conclude((current.needCash = false), bc:100); } }
  • Which Diner?
    • IF not found a diner yet,
    • AND amount of cash > $15 THEN goto Blake’s diner.
    thoughtframe tf_chooseBlakes { variables: forone(Cash) cs; when(knownval(current hasCash cs) and knownval(cs.amount > 15.00) and knownval(current.checkedDiner = false)) do { conclude((current.chosenDiner = Blakes_Diner), bc:100); conclude((current.checkedDiner = true), bc:100); } }
  • Forward Reasoning Student.preferredCashOut Init: T=0: (Alex_Agent.preferredCashOut = 8.00); Student.preceivedTime Cash.amount T=24700: (Alex_Cash.amount = 13.00); T=25200: (Alex_Agent.perceivedtime = 8); Campanile_Clock.time T=28800: (Campanile_Clock.time = 9); tf_feelHungry T=28800: (Alex_Agent.howHungry = 21.00); T=28800: (Alex_Agent.perceivedtime = 9); Student.howHungry tf_cash_Needed tf_cash_Not_Needed T=28800: (Alex_Agent.needCash = false); Student.needCash Student.checkedDiner tf_ChooseRaleigh tf_ChooseBlakes Student.chosenDiner T=28800: (Alex_Agent.chosenDiner = Raleigh_Diner) T=28800: (Alex_Agent.checkedDiner = true);; T=28800: (Alex_Agent.checkedDiner = false);
  • Geography
  • Brahms Geography
    • Agents and objects can be located ( initial location ) .
    • Agents and objects can move to/from locations.
    • When agents/objects come into a location, the Brahms engine automatically creates a location fact ( agent.location = <current-area> ) .
    • Agents know where they are and notice others:
      • When agents come into a location, the Brahms engine automatically gives the agent a belief about its new location (same as fact), and
      • … gives the agent a location belief for all other agents and objects currently in that location.
      • When an agent/object leaves a location, the location fact and beliefs are retracted (from all agents that are in that location the moment the agent/object leaves.)
    • Agents and objects can carry (containment relation) other agent/objects.
      • Contained objects are NOT noticed until they are put into the area.
  • Geography Objects
    • Geography Model is separate from Agent and Object Model
    • Conceptual Geography Model
      • Areas are a special type of geography object
      • Areas have attributes and relations
      • Areas can define initial facts
      • Areas are instances of an Area Definition
      • Area Definition is a special geography class type
    • Facts about areas represent state of a location
      • E.g. temperature
    • Agent location attribute is inherited from Brahms BaseGroup. For objects from BaseClass
  • BaseAreaDef
    • BaseAreaDef is the Brahms base class for areas
    • Every area is an instance of BaseAreaDef
    • Default special relations in BaseAreaDef
    package brahms.base; /** * areadef BaseAreaDef * * This areadef serves as the base for every area definition in a * brahms model and provides conceptual classes with a minimum work set. * * library brahms.base */ areadef BaseAreaDef { relations: public BaseAreaDef isSubAreaOf; public BaseAreaDef hasSubArea; } // BaseAreaDef
    • Default Brahms AreaDefs:
      • World, City, Building
    Brahms Geography: Area Definitions areadef City { display: City; }//areadef City areadef areadef-name { extends areadef-name [ , areadef-name ]*} } { { display : ID. literal-string ; } { icon : ID. literal-string ; } { GRP. attributes } { GRP. relations } { GRP. initial-facts } }
  • Brahms Geography: Areas
    • Instance of AreaDef => Parent
    • Part of other Area => Super-Areas
    • Inverse: Has Parts => Sub-Areas
    • Inhabitants => Located Agents and Objects
    • Has Paths => movement
    area area-name instanceof ADF. areadef-name { partof area-name } { { display : ID. literal-string ; } { icon : ID. literal-string ; } { GRP. attributes } { GRP. relations } { GRP. initial-facts } }
  • Paths between areas
    • Areas are not necessarily a 2-dim. Grid
    • Areas can sub-areas, sub-areas can have sub-sub-areas, etc
  • Tutorial Scenario Geography package projects.atm; areadef University extends BaseAreaDef { } areadef UniversityHall extends Building { } areadef BankBranch extends Building { } areadef Restaurant extends Building { } // ATM World area AtmGeography instanceof World { } // Berkeley area Berkeley instanceof City partof AtmGeography { } // inside Berkeley area UCB instanceof University partof Berkeley { } area SouthHall instanceof UniversityHall partof UCB { } area Telegraph_Av_113 instanceof BankBranch partof Berkeley { } area SpraulHall instanceof UniversityHall partof UCB { } area Bancroft_Av_77 instanceof BankBranch partof Berkeley { } area Telegraph_Av_2405 instanceof Restaurant partof Berkeley { } area Telegraph_Av_2134 instanceof Restaurant partof Berkeley { } AtmGeography Berkeley Telegraph_Av_X UCB SouthHall SpraulHall Bancroft_Av_X Part-Of Alex_Agent Kim_Agent Inhabitants agent Alex_Agent memberof Student { location: SouthHall; agent Kim_Agent memberof Student { location: SouthHall;
  • Sub-Area Facts
  • Where in the world is Alex? agent Alex_Agent memberof Student { location: SouthHall; }
  • Where in the world is Alex? agent Alex_Agent memberof Student { location: SouthHall; }
  • Moving
    • Agents and objects can move
      • Use move(to_location) activity in a workframe
      • Can specify duration in clock-ticks
      • Default zero duration, unless
    • Define a Path object between two areas
      • Defines duration to move from area1 to area2
      • Bi-directional path
    • Engine retracts and creates location facts and beliefs
      • Can specify (sub-)area arrival and departure detection
    • Engine calculates shortest path between areas
    • Contained objects and agents move with the agent
  • Paths path path-name { { display : ID. literal-string ; } area1 : ARE. area-name ; area2 : ARE. area-name ; { distance : ID. unsigned ; } } Path from South Hall to Blakes Diner Path from South Hall to Raleigh Restaurant
  • Paths to Restaurants //paths to and from banks from spraul //and south halls path SpH_to_from_WF { area1: SpraulHall; area2: Bancroft_Av_77; distance: 200; } Berkeley Telegraph_Av_113 UCB Southall SpraulHall Telegraph_Av_2134 Telegraph_Av_2405 Bancroft_AV-_77 200 200 80 100 360 240 400 280 240 320 Student Restaurant Atm AtmGeography
  • Agent/Object Movement
  • Schedule
    • 1:00pm – 2:00pm
      • Work Practice Modeling
      • Brahms Overview + Demo
    • 2:00pm – 2:30pm
      • Agents, Groups, Beliefs and Facts
      • Classes and Objects
    • 2:30pm – 3:00pm
      • Break
    • 3:00pm – 3:30pm
      • Thoughtframes
      • Geography
    • 3:30pm – 4:30pm
      • Activities and Workframes
      • Composite Activities
      • Agent Communication
  • Activities and Workframes
  • Beyond Task/Goal Analysis Describing & Explaining Behavior Watching Soccer with 50,000 fans Communities of Practice Being Dutch at the World Cup Resting
    • All human activity is purposeful, but not every goal is a problem to be solved and not every activity performs a task (e.g., resting).
    • “ Off-task” activities (waiting, talking, playing) have composite structure, norm-based variations, and purposes relevant to work functions.
    • Some goals are states to sustain , not requiring search or pathfinding (e.g., brainstorming).
    • Must reformulate how Deliberation relates to: Activity Motives and Attentive Coordination
    Teamwork
  • Goals vs. Activities Problem-Solving Approach Activity Approach 6.    Add 3 and 4 5.   Solve x-4 = 3 4.   Solve equation on screen 3.   Get experiment credit 2.   Pass introductory psychology 1.   Get college degree Act: Taking an introductory psychology class Duration: 1 semester Act: Going to college Duration: 4 years Act: Doing an experiment Duration: 2 hours Act: Solving equation x-4 = 3 Duration: 2 mins Act: Adding 2 and 4 Duration: 1 sec
  • Activities
    • What are Activities?
    • socially constructed engagements,
    • situated in the real world,
    • taking time, effort and application of knowledge,
    • defined beginning and end,
    • NOT necessarily need goals in the sense of problem-solving tasks.
    • can be interrupted.
    When in an activity people might articulate a task they are working on, and the goal they want to accomplish (Clancey ’97) Tasks and Goals are constructed within an Activity (Clancey ’97) (Kuutti ’96)
  • What are some of Alex’s activities?
    • Studying in South Hall.
    • Walking to a restaurant.
    • Getting money from a bank’s cash machine.
    • Ordering food from a restaurant.
    • Characterization:
    • has a duration
    • is situated in the real world
    • can be interrupted / resumed, but stay active
    • can be decomposed and/or subsumed
  • Brahms Activities
    • Primitive activities
      • Lowest level, user-defined, but not further specified.
      • Parameters are time, and resources
    • Predefined activities
      • Primitive activities with predefined semantics (communicate, move, etc.)
    • Composite activities
      • User-defined detailed activities
      • Decomposed in sub-activities
      • Describes what an agent does while “in” the activity
    • Java activities
      • User-defined primitive activities that are implemented in a Java class
      • Uses the Brahms API.
  • Activity Definition
    • Declaration and reference
      • All activities have to be declared in the activities section of either a group, agent, class, object, or composite-activity. The declared activities can then be referenced in the workframes defined for the group, agent, class or object.
    • Parameters
      • It is possible to define input parameters for primitive activities. These input parameters can be used to make activities more generic. In the reference the values for the input parameters have to be passed.
    • Priority
      • Activities can be assigned a priority. The priorities of activities in a workframe are used to define the priority of a workframe. The workframe will get the priority of the activity with the highest priority defined in the workframe.
    • Duration
      • Activities in general have a duration. The duration of the activity can be defined to be a fixed amount of time. The random attribute has to be set to false and the max-duration attribute has to be set to the maximum duration in seconds. The duration of the activity can also be defined to be a random amount of time. To define a random amount of time the random attribute has to be set to true, the min-duration attribute has to be set to the minimum duration of the activity in seconds and the max-duration attribute has to be set to the maximum duration of the activity in seconds.
  • Activity Definition
    • Resources
      • Artifacts (objects) can be defined as being a resource or not by setting the resource attribute to either true or false. In general artifacts that are worked on by agents are not considered to be a resource in an activity (a form, a fax). Artifacts that are used by an agent in an activity are considered to be resources ( a fax machine, a telephone).It is possible to associate artifacts with activities for statistical purposes and for the purpose of generating object flows by defining them in the list of resources for an activity. Artifacts which are defined as resources are also called resource objects. Resource objects associated with activities will only collect statistics and will not be used for the object flow generation. Artifacts which are defined not to be a resource and which are associated with an activity are also called touch objects. Touch objects should be associated with one or more conceptual object(s) for object flow purposes and statistical purposes.
    • Defaults
      • display = <activity-name>
      • priority = 0
      • random = false
      • min_duration = 0
      • max_duration = 0
      • resources = none
  • Primitive Activities primitive-activity ::= primitive_activity activity-name ( { param-decl [ , param-decl ]* } ) { { display : ID. literal-string ; } { priority : [ ID. unsigned | param-name ] ; } { random : [ ID. truth-value | param-name ] ; } { min_duration : [ ID. unsigned | param-name ] ; } { max_duration : [ ID. unsigned | param-name ] ; } resources : [ param-name | OBJ.object-name ] [ , [ param-name | OBJ.object-name ]*; } primitive_activity Study ( Books course_book ) { display : “Study for a Course” ; { priority : 10 ; { random : true ; { min_duration : 1800 ; /* 30 mins */ { max_duration : 7200 ; } /* 2 hours */ resources : course_book ; }
  • Predefined Primitive Activities (1)
    •   Move
      • Moves an agent/object from one area to another area.
        • Agent/object is moved
        • Contained objects/agents are moved
        • Location beliefs/facts are retracted/created
        • Location facts are created
    • Create Agent/Object/Area
      • Creates new agents/ objects/areas dynamically
        • Agent can be member of multiple groups
        • Objects can be an instance of a class
        • Can bind new agent/object to a return parameter
        • Can give new agent/object a name and location
  • Predefined Primitive Activities (2)
    • Communicate
      • Communicates agent’s beliefs from/to receiver agent(s)
        • Agent needs to have the beliefs to communicate
        • Can specify type of communication ( phone | fax | email | face2face | terminal | pager | none)
        • Can specify to which agents/objects is being communicate
        • Can specify when to communicate ( start | end )
    • Broadcast
      • Communicates agent’s beliefs from/to all agent(s) in specific areas
        • Can specify areas and subareas
        • Agent needs to have the beliefs to communicate
        • Can specify type of communication ( phone | fax | email | face2face | terminal | pager | none)
        • Can specify to which agents/objects is being communicated
        • Can specify when to communicate ( start | end )
  • Predefined Primitive Activities (3)
    • Get
      • Allows an agent or object to pick up or transfer one or more objects and/or agents from an area, other agent or object, and carry it with it while performing activities.
    •   Put
      • Allows an agent or object to put down (drop) or transfer one or more objects and/or agents, referred to as items, carried by the agent or object performing the activity.
    • Gesture
      • The gestures as indicated by the gesture activity are visualized in the virtual reality environment provided that environment supports the specified gestures.
  • Move Activity move PAC. activity-name ( { PAC. param-decl [ , PAC. param-decl ]* } ) { { display : ID. literal-string ; } { priority : [ ID. unsigned | PAC. param-name ] ; } { random : [ ID. truth-value | PAC. param-name ] ; } { min_duration : [ ID. unsigned | PAC. param-name ] ; } { max_duration : [ ID. unsigned | PAC. param-name ] ; } { PAC. resources } location : [ ARE. area-name | PAC. param-name ] ; { detectDepartureIn : [ ARE. area-name | PAC. param-name ] [ , [ ARE. area-name | PAC. param-name ]]* ; } { detectDepartureInSubAreas : [ ID. truth-value | PAC. param-name ] ; } { detectArrivalIn : [ ARE. area-name | PAC. param-name ] [ , [ ARE. area-name | PAC. param-name ] ]* ; } { detectArrivalInSubAreas : [ ID. truth-value | PAC. param-name ] ; } } move moveToRestaurant( ) { location: Telegraph_Av_2405; } move moveToSouthHall() { location: SouthHall; } move moveToLocationForCash(Building loc) { location: loc; } move moveToLocation(Building loc) { location: loc; }
  • Java Activities
    • A Brahms Java Activity is a primitive activity but its actual behavior is specified in Java code .
      • Java code may cause an action to happen outside the Brahms model completely (e.g. pop-up a dialog that say’s “hello world”)
      • Java code can generate the output values and assign them to unbound variables in Brahms
      • Java code can generate new model objects within the Brahms model
      • Java code can generate beliefs/facts into objects/agents/areas within the Brahms model
      • Java code can integrate Brahms beliefs to external systems
  • Brahms Java Activity Syntax
    • java-activity ::= java PAC.activity-name (
    • { PAC.param-decl [ , PAC.param-decl ]* } )
    • {
    • { display : ID.literal-string ; }
    • { priority : [ ID.unsigned | PAC.param-name ] ; }
    • { random : [ ID.truth-value | PAC.param-name ] ; }
    • { min_duration : [ ID.unsigned | PAC.param-name ] ; }
    • { max_duration : [ ID.unsigned | PAC.param-name ] ; }
    • { PAC.resources }
    • class : [ ID.literal-string | PAC.param-name ] ;
    • { when : [ start | end | PAC.param-name ] ; }
    • }
    java sayHelloWorld() { max_duration: 0; class: &quot;gov.nasa.arc.brahms.atm.HelloWorld&quot;; when: start; } // sayHelloWorld
  • “ Hello World” Java Activity
    • public class HelloWorld extends AbstractExternalActivity {
    • public HelloWorld() {
    • } // HelloWorldActivity
    • /**
    • * Implement the activity
    • */
    • public void doActivity() throws ExternalException {
    • System.out.println(&quot;************************************************&quot;);
    • System.out.println(”*My Brahms Agent is saying: 'Hello Agent World’*&quot;);
    • System.out.println&quot;*************************************************&quot;);
    • } // doActivity
    • } // HelloWorld
    java sayHelloWorld() { max_duration: 0; class: &quot;gov.nasa.arc.brahms.jact&quot;; when: start; } // sayHelloWorld
  • Brahms - FACET Integration
    • “ Agentify” FACET
      • Wrap FACET as a Brahms Agent
      • Design Agent Communicative Acts
      • Create Java Interface to FACET
  • Activities and Workframes
    • Activities describe what people do …
    • Workframes describe when people do what they do …
    • Thus, they describe when activities are performed …
  • Brahms Workframes
    • Workframes are situation-action rules :
      • Activities are associated with a conditional statement or constraint ,
      • Workframes are different from production rules, in that they take time.
      • If the conditions of a rule are believed, then the associated activities are performed.
        • We call these preconditions
      • Precondition match on the beliefs held by the agent
    • Workframes can be associated with groups/agents and classes/object.
      • A workframe defines when an activity (or activities) of an agent/object may be performed.
    • Having two or more agents with different workframes, performing the same activity, can represent individual differences.
    • Conclusions are facts or beliefs or both that may be asserted when a workframe is executed.
  • Workframe Syntax workframe workframe-name { { display : ID. literal-string ; } { type : factframe | dataframe ; } { repeat : ID. truth-value ; } { priority : ID. unsigned ; } { variables : [ VAR. variable ]* } { detectables : [ DET. detectable ]*} { when ( { [ PRE. precondition ] [ and PRE. precondition ]* } ) | do { [ PAC. activity-ref | CON. consequence ]* } } } activities: primitive_activity eat( ) { priority: 0; max_duration: 400; } workframe wf_eat { repeat: true; variables: forone(Cash) cs; forone(Diner) dn; when(knownval(current hasCash cs) and knownval(current.location = dn.location)) do { eat(); conclude((current.howHungry = current.howHungry - 3.00), bc:100, fc:0); conclude((cs.amount = cs.amount - dn.foodcost), bc:100, fc:100); conclude((current.readyToLeaveRestaurant = true), bc:100, fc:0); } }
  • AgentViewer Screenshot of Eat Worfkrame and Activity
  • Frame Repeat Attribute
    • Repeat
      • A frame can be performed one or more times depending on the value of the “ repeat ” attribute.
      • A frame can only be performed once if the repeat attribute is set to false.
      • A frame can be performed repeatedly if the repeat attribute is set to true.
      • In case the repeat attribute is set to false, the frame can only be performed once for the specific binding of the variables at run-time.
    • workframe wf_eat {
    • repeat: true; <= can repeat for the same Cash and Diner Objects
    • priority: 1;
    • variables:
    • forone(Cash) cs;
    • forone(Diner) dn;
    • when(knownval(current hasCash cs) and
    • knownval(current.location = dn.location)) <= when the agent’s location is the diner location
    • do {
    • eat();
    • conclude((current.howHungry = current.howHungry - 3.00), bc:100, fc:0);
    • conclude((cs.amount = cs.amount - dn.foodcost), bc:100, fc:100);
    • conclude((current.readyToLeaveRestaurant = true), bc:100, fc:0);
    • }
    • }
  • AgentViewer Screenshot of Repeating Eat Worfkrame and Activity
  • Priority Attribute
    • Priority
      • The workframe priority can be set in one of two ways.
      • The priority can be set by setting the value for the priority attribute or,
      • The priority can be deduced based on the priorities of the activities defined within the workframe, the workframe will get the priority of the activity with the highest priority.
      • If no priority is specified the priority will be deduced from the activities, otherwise the specified priority is used.
  • Use of Activity Priorities activities: primitive_activity eat( ) { priority: 1; max_duration: 400; } primitive_activitity do_work( ) { priority: 0; max_duration: 400 ; } workframes: workframe wf_Eat { repeat: true; when(knownval(current.howHungry > 20.00) and knownval(current.location = Telegraph_Av_2405)) do { eat(); conclude((current.howHungry = current.howHungry - 5.00), bc:100, fc:0); conclude((Alex_Cash.amount = Alex_Cash.amount - Raleigh_Diner.foodcost), bc:100, fc:100); conclude((current.readyToLeaveRestaurant = true), bc:100, fc:0); } } workframe wf_Do_Work { repeat: true; do { do_work(); } } T 1 =1 : do_work( ) T 2 =400 : do_work( ) … T n =n : eat( ) T n+1 =n+400: do_work( ) … Example 1 T 1 =1 : do_work( ) T 2 =300 : eat ( ) T 3 =n+700: do_work( ) T 4 =n+800: do_work( ) interrupt resume Example 2
  • Interrupting Workframe and Activity using Priorities
  • Brahms Detectables (for reactive behavior)
    • Associated with workframes and activities
    • Active while a workframe/activity is active
    • Used for:
      • Agents noticing states of the world, and being able to act upon those
        • 3-steps: (i) detect fact, (ii) notice (fact becomes belief), (iii) conditionally act on belief
      • Control the execution of workframes and activities
        • Example: do act A until you notice fact F
    • Type: continue | impasse | abort | complete | end_activity
  • Detectable Grammar workframe workframe-name { { display : ID. literal-string ; } { type : factframe | dataframe ; } { repeat : ID. truth-value ; } { priority : ID. unsigned ; } { variables : [ VAR. variable ]* } { detectables : [ DET. detectable ]* } { when ( { [ PRE. precondition ] [ and PRE. precondition ]* } ) | do { [ PAC. activity-ref | CON. consequence ]* } } } detectable detectable-name { { when ( [ whenever | ID. unsigned ] ) } detect ( ( [ result-val-comp | PRE. rel-comp ] ) { , detect-certainty } ) { then continue | impasse | abort | complete | end_activity } ; } Defaults * when = whenever * dc = 100 * action = continue composite-activity PAC. activity-name ( { PAC. param-decl [ , PAC. param-decl ]* } ) { { display : ID. literal-string ; } { priority : [ ID. unsigned | PAC. param-name ] ; } { end_condition : [ detectable | nowork ] ; } { WFR. detectable-decl } { GRP. activities } { GRP. workframes } { GRP. thoughtframes } }
  • Detectables in Workframes workframe wf_waitAtmAsksPin { repeat: true; variables: forone(BankCard) bkc4; forone(Cash) cs4; forone(Atm) at4; forone(Bank) bk4; detectables: detectable atmAsksPin { when(whenever) detect((at4.pinAsked = true), dc:100) then complete; } when(knownval(current.waitAtmAsksPin = true) and knownval(current hasBankCard bkc4) and knownval(at4 contains bkc4) and knownval(current.pinCommunicated = false)) do { waitAtmReply(); conclude((current.waitAtmAsksPin = false), bc:100, fc:100); } }
  • Wait for Reply Detectable
    • composite_activity WaitAndProcessReply (ReplyAgent agt ) {
    • end_condition: detectable;
    • detectables:
    • detectable dt_wait_for_reply {
    • when (whenever)
    • detect((agt.replied = yes))
    • then end_activity;
    • }
    • activities:
    • composite_activity ProcessReply(ReplyAgent agt) { … }
    • workframes:
    • workframe wf_Replied_n {
    • when (knownval(agt.answer = some_answer))
    • do {
    • ProcessReply(agt);
    • conclude((agt.replied = yes), bc:100, fc:0);
    • }
    • }
    • }
  • Composite Activities
  • Composite Activities
    • Decompose activities into sub-activities and the workframes that can execute them.
    • Defines a workframe-activity hierarchy
    • Execution is different than traditional rule hierarchies:
      • Subsumption hierarchy
      • While “in” an activity the higher-level activity is still active.
  • Composite Activity Syntax composite-activity PAC. activity-name ( { PAC. param-decl [ , PAC. param-decl ]* } ) { { display : ID. literal-string ; } { priority : [ ID. unsigned | PAC. param-name ] ; } { end_condition : [ detectable | nowork ] ; } { WFR. detectable-decl } { GRP. activities } { GRP. workframes } { GRP. thoughtframes } } composite_activity study() { activities: primitive_activity reading ( ) { max_duration: 1500; } //end primact workframes: workframe wf_readingWhileStudying { do { reading(); } //end do } //end wf thoughtframes: thoughtframe tf_needCashToEat { variables: forone(Cash) cs; when (knownval(cs.amount < current.preferredCashOut)) do { conclude((current.needCash = true)); } //end do } //end tf … } //end composite activity study
  • Workframe-Activity Hierarchy
  • Activity Subsumption
  • Model Parallel Activities?
    • Example: Talking on cell phone while driving
      • composite_activity Driving( … ) {
      • end_condition: detectable;
      • activities:
      • composite_activity Talking_on_Cell_Phone( … ) {
      • }
      • workframe Talking_while_Driving {
      • when(knownval(mycell.isRinging = true) {
      • do { Talking_on_Cell_Phone(…); }
      • }
      • }
  • Workframe/Activity States highest priority precondition true precondition false not highest priority impasse detectable end workframe or iabort | complete | end_activity detectable highest priority repeat = true impasse resolved
  • Workframe Interruption group PrimitiveActivityPerformer { attributes: public boolean execute_PAC_1; activities: primitive_activity PAC_1(int pri) { display: &quot;PAC 1&quot;; priority: pri; max_duration: 900; } primitive_activity PAC_2(int pri, int dur) { display: &quot;PAC 2&quot;; priority: pri; max_duration: dur; } workframes: workframe wf_PAC_1 { repeat: true; when ( knownval(current.execute_PAC_1 = true) ) do { PAC_1(1); conclude((current.execute_PAC_1 = false)); } } workframe wf_PAC_2 { repeat: true; do { PAC_2(0, 1800); conclude((current.execute_PAC_1 = true), bc:25 ); PAC_2(0, 600); } } } Workframe-Activity Hierarchy Wf_PAC_1 PAC_1(1) Wf_PAC_2 PAC_2(0, 1800) PAC_2(0, 600) T n+1 = T n + 1800 T n+2 = Tn+1 + 900
  • Brahms External Agent
    • A Brahms External Agents are Brahms agents but its actual behavior is specified in Java code .
      • Defined in your Brahms program as an external agent with a name
      • Java code implements the behavior of the agent
      • Java code to communicate (receive/send beliefs) from other Brahms agents
      • Java code can access Brahms model
      • Java code can generate facts for objects/agents/areas within the Brahms model
      • Java code can “agentify” external systems
  • Speech Dialog Agent
  • Agent Communication
  • Two Ways of Agent Communication
    • Communicating individual beliefs
      • simple, but unstructured
      • mostly used in simulation
    • Communicating via speech acts
      • more complicated, but more structured
      • good for defining standard conversation protocols
      • used in MAS using FIPA standard
  • Brahms Communications
    • Activities that transfer beliefs to/from one agent to one or several other agents, or to/from an (information carrier) object. Examples are:
      • Face to face conversations.
      • Reading or writing a document.
      • Data entered into computers.
    • An agent/object has to have the belief before it can communicate (i.e. tell) the belief to another agent/object.
    • Recipient agent/object will overwrite original beliefs with communicated beliefs.
  • What does Alex need to communicate? PIN Information Amount of Money PIN Verified Withdrawal Amount Approved Banking Institution
  • Communicate Activity Grammar communicate PAC. activity-name ( { PAC. param-decl [ , PAC. param-decl ]* } ) { { display : ID. literal-string ; } { priority : [ ID. unsigned | PAC. param-name ] ; } { random : [ ID. truth-value | PAC. param-name ] ; } { min_duration : [ ID. unsigned | PAC. param-name ] ; } { max_duration : [ ID. unsigned | PAC. param-name ] ; } { PAC. resources } { type : [ phone | fax | email | face2face | terminal | pager | none | PAC. param-name ] ; } with : [ [ AGT. agent-name |OBJ. object-name | PAC. param-name ] [ , [ AGT. agent-name | OBJ. object-name | PAC. param-name ] ]* ; about : TDF. transfer-definition [ , TDF. transfer-definition ]* ; { when : [ start | end | PAC. param-name ] ; } } transfer-definition ::= transfer-action ( communicative-act | DET. resultcomparison ) transfer-action ::= send | receive communicative-act ::= OBJ. object-name | PAC. param-name
  • Transfer Definition
    • The direction of communication
      • send: agent send to will always receive
      • receive: agent receiving from does not “know” it is communicating; needs to have the belief
    • Transfer of beliefs happens either at the start or at the end of the activity
      • when: start | end;
  • Transfer Definition
    • Defines the kind of belief the agent/object is communicating
    • Attribute value is not taken into account …
      • use ‘?’ as value
        • send(current.preferredCashOut = ?)
      • don’t use a value
        • send(current.preferredCashOut)
    • Relations objects/agents
      • send(current hasCash ?);
      • send(current hasCash);
      • send(current hasCash <Cash>);
    • Can pass <cash object> as parameter
        • send(current hasCash <cash object>);
  • Communication Activities Group Student: communicate communicatePIN(Atm at3) { max_duration: 1; with: at3; about: send(current.pinCommunicated), send(current.believedPin); when: end; } communicate sendRequestAmount(Atm at3) { max_duration: 1; with: at3; about: send(current.amountCommunicated), send(current.preferredCashOut); when: end; } Class Atm: communicate askBankVerification_1(Bank ba3) { max_duration: 1; with: ba3; about: send(current.currentAccountCode), send(current.currentAccountPin), send(current.currentAmountRequested), send(current.askedVerification); when: end; } Class Bank: communicate replyAtm(Atm at3, Account bka) { max_duration: 1; with: at3; about: send(current.correctPin), send(current.enoughBalance), send(bka.balance); when: end; }
  • Workframe with Communicate Activity workframe wf_communicatePIN { repeat: true; variables: forone(BankCard) bkc3; forone(Atm) at3; forone(Bank) ba3; forone(Building) bd3; when(knownval(current hasBankCard bkc3) and not(current contains bkc3) and knownval(current.chosenBank = ba3) and knownval(at3 ownedbyBank ba3) and knownval(current.pinCommunicated = false) and knownval(current.location = at3.location) and knownval(current.pinRemembered = true) and knownval(current.waitAtmAsksPin = false)) do { processCommunicatePin(); communicatePIN(at3); conclude((current.waitAtmAsksAmount = true), bc:100, fc:100); conclude((current.pinCommunicated = true), bc:100, fc:100); } }
  • Alex Communicates with ATM Communicate PIN Request Amount Ask Amount Request Verification Approval Approval
  • Brahms Libraries
    • Libraries are Brahms Groups/Classes with domain-independent common capabilities
    • Brahms comes with a number of libraries
      • Also, we’re always extending Brahms capabilities …
      • Libraries are a useful way to add capabilities without the need to add to the language
    • Most libraries provide generic Activities developed as Java activities
    • User can create their own libraries
      • Add Libraries to ../AgentEnvironment/Models/brahms
      • Use import statement, just like with Java libraries
    • Current Libraries:
      • Calendar
        • Time and Date library
      • Communication
        • FIPA compliant Communicative Acts Library for agent communication
      • Input/Output
        • File IO library for copying/deleting files
      • Java Utilities
        • Utilities for handling Java objects for Brahms Agents and Objects
      • System Utilities
        • Some simple Java print activities and string manipulation
  • Communication Library
    • A Communicator is able to communicate with other agents through communicative acts
    • The Communicator specifies a set of activities that can be used by communicators to create, read, manipulate, retract , and send communicative acts
    • Defines class CommunicativeAct
  • CommunicativeAct
    • The CommunicativeAct models a communication event between two actors
    • Defines a message that is based on the Communicative Act standard defined by FIPA (Foundation of Intelligent Physical Agents)
    • Specifies an Envelope with the address information (from, to, date, ...) and transport hints
    • Specifies a Payload for the message content and content properties
    • Envelope and payload are maps
    • http://www.fipa.org/specs/fipa00037/index.html
  • Message Envelope
    • This map is used to contain address-related information for a communicative act. The key-value conventions are:
      • &quot;from” - ActiveInstance (required)
      • &quot;to” - ActiveInstance (required)
      • &quot;date” - string (required, formatted as yyyyMMddThhmmssSSSZ (UTC date/time)
      • &quot;comments” - string (optional)
      • &quot;acl-representation&quot; - string (optional)
      • &quot;encrypted” - boolean (optional)
      • &quot;payload-length&quot; - string (optional)
      • &quot;payload-encoding&quot; - string (optional)
      • &quot;intended-receiver&quot; - ActiveInstance (optional)
      • &quot;received&quot; - ReceivedObject (optional)
    • Example:
    • (<communicative_act>.envelope(“from”) = <sending_agent> )
    • (<communicative_act>.envelope(“to”) = <receiving_agent> )
  • Message Payload
    • This map is used to contain content of a communicative act. The key-value conventions are:
    • &quot;performative” - symbol (required - INFORM, REQUEST, SUBSCRIBE, etc.)
    • &quot;sender” - ActiveInstance (required)
    • &quot;receiver&quot; - ActiveInstance (required)
    • &quot;reply-to&quot; - ActiveInstance (optional)
    • &quot;action&quot; - symbol (optional)
    • &quot;subject&quot; - symbol (optional)
    • &quot;content&quot; - any instance type (optional)
    • &quot;language&quot; - string (optional)
    • &quot;encoding&quot; - string (optional)
    • &quot;ontology&quot; - string (optional)
    • &quot;protocol&quot; - string (optional)
    • &quot;conversation-id&quot; - string (optional)
    • &quot;reply-with” - string (optional)
    • &quot;in-reply-to” - string (optional)
    • &quot;reply-by&quot; - string (optional, date/time formatted as yyyyMMddThhmmssSSSZ (UTC date/time))
    • Example: (<communicative_act>.payload(“sender”) = <sending_agent> )
  • Example Sending ComAct
    • workframe wf_ConfirmGetAvailableTime {
    • variables:
    • forone(ActiveInstance) sender;
    • forone(string) convid;
    • forone(CommunicativeAct) reply;
    • forone(Activity) act;
    • when ( (comact.payload(&quot;performative&quot;) = REQUEST) and
    • (comact.payload(&quot;action&quot;) = getAvailableTime) and
    • (comact.payload(&quot;sender&quot;) = sender) and
    • (comact.payload(&quot;purpose&quot;) = act) and
    • (comact.payload(&quot;conversation-id&quot;) = convid))
    • do {
    • createCommunicativeAct( current, sender, INFORM, convid, getAvailableTime, classtype, current, reply);
    • setPayloadProperty(reply, &quot;content&quot;, payloadobj1 );
    • setPayloadProperty(reply, &quot;purpose&quot;, act );
    • sendCommunicativeAct(reply, sender );
    • } //do
    • } //wf_ConfirmGetAvailableTime
  • Receiving ComAct
  • Brahms Hosting Environment
  • Distributed MAS Communication Framework
  • Robotic Recon Field Test June 20, 2009 Blackpoint Lava Flow, AZ Flight Control Team Science Operations Team
  • Conversation Protocol
  • More Information …
    • E-mail:
      • Maarten.Sierhuis@parc.com Maarten.Sierhuis@nasa.gov
    • Brahms URL: http://www.agentisolutions.com
    • Brahms Papers in Publications on: http://homepage.mac.com/msierhuis http://Bill.Clancey.name