ICCM 2010
Introduction to Brahms
Multi-Agent Activity Modeling
with the
Brahms Environment
Maarten Sierhuis, Ph.D.
Area Ma...
ICCM 2010
2
NASA ARC
Brahms Team
• Co-PI - William J. Clancey, Ph.D.
• Co-PI - Maarten Sierhuis, Ph.D.
• Software Architec...
ICCM 2010
Download This Tutorial From
http://public.me.com/msierhuis/ICCM2010/Br
ahms ICCM 2010 Tutorial (final).ppt
3
ICCM 2010
Schedule
• 1:00pm – 2:00pm
– Work Practice Modeling
– Brahms Overview + Demo
• 2:00pm – 2:30pm
– Agents, Groups,...
ICCM 2010
Human-Centered Design
• A different engineering approach
• Start with understanding people’s practice
– Both the...
ICCM 2010
• Hermeneutics and Work PracticeHermeneutics and Work Practice (Winograd & Flores)(Winograd & Flores)
– Interpre...
ICCM 2010
What is practice?
Sierhuis’ Definition:Sierhuis’ Definition:
• situatedsituated activitiesactivities of a group ...
ICCM 2010
Work Practice Modeling
• Groups & AgentsGroups & Agents
– work as activitieswork as activities
– beliefs trigger...
ICCM 2010
WPM cont’d
• Tools & ArtifactsTools & Artifacts
– tools used in activitiestools used in activities
– artifacts c...
ICCM 2010
“Day in the life”
(DITL) Model
• Description of a day in the life of a …
– Person
– Group of people
• Abstractio...
ICCM 2010
11
Brahms
• How people work together
• How people get to participate in a
collaborative activity
• Role of the e...
ICCM 2010
From Simulation toFrom Simulation to
ImplementationImplementation
12
ICCM 2010
2
4
6
8
10
TRL
1992 1996 2000 2004 2008
NYNEX/IRL
JPL
JSC
APOLLO
VICTORIA
ISS Mission
Control
BRAHMS – HISTORY O...
ICCM 2010
14
Brahms Overview
The Language
ICCM 2010
BrahmsBrahms
Work is like a symphony,
Well rehearsed, but always different
15
ICCM 2010
HistoryHistory
Social Systems of Work
Work Practice
Communities of Practice
Work Process
Modeling
Expert Systems...
ICCM 2010
Types of Agent Languages
Goal
17
ICCM 2010
Brahms Agent EnvironmentBrahms Agent Environment
• ComposerComposer for building models.for building models.
(or...
ICCM 2010
19
Where to download Brahms?
ICCM 2010
Brahms Use License
• Brahms Research License
– Free use for research purposes
– Download Brahms from AiS website...
ICCM 2010
21
Brahms Download
• “Brahms Agent Environment”.
– Go to http://www.agentisolutions.com/download/index.htm
• Req...
ICCM 2010
22
Brahms Installation
Check out Brahms Files
Files created by the Brahms installation are in:
C:Program Files B...
ICCM 2010
23
Language Documentation
ICCM 2010
24
ICCM 2010
25
ICCM 2010
26
Brahms Tutorial
ICCM 2010
Brahms LanguageBrahms Language
• Agent Oriented / BDIAgent Oriented / BDI
– Agents are first-class citizensAgent...
ICCM 2010
Anatomy of a Brahms ModelAnatomy of a Brahms Model
• Groups and Agents
– Groups contains agents which are locate...
ICCM 2010
29
Anatomy of a Brahms Model
Language Concepts
Groups
Agents
Classes
Objects
AreaDefs
Areas
Paths
Conceptual Cla...
ICCM 2010
Time-based Situation-Action
Production Rules represent Qualitative Relationships!!
Situation-action RulesSituati...
ICCM 2010
31
Brahms: agent-oriented language
Symbolic Discrete Event BDI System
Production and Situation-action Rules
WF1 ...
ICCM 2010
32
Brahms Agent
Engine
Beliefs
(atomic
formulas)
Desires
(workframes
thoughtframes
belief matching)
Plans
(workf...
ICCM 2010
Event Scheduler
T:0 belief X
T:1 fact Y
….
….
T:N belief Z
Multiagent LanguageMultiagent Language
BRAHMS
Virtual...
ICCM 2010
34
Brahms: Distributed MAS
Agent
Directory
Service
ICCM 2010
35
Brahms Agent Engine
ICCM 2010
Architecture
Brahms Virtual Machine
VM
Controller
Event
Notifier
Logger
Compiler
Compiled
Concepts
Source
Code
S...
ICCM 2010
37
Model Development
Cycle
1. Build Model in Composer
2. Compile Model
3. Fix compiler errors
4. Run Simulation
...
ICCM 2010 38
Composer: Eclipse Plugin
ICCM 2010
39
Model File
ICCM 2010
Composer: Eclipse Plugin
40
ICCM 2010
41
Compile Model
ICCM 2010
42
Model in UML
(Poseidon)
Compiler
generates
.XMI file
ICCM 2010
43
Simulate
ICCM 2010
44
Parse History File
ICCM 2010
45
History File Format
ICCM 2010
46
Brahms
AgentViewer
ICCM 2010
DEMO
47
ICCM 2010
Schedule
• 1:00pm – 2:00pm
– Work Practice Modeling
– Brahms Overview + Demo
• 2:00pm – 2:30pm
– Agents, Groups,...
ICCM 2010
Agents, Groups, Beliefs and Facts
49
ICCM 2010
What is a Brahms agent?
• Agents model human behavior.
• Agents could be autonomous intelligent systems
• Attrib...
ICCM 2010
51
Brahms Agent
agent agent-name { GRP.group-membership }
{
{ display : ID.literal-string ; }
{ cost : ID.number...
ICCM 2010
What is a Brahms group?
• A Brahms group describes the abstract
properties and behaviors of a group of
agents
• ...
ICCM 2010
53
Brahms Group
group group-name { group-membership }
{
{ display : ID.literal-string ; }
{ cost : ID.number ; }...
ICCM 2010
54
Groups
group BaseGroup { … }
group Student memberof BaseGroup { … }
agent Alex memberof Student, BrahmsModele...
ICCM 2010
NASA Mission Control
Org Chart
Divisions
Branches
Groups
Roles
Agents
55
ICCM 2010
56
Apollo 12 Groups and Agents
Roles
Functions
Agents
ICCM 2010
57
Brahms Groups, Agents and Attributes:
What are Brahms attributes?
• Attributes represent a property of a grou...
ICCM 2010
58
Typed Language
• Value Types
• Collection Types
• Java Types
• Meta Types
• Value Assignments
See Brahms Lang...
ICCM 2010
59
Value Types
• Value Types are attribute types that assign a specific value
[ int | long | double | symbol | s...
ICCM 2010
60
• The only Collection Type is the map attribute type
[ map ]
• Allows for the assignment of multiple values t...
ICCM 2010
61
• The only Java Type
[ java ]
• Allows direct references from Brahms to Java objects.
• The compiler must be ...
ICCM 2010
62
• Meta Types allow for binding of concepts that are considered to be a subtype of
the meta types
• Meta Types...
ICCM 2010
63
Brahms Facts & Beliefs:
What is a Brahms belief?
• Represents an agent’s interpretation of a fact in the worl...
ICCM 2010
64
Brahms Facts & Beliefs:
What is a Brahms fact?
• Represent some physical state of the world.
– Alex is male i...
ICCM 2010
65
Belief & Fact Grammar
( [ value-expression | relational-expression ] )
value-expression ::= obj-attr equality...
ICCM 2010
66
Belief Creation & Changes
• Initial beliefs can be defined in agent or group
• Initial beliefs are inherited ...
ICCM 2010
67
Initial Beliefs
group Student {
attributes:
public boolean male;
initial_beliefs:
(current.male = unknown);
}...
ICCM 2010
68
Beliefs versus
Object Attribute values
Object Orientation
object Alex instanceof class student {
Public Boole...
ICCM 2010
69
Conclude a belief
• The conclude statement can be used to create a new, or
change an existing belief
conclude...
ICCM 2010
70
Relationship between Brahms
Facts and Beliefs
ICCM 2010
71
Brahms Facts & Beliefs
World
Fact: (It is 10:40AM)
Fact: (It is Thursday Nov. 19, 1969)
Fact: (the door of th...
ICCM 2010
Classes and Objects
72
ICCM 2010
Brahms Objects
• Objects are data and real world artifacts.
• Objects could be inanimate objects or computationa...
ICCM 2010
Brahms Class
• Describes the properties/behavior
of abstract object classes
• Types of classes:
– Physical artif...
ICCM 2010
More on Brahms Objects
• Objects do not need a location to exist and act in the
world.
– For example, Alex’s ban...
ICCM 2010
76
BREAK!!!
ICCM 2010
Schedule
• 1:00pm – 2:00pm
– Work Practice Modeling
– Brahms Overview + Demo
• 2:00pm – 2:30pm
– Agents, Groups,...
ICCM 2010
Thoughtframes
78
ICCM 2010
What are some of Alex’s
thoughts?
79
ICCM 2010
Example Thoughtframes
• When student is studying Do
– Read While You Study
• While Reading, continously
– Assess...
ICCM 2010
Need Cash To Eat?
• IF amount of cash < preferred cash in
pocket THEN need cash
• IF amount of cash >= preferred...
ICCM 2010
How much cash needed?
• IF need cash AND very hungry THEN take
out $15 (remember it’s a student!)
• IF need cash...
ICCM 2010
How hungry am I?
• IF my hunger level > 20 THEN my
hungriness is high
• IF my hunger level <= 10 THEN my
hungrin...
ICCM 2010
How long before I am
hungry?
• IF an hour has gone by THEN my hunger
level goes up by 3
84
ICCM 2010
Thoughtframes
• Thoughtframes are production rules
• Conclude new beliefs
• Do NOT take time
• Allows representa...
ICCM 2010
Thoughtframes Syntax
thoughtframe thoughtframe-name {
display: literal-string;
repeat: truth-value;
priority: un...
ICCM 2010
Preconditions
thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
when (knownval(current.needCash = true) and
known...
ICCM 2010
Knownval Precondition
thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
when (knownval(current.needCash = true) a...
ICCM 2010
Not Precondition
thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
when (not(current.needCash = true) and
knownva...
ICCM 2010
Known Precondition
thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
when (known(current.needCash) and
knownval(c...
ICCM 2010
Unknown Precondition
thoughtframe tf_HowMuchMoneyToGet_HungryEQhigh {
when (unknown(current.needCash) and
knownv...
ICCM 2010
Where to define
thoughtframes?
• Within a group or agent
• At the “top-level”
group Student {
attributes:
relati...
ICCM 2010
Where to define
thoughtframes?
• Inside a composite activity within a group or agent
• Model problem-solving as ...
ICCM 2010
What are Brahms
Variables?
• Variables can be used in a Workframe or
Thoughtframe to write more generic
Workfram...
ICCM 2010
Using Variables in
Thoughtframe
thoughtframe tf_PreferredCashOut {
when( (Alex_Cash.amount < 10.00))
do {
conclu...
ICCM 2010
Brahms Variable Types
Did you notice “forone(cash) myCash”
declaration statement?
• Variables supports three qua...
ICCM 2010
Forone Variable
• Let’s assume three Cash
objects: Cash-1, Cash-2,
Cash-3
• Forone binds to one of the
Cash obje...
ICCM 2010
Foreach Variable
• Let’s assume three Cash objects:
Cash-1, Cash-2, Cash-3
• Foreach binds to every Cash object,...
ICCM 2010
99
Collectall Variable
• Let’s assume three Cash objects:
Cash-1, Cash-2, Cash-3
• Collect creates a list with e...
ICCM 2010
100
Need Cash To Eat?
• IF amount of cash < $12 and want preferred cash in pocket
THEN need cash
• IF amount of ...
ICCM 2010
101
Which Diner?
• IF not found a diner yet,
• AND amount of cash > $15 THEN goto Blake’s diner.
thoughtframe tf...
ICCM 2010
102
Forward Reasoning
Student.preferredCashOut
Init: T=0:
(Alex_Agent.preferred
CashOut = 8.00);
Student.preceiv...
ICCM 2010
Geography
103
ICCM 2010
Brahms Geography
• Agents and objects can be located (initial location).
• Agents and objects can move to/from l...
ICCM 2010
Geography Objects
• Geography Model is separate from Agent and Object Model
• Conceptual Geography Model
– Areas...
ICCM 2010
BaseAreaDef
• BaseAreaDef is the Brahms base class for areas
• Every area is an instance of BaseAreaDef
• Defaul...
ICCM 2010
• Default Brahms AreaDefs:
– World, City, Building
Brahms Geography:
Area Definitions
areadef City {
display: Ci...
ICCM 2010
Brahms Geography:
Areas
• Instance of AreaDef => Parent
• Part of other Area => Super-Areas
• Inverse: Has Parts...
ICCM 2010
Paths between areas
• Areas are not necessarily a 2-dim. Grid
• Areas can sub-areas, sub-areas can have sub-sub-...
ICCM 2010
110
package projects.atm;
areadef University extends BaseAreaDef { }
areadef UniversityHall extends Building { }...
ICCM 2010
111
Sub-Area Facts
ICCM 2010
112
Where in the world is Alex?
agent Alex_Agent memberof Student {
location: SouthHall;
}
ICCM 2010
113
Where in the world is Alex?
agent Alex_Agent memberof Student {
location: SouthHall;
}
ICCM 2010
114
Moving
• Agents and objects can move
– Use move(to_location) activity in a workframe
– Can specify duration ...
ICCM 2010
115
Paths
Path from South Hall to
Blakes Diner
Path from South Hall to
Raleigh Restaurant
path path-name
{
{ dis...
ICCM 2010
116
Paths
to Restaurants
//paths to and from banks from
spraul //and south halls
path SpH_to_from_WF {
area1: Sp...
ICCM 2010
117
Agent/Object Movement
ICCM 2010
Schedule
• 1:00pm – 2:00pm
– Work Practice Modeling
– Brahms Overview + Demo
• 2:00pm – 2:30pm
– Agents, Groups,...
ICCM 2010
119
Activities and Workframes
ICCM 2010
120
Beyond Task/Goal Analysis
Describing & Explaining Behavior
Watching Soccer
with 50,000 fans
Communities
of P...
ICCM 2010
Goals vs. Activities
Goal Stack
Problem-Solving Approach Activity Approach
6. Add 3 and 4
5. Solve x-4 = 3
4. So...
ICCM 2010
122
Activities
Task
Activity
Goal
What are Activities?
• socially constructed engagements,
• situated in the rea...
ICCM 2010
123
What are some of Alex’s
activities?
• Studying in South Hall.
• Walking to a restaurant.
• Getting money fro...
ICCM 2010
124
Brahms Activities
• Primitive activities
– Lowest level, user-defined, but not further specified.
– Paramete...
ICCM 2010
125
Activity Definition
• Declaration and reference
– All activities have to be declared in the activities secti...
ICCM 2010
126
Activity Definition
• Resources
– Artifacts (objects) can be defined as being a resource or not by setting t...
ICCM 2010
127
Primitive Activities
primitive-activity ::= primitive_activity activity-name (
{ param-decl [ , param-decl ]...
ICCM 2010
128
Predefined Primitive
Activities (1)
• Move
– Moves an agent/object
from one area to another
area.
• Agent/ob...
ICCM 2010
129
Predefined Primitive
Activities (2)
• Communicate
– Communicates agent’s beliefs
from/to receiver agent(s)
•...
ICCM 2010
130
Predefined Primitive
Activities (3)
• Get
– Allows an agent or object to pick up or transfer one or more
obj...
ICCM 2010
131
Move Activity
move PAC.activity-name (
{ PAC.param-decl [ , PAC.param-decl ]* } )
{
{ display : ID.literal-s...
ICCM 2010
132
Java Activities
A Brahms Java Activity is a primitive activity but its actual behavior
is specified in Java ...
ICCM 2010
133
Brahms Java Activity
Syntax
java-activity ::= java PAC.activity-name (
{ PAC.param-decl [ , PAC.param-decl ]...
ICCM 2010
134
“Hello World” Java Activity
java sayHelloWorld() {
max_duration: 0;
class: "gov.nasa.arc.brahms.jact";
when:...
ICCM 2010
135
Brahms - FACET Integration
“Agentify” FACET
– Wrap FACET as a
Brahms Agent
– Design Agent
Communicative Acts...
ICCM 2010
136
Activities and
Workframes
• Activities describe what people do …
• Workframes describe when people do what
t...
ICCM 2010
137
Brahms Workframes
• Workframes are situation-action rules:
– Activities are associated with a conditional st...
ICCM 2010
138
Workframe Syntax
workframe workframe-name
{
{ display : ID.literal-string ; }
{ type : factframe | dataframe...
ICCM 2010
139
AgentViewer Screenshot of Eat
Worfkrame and Activity
ICCM 2010
140
Frame Repeat Attribute
• Repeat
– A frame can be performed one or more times depending on the value of the “...
ICCM 2010
141
AgentViewer Screenshot of Repeating
Eat Worfkrame and Activity
ICCM 2010
142
Priority Attribute
• Priority
– The workframe priority can be set in one of two ways.
– The priority can be ...
Use of Activity Priorities
activities:
primitive_activity eat( ) {
priority: 1;
max_duration: 400;
}
primitive_activitity ...
ICCM 2010
144
Interrupting Workframe and Activity
using Priorities
ICCM 2010
145
Brahms Detectables
(for reactive behavior)
• Associated with workframes and activities
• Active while a work...
ICCM 2010
146
Detectable Grammar
workframe workframe-name
{
{ display : ID.literal-string ; }
{ type : factframe | datafra...
ICCM 2010
147
Detectables in Workframes
workframe wf_waitAtmAsksPin {
repeat: true;
variables:
forone(BankCard) bkc4;
foro...
ICCM 2010
148
Wait for Reply Detectable
composite_activity WaitAndProcessReply (ReplyAgent agt ) {
end_condition: detectab...
ICCM 2010
149
Composite Activities
ICCM 2010
150
Composite Activities
• Decompose activities into sub-activities and
the workframes that can execute them.
• ...
ICCM 2010
151
Composite Activity Syntax
composite-activity PAC.activity-name (
{ PAC.param-decl [ , PAC.param-decl ]* } )
...
ICCM 2010
152
Workframe-Activity
Hierarchy
ICCM 2010
153
Activity Subsumption
ACTIVITY 4ACTIVITY 3ACTIVITY 1
(other
activities)
WF 1
(other
activities)
ACTIVITY 2
WF...
ICCM 2010
154
Model Parallel Activities?
• Example: Talking on cell phone while driving
composite_activity Driving( … ) {
...
ICCM 2010
155
Workframe/Activity States
highest priority
precondition true precondition false
not highest priority
impasse...
Workframe Interruption
group PrimitiveActivityPerformer {
attributes:
public boolean execute_PAC_1;
activities:
primitive_...
ICCM 2010
157
Brahms External Agent
A Brahms External Agents are Brahms agents but its actual behavior
is specified in Jav...
ICCM 2010
158
Speech Dialog Agent
ICCM 2010
159
Agent Communication
ICCM 2010
Two Ways of Agent
Communication
• Communicating individual beliefs
– simple, but unstructured
– mostly used in s...
ICCM 2010
161
Brahms Communications
• Activities that transfer beliefs to/from one
agent to one or several other agents, o...
ICCM 2010
162
What does Alex need to
communicate?
Banking Institution
PIN
Information
Amount of
Money
PIN
Verified
Withdra...
ICCM 2010
163
Communicate Activity
Grammar
communicate PAC.activity-name (
{ PAC.param-decl [ , PAC.param-decl ]* } )
{
{ ...
ICCM 2010
164
Transfer Definition
• The direction of communication
– send: agent send to will always receive
– receive: ag...
ICCM 2010
165
Transfer Definition
• Defines the kind of belief the agent/object is
communicating
• Attribute value is not ...
ICCM 2010
166
Communication
Activities
Group Student:
communicate communicatePIN(Atm at3) {
max_duration: 1;
with: at3;
ab...
ICCM 2010
167
Workframe with
Communicate Activity
workframe wf_communicatePIN {
repeat: true;
variables:
forone(BankCard) ...
ICCM 2010
168
Alex Communicates with
ATM
ICCM 2010
169
Brahms Libraries
• Libraries are Brahms Groups/Classes
with domain-independent common
capabilities
• Brahms ...
ICCM 2010
170
Communication Library
• A Communicator is able
to communicate with other
agents through
communicative acts
•...
ICCM 2010
171
CommunicativeAct
• The CommunicativeAct models a
communication event between two
actors
• Defines a message ...
ICCM 2010
172
Message Envelope
• This map is used to contain address-related information for a communicative act. The key-...
ICCM 2010
173
Message Payload
This map is used to contain content of a communicative act. The key-value conventions are:
"...
ICCM 2010
174
Example Sending ComAct
workframe wf_ConfirmGetAvailableTime {
variables:
forone(ActiveInstance) sender;
foro...
ICCM 2010
175
Receiving ComAct
ICCM 2010
Brahms Hosting
Environment
176
ICCM 2010
Distributed MAS
Communication Framework
177
ICCM 2010
Robotic Recon Field Test
June 20, 2009
Blackpoint Lava Flow, AZ
178
Flight Control Team Science Operations Team
ICCM 2010
Conversation Protocol
179
ICCM 2010
180
More Information …
• E-mail:
Maarten.Sierhuis@parc.com
Maarten.Sierhuis@nasa.gov
• Brahms URL:
http://www.ag...
Upcoming SlideShare
Loading in …5
×

International Conference on Cognitive Modeling 2010 Brahms tutorial

2,254 views

Published on

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.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,254
On SlideShare
0
From Embeds
0
Number of Embeds
75
Actions
Shares
0
Downloads
38
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • 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

    1. 1. ICCM 2010 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® ) Maarten.Sierhuis@parc.com NASA Ames Associate Maarten.Sierhuis@nasa.gov
    2. 2. ICCM 2010 2 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
    3. 3. ICCM 2010 Download This Tutorial From http://public.me.com/msierhuis/ICCM2010/Br ahms ICCM 2010 Tutorial (final).ppt 3
    4. 4. ICCM 2010 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 4
    5. 5. ICCM 2010 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 5
    6. 6. ICCM 2010 • Hermeneutics and Work PracticeHermeneutics and Work Practice (Winograd & Flores)(Winograd & Flores) – Interpreting the world in order to actInterpreting the world in order to act • Situated Action ModelsSituated Action Models (Suchman, Lave)(Suchman, Lave) – Moment-by-moment analysis of interaction between people,Moment-by-moment analysis of interaction between people, tools and environment in a particular situation (or setting).tools and environment in a particular situation (or setting). • Activity TheoryActivity Theory (Vygotsky, Leont’ev, Nardi)(Vygotsky, Leont’ev, Nardi) – An activity creates and encompasses the context through itsAn activity creates and encompasses the context through its enactment of actions and operations of the people engaged, andenactment of actions and operations of the people engaged, and the artifacts used.the artifacts used. • DistributedDistributed CognitionCognition (Hutchins)(Hutchins) – The study of representation of knowledge both inside people’sThe study of representation of knowledge both inside people’s heads and in the artifacts and systems they use, i.e. the totalheads and in the artifacts and systems they use, i.e. the total cognitive system (e.g. the pilots and the cockpit).cognitive system (e.g. the pilots and the cockpit). Understanding ContextUnderstanding Context 6
    7. 7. ICCM 2010 What is practice? Sierhuis’ Definition:Sierhuis’ Definition: • situatedsituated activitiesactivities of a group of peopleof a group of people • synchronously or asynchronouslysynchronously or asynchronously • collaborating and communicatingcollaborating and communicating • gaining experiencegaining 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? 7
    8. 8. ICCM 2010 Work Practice Modeling • Groups & AgentsGroups & Agents – work as activitieswork as activities – beliefs trigger workbeliefs trigger work – bounded rationality is sociallybounded rationality is socially and culturally definedand culturally defined • Collaboration betweenCollaboration between AgentsAgents – agents react to and interactagents react to and interact with other agentswith other agents – same time/same placesame time/same place – same time/different placesame time/different place – different time/same placedifferent time/same place – different time/different placedifferent time/different place 8
    9. 9. ICCM 2010 WPM cont’d • Tools & ArtifactsTools & Artifacts – tools used in activitiestools used in activities – artifacts created in activitiesartifacts created in activities • Environment/GeographyEnvironment/Geography – agents have a locationagents have a location – artifacts have a locationartifacts have a location – detecting real-world factsdetecting real-world facts • CommunicationCommunication – is situatedis situated – the means of communicationthe means of communication depends on the situation (e.g.depends on the situation (e.g. voice loop, f2f communication,voice loop, f2f communication, telephone, faxing, e-mail)telephone, faxing, e-mail) – impacts efficiency of workimpacts efficiency of work 9
    10. 10. ICCM 2010 “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 10
    11. 11. ICCM 2010 11 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
    12. 12. ICCM 2010 From Simulation toFrom Simulation to ImplementationImplementation 12
    13. 13. ICCM 2010 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 13
    14. 14. ICCM 2010 14 Brahms Overview The Language
    15. 15. ICCM 2010 BrahmsBrahms Work is like a symphony, Well rehearsed, but always different 15
    16. 16. ICCM 2010 HistoryHistory Social Systems of Work Work Practice Communities of Practice Work Process Modeling Expert Systems 1992 - 1997 1998 - Now Agents Simulation EthnographyCommonKADS 16
    17. 17. ICCM 2010 Types of Agent Languages Goal 17
    18. 18. ICCM 2010 Brahms Agent EnvironmentBrahms Agent Environment • ComposerComposer for building models.for building models. (or Integrated Development Environment).(or Integrated Development Environment). • CompilerCompiler for compiling models.for compiling models. • Virtual MachineVirtual Machine for simulating models.for simulating models. (or Simulation Engine).(or Simulation Engine). • Agent ViewerAgent Viewer for viewing simulations.for viewing simulations. 18
    19. 19. ICCM 2010 19 Where to download Brahms?
    20. 20. ICCM 2010 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 20
    21. 21. ICCM 2010 21 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
    22. 22. ICCM 2010 22 Brahms Installation Check out Brahms Files Files created by the Brahms installation are in: C:Program Files BrahmsAgentEnvironment
    23. 23. ICCM 2010 23 Language Documentation
    24. 24. ICCM 2010 24
    25. 25. ICCM 2010 25
    26. 26. ICCM 2010 26 Brahms Tutorial
    27. 27. ICCM 2010 Brahms LanguageBrahms Language • Agent Oriented / BDIAgent Oriented / BDI – Agents are first-class citizensAgents are first-class citizens – Agents are belief basedAgents are belief based – Agents are intention based:Agents are intention based: • Beliefs become intentions that trigger reasoning- and/or situation-action rulesBeliefs become intentions that trigger reasoning- and/or situation-action rules – Agents can communicateAgents can communicate • Organizational ModelingOrganizational Modeling – Agents can be modeled within a hierarchical member-of inheritance structureAgents can be modeled within a hierarchical member-of inheritance structure • Object-basedObject-based – Objects can represent physical artifacts, data and concepts to reason withObjects can represent physical artifacts, data and concepts to reason with – Integration of Java objects as data objects, Java activities and Java agentsIntegration of Java objects as data objects, Java activities and Java agents • Geography-basedGeography-based – Areas can be conceptual representations of locationsAreas can be conceptual representations of locations – Areas can be located within other areas, creating a hierarchical environmentAreas can be located within other areas, creating a hierarchical environment modelmodel – Agents and objects can be located within an areaAgents and objects can be located within an area 27
    28. 28. ICCM 2010 Anatomy of a Brahms ModelAnatomy of a Brahms Model • Groups and Agents – Groups contains agents which are located in aGroups contains agents which are located in a • Geography – and these situated agents haveand these situated agents have • Beliefs and Facts – that lead them to engage inthat lead them to engage in • Activities – that take a certain amount of time which arethat take a certain amount of time which are specified within an agent’sspecified within an agent’s • Workframes – that are triggered by agent’s beliefs. Activitiesthat are triggered by agent’s beliefs. Activities can change an agent’s beliefs or affectcan change an agent’s beliefs or affect • Classes and Objects – which could then change facts in the world.which could then change facts in the world. Facts can be detected by agents andFacts can be detected by agents and change an agent’s beliefs which might triggers an agent’schange an agent’s beliefs which might triggers an agent’s • Thoughtframes – that can further change an agent’s beliefs andthat can further change an agent’s beliefs and trigger an agent’s workframe.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 28
    29. 29. ICCM 2010 29 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
    30. 30. ICCM 2010 Time-based Situation-Action Production Rules represent Qualitative Relationships!! Situation-action RulesSituation-action Rules 30 World State F1, F2, F4 ….. E4 Detect F4
    31. 31. ICCM 2010 31 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
    32. 32. ICCM 2010 32 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
    33. 33. ICCM 2010 Event Scheduler T:0 belief X T:1 fact Y …. …. T:N belief Z Multiagent LanguageMultiagent Language BRAHMS Virtual Machine World State fact F1 . fact Fn fact Y Java Activity class Activity2 extends AbstractExternalActivity { …. } class Agent5 extends AbstractExternalAgent { …. } Java Agent 5 Brahms Geography Java VM 33
    34. 34. ICCM 2010 34 Brahms: Distributed MAS Agent Directory Service
    35. 35. ICCM 2010 35 Brahms Agent Engine
    36. 36. ICCM 2010 Architecture Brahms Virtual Machine VM Controller Event Notifier Logger Compiler Compiled Concepts Source Code Static Model Dynamic Model World State Model DB Logs Config Agent / EngineScheduler Analysis Tools JAPI Interactive Development Environment Brahms Composer (Eclipse Plugin) Brahms: the environment 36
    37. 37. ICCM 2010 37 Model Development Cycle 1. Build Model in Composer 2. Compile Model 3. Fix compiler errors 4. Run Simulation 5. Parse History File → MySQL DB 6. Display Results in AgentViewer 1 2
    38. 38. ICCM 2010 38 Composer: Eclipse Plugin
    39. 39. ICCM 2010 39 Model File
    40. 40. ICCM 2010 Composer: Eclipse Plugin 40
    41. 41. ICCM 2010 41 Compile Model
    42. 42. ICCM 2010 42 Model in UML (Poseidon) Compiler generates .XMI file
    43. 43. ICCM 2010 43 Simulate
    44. 44. ICCM 2010 44 Parse History File
    45. 45. ICCM 2010 45 History File Format
    46. 46. ICCM 2010 46 Brahms AgentViewer
    47. 47. ICCM 2010 DEMO 47
    48. 48. ICCM 2010 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 48
    49. 49. ICCM 2010 Agents, Groups, Beliefs and Facts 49
    50. 50. ICCM 2010 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. 50
    51. 51. ICCM 2010 51 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
    52. 52. ICCM 2010 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 52
    53. 53. ICCM 2010 53 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
    54. 54. ICCM 2010 54 Groups group BaseGroup { … } group Student memberof BaseGroup { … } agent Alex memberof Student, BrahmsModeler { … } BaseGroup Student Alex Brahms Modeler
    55. 55. ICCM 2010 NASA Mission Control Org Chart Divisions Branches Groups Roles Agents 55
    56. 56. ICCM 2010 56 Apollo 12 Groups and Agents Roles Functions Agents
    57. 57. ICCM 2010 57 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.
    58. 58. ICCM 2010 58 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
    59. 59. ICCM 2010 59 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 | ‘-’ | ‘:’ | ‘;’ | ‘.’ ] ” ] }
    60. 60. ICCM 2010 60 • 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
    61. 61. ICCM 2010 61 • 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 { }
    62. 62. ICCM 2010 62 • 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
    63. 63. ICCM 2010 63 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.
    64. 64. ICCM 2010 64 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).
    65. 65. ICCM 2010 65 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)
    66. 66. ICCM 2010 66 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
    67. 67. ICCM 2010 67 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); }
    68. 68. ICCM 2010 68 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); }
    69. 69. ICCM 2010 69 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);
    70. 70. ICCM 2010 70 Relationship between Brahms Facts and Beliefs
    71. 71. ICCM 2010 71 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
    72. 72. ICCM 2010 Classes and Objects 72
    73. 73. ICCM 2010 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 73
    74. 74. ICCM 2010 Brahms Class • Describes the properties/behavior of abstract object classes • Types of classes: – Physical artifacts – Computers – Data • Multiple Inheritance 74
    75. 75. ICCM 2010 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 … 75
    76. 76. ICCM 2010 76 BREAK!!!
    77. 77. ICCM 2010 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 77
    78. 78. ICCM 2010 Thoughtframes 78
    79. 79. ICCM 2010 What are some of Alex’s thoughts? 79
    80. 80. ICCM 2010 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 80
    81. 81. ICCM 2010 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 81
    82. 82. ICCM 2010 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 82
    83. 83. ICCM 2010 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 83
    84. 84. ICCM 2010 How long before I am hungry? • IF an hour has gone by THEN my hunger level goes up by 3 84
    85. 85. ICCM 2010 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 85
    86. 86. ICCM 2010 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 86
    87. 87. ICCM 2010 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 87
    88. 88. ICCM 2010 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 88
    89. 89. ICCM 2010 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 89
    90. 90. ICCM 2010 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) 90
    91. 91. ICCM 2010 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) 91
    92. 92. ICCM 2010 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 92
    93. 93. ICCM 2010 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 93
    94. 94. ICCM 2010 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. 94
    95. 95. ICCM 2010 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 Without Variable With Variable 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 95
    96. 96. ICCM 2010 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 96
    97. 97. ICCM 2010 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 97
    98. 98. ICCM 2010 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 98
    99. 99. ICCM 2010 99 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
    100. 100. ICCM 2010 100 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); } }
    101. 101. ICCM 2010 101 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); } }
    102. 102. ICCM 2010 102 Forward Reasoning Student.preferredCashOut Init: T=0: (Alex_Agent.preferred CashOut = 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);
    103. 103. ICCM 2010 Geography 103
    104. 104. ICCM 2010 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. 104
    105. 105. ICCM 2010 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 105
    106. 106. ICCM 2010 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 106
    107. 107. ICCM 2010 • 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 } } 107
    108. 108. ICCM 2010 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 } } 108
    109. 109. ICCM 2010 Paths between areas • Areas are not necessarily a 2-dim. Grid • Areas can sub-areas, sub-areas can have sub-sub- areas, etc 109
    110. 110. ICCM 2010 110 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; Tutorial Scenario Geography
    111. 111. ICCM 2010 111 Sub-Area Facts
    112. 112. ICCM 2010 112 Where in the world is Alex? agent Alex_Agent memberof Student { location: SouthHall; }
    113. 113. ICCM 2010 113 Where in the world is Alex? agent Alex_Agent memberof Student { location: SouthHall; }
    114. 114. ICCM 2010 114 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
    115. 115. ICCM 2010 115 Paths Path from South Hall to Blakes Diner Path from South Hall to Raleigh Restaurant path path-name { { display : ID.literal-string ; } area1 : ARE.area-name ; area2 : ARE.area-name ; { distance : ID.unsigned ; } }
    116. 116. ICCM 2010 116 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; } AtmGeography Berkeley Telegraph_Av_113 UCB Southall SpraulHall Telegraph_Av_2134 Telegraph_Av_2405 Bancroft_AV-_77200 200 80 100 360 240 400 280 240 320 Student Restaurant Atm
    117. 117. ICCM 2010 117 Agent/Object Movement
    118. 118. ICCM 2010 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 118
    119. 119. ICCM 2010 119 Activities and Workframes
    120. 120. ICCM 2010 120 Beyond Task/Goal Analysis Describing & Explaining Behavior Watching Soccer with 50,000 fans Communities of Practice Being Dutch at the World Cup Resting Teamwork 1. 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). 2. “Off-task” activities (waiting, talking, playing) have composite structure, norm-based variations, and purposes relevant to work functions. 3. Some goals are states to sustain, not requiring search or pathfinding (e.g., brainstorming). 4. Must reformulate how Deliberation relates to: Activity Motives and Attentive Coordination
    121. 121. ICCM 2010 Goals vs. Activities Goal Stack 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 121
    122. 122. ICCM 2010 122 Activities Task Activity Goal 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)
    123. 123. ICCM 2010 123 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
    124. 124. ICCM 2010 124 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.
    125. 125. ICCM 2010 125 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.
    126. 126. ICCM 2010 126 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
    127. 127. ICCM 2010 127 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; }
    128. 128. ICCM 2010 128 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
    129. 129. ICCM 2010 129 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)
    130. 130. ICCM 2010 130 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.
    131. 131. ICCM 2010 131 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; }
    132. 132. ICCM 2010 132 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
    133. 133. ICCM 2010 133 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: "gov.nasa.arc.brahms.atm.HelloWorld"; when: start; } // sayHelloWorld
    134. 134. ICCM 2010 134 “Hello World” Java Activity java sayHelloWorld() { max_duration: 0; class: "gov.nasa.arc.brahms.jact"; when: start; } // sayHelloWorld public class HelloWorld extends AbstractExternalActivity { public HelloWorld() { } // HelloWorldActivity /** * Implement the activity */ public void doActivity() throws ExternalException { System.out.println("************************************************"); System.out.println(”*My Brahms Agent is saying: 'Hello Agent World’*"); System.out.println"*************************************************"); } // doActivity } // HelloWorld
    135. 135. ICCM 2010 135 Brahms - FACET Integration “Agentify” FACET – Wrap FACET as a Brahms Agent – Design Agent Communicative Acts – Create Java Interface to FACET
    136. 136. ICCM 2010 136 Activities and Workframes • Activities describe what people do … • Workframes describe when people do what they do … • Thus, they describe when activities are performed …
    137. 137. ICCM 2010 137 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.
    138. 138. ICCM 2010 138 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); } }
    139. 139. ICCM 2010 139 AgentViewer Screenshot of Eat Worfkrame and Activity
    140. 140. ICCM 2010 140 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); } }
    141. 141. ICCM 2010 141 AgentViewer Screenshot of Repeating Eat Worfkrame and Activity
    142. 142. ICCM 2010 142 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.
    143. 143. 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(); } } T1=1 : do_work( ) T2=400 : do_work( ) … Tn=n : eat( ) Tn+1=n+400: do_work( ) … Example 1 T1=1 : do_work( ) T2=300 : eat ( ) T3=n+700: do_work( ) T4=n+800: do_work( ) interrupt resume Example 2 143
    144. 144. ICCM 2010 144 Interrupting Workframe and Activity using Priorities
    145. 145. ICCM 2010 145 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
    146. 146. ICCM 2010 146 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 } }
    147. 147. ICCM 2010 147 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); } }
    148. 148. ICCM 2010 148 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); } } }
    149. 149. ICCM 2010 149 Composite Activities
    150. 150. ICCM 2010 150 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.
    151. 151. ICCM 2010 151 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
    152. 152. ICCM 2010 152 Workframe-Activity Hierarchy
    153. 153. ICCM 2010 153 Activity Subsumption ACTIVITY 4ACTIVITY 3ACTIVITY 1 (other activities) WF 1 (other activities) ACTIVITY 2 WF 2 ACTION X (other workframes) WF 4 (impasse) WF 5 ACTIVITY 6 (other activities)
    154. 154. ICCM 2010 154 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(…); } } }
    155. 155. ICCM 2010 155 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
    156. 156. Workframe Interruption group PrimitiveActivityPerformer { attributes: public boolean execute_PAC_1; activities: primitive_activity PAC_1(int pri) { display: "PAC 1"; priority: pri; max_duration: 900; } primitive_activity PAC_2(int pri, int dur) { display: "PAC 2"; 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) Tn+1 = Tn + 1800 Tn+2 = Tn+1 + 900 156
    157. 157. ICCM 2010 157 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
    158. 158. ICCM 2010 158 Speech Dialog Agent
    159. 159. ICCM 2010 159 Agent Communication
    160. 160. ICCM 2010 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 160
    161. 161. ICCM 2010 161 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.
    162. 162. ICCM 2010 162 What does Alex need to communicate? Banking Institution PIN Information Amount of Money PIN Verified Withdrawal Amount Approved
    163. 163. ICCM 2010 163 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
    164. 164. ICCM 2010 164 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;
    165. 165. ICCM 2010 165 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>);
    166. 166. ICCM 2010 166 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; }
    167. 167. ICCM 2010 167 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); } }
    168. 168. ICCM 2010 168 Alex Communicates with ATM
    169. 169. ICCM 2010 169 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
    170. 170. ICCM 2010 170 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
    171. 171. ICCM 2010 171 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/fipa000 37/index.html
    172. 172. ICCM 2010 172 Message Envelope • This map is used to contain address-related information for a communicative act. The key-value conventions are: "from” - ActiveInstance (required) "to” - ActiveInstance (required) "date” - string (required, formatted as yyyyMMddThhmmssSSSZ (UTC date/time) "comments” - string (optional) "acl-representation" - string (optional) "encrypted” - boolean (optional) "payload-length" - string (optional) "payload-encoding" - string (optional) "intended-receiver" - ActiveInstance (optional) "received" - ReceivedObject (optional) Example: (<communicative_act>.envelope(“from”) = <sending_agent> ) (<communicative_act>.envelope(“to”) = <receiving_agent> )
    173. 173. ICCM 2010 173 Message Payload This map is used to contain content of a communicative act. The key-value conventions are: "performative” - symbol (required - INFORM, REQUEST, SUBSCRIBE, etc.) "sender” - ActiveInstance (required) "receiver" - ActiveInstance (required) "reply-to" - ActiveInstance (optional) "action" - symbol (optional) "subject" - symbol (optional) "content" - any instance type (optional) "language" - string (optional) "encoding" - string (optional) "ontology" - string (optional) "protocol" - string (optional) "conversation-id" - string (optional) "reply-with” - string (optional) "in-reply-to” - string (optional) "reply-by" - string (optional, date/time formatted as yyyyMMddThhmmssSSSZ (UTC date/time)) Example: (<communicative_act>.payload(“sender”) = <sending_agent> )
    174. 174. ICCM 2010 174 Example Sending ComAct workframe wf_ConfirmGetAvailableTime { variables: forone(ActiveInstance) sender; forone(string) convid; forone(CommunicativeAct) reply; forone(Activity) act; when ( (comact.payload("performative") = REQUEST) and (comact.payload("action") = getAvailableTime) and (comact.payload("sender") = sender) and (comact.payload("purpose") = act) and (comact.payload("conversation-id") = convid)) do { createCommunicativeAct(current, sender, INFORM, convid, getAvailableTime, classtype, current, reply); setPayloadProperty(reply, "content", payloadobj1); setPayloadProperty(reply, "purpose", act); sendCommunicativeAct(reply, sender); }//do }//wf_ConfirmGetAvailableTime
    175. 175. ICCM 2010 175 Receiving ComAct
    176. 176. ICCM 2010 Brahms Hosting Environment 176
    177. 177. ICCM 2010 Distributed MAS Communication Framework 177
    178. 178. ICCM 2010 Robotic Recon Field Test June 20, 2009 Blackpoint Lava Flow, AZ 178 Flight Control Team Science Operations Team
    179. 179. ICCM 2010 Conversation Protocol 179
    180. 180. ICCM 2010 180 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

    ×