international conference on cognitive modeling 2010 brahms tutorial
DESCRIPTION
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.TRANSCRIPT
![Page 1: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/1.jpg)
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®)
NASA Ames Associate
![Page 2: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/2.jpg)
ICCM 2010 2
NASA ARCBrahms 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
![Page 3: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/3.jpg)
ICCM 2010
Download This Tutorial From
http://public.me.com/msierhuis/ICCM2010/Brahms ICCM 2010 Tutorial (final).ppt
3
![Page 4: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/4.jpg)
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
![Page 5: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/5.jpg)
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
![Page 6: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/6.jpg)
ICCM 2010
• Hermeneutics and Work Practice Hermeneutics 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 Theory Activity Theory (Vygotsky, Leont’ev, Nardi)(Vygotsky, Leont’ev, Nardi)– An activity creates and encompasses the context through its An activity creates and encompasses the context through its
enactment of actions and operations of the people engaged, and enactment of actions and operations of the people engaged, and the artifacts used.the artifacts used.
• DistributedDistributed Cognition Cognition (Hutchins)(Hutchins)– The study of representation of knowledge both inside people’s The study of representation of knowledge both inside people’s
heads and in the artifacts and systems they use, i.e. the total heads 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
![Page 7: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/7.jpg)
ICCM 2010
What is practice?
Sierhuis’ Definition:Sierhuis’ Definition:
• situatedsituated activitiesactivities of a group of people of a group of people • synchronously or asynchronouslysynchronously or asynchronously• collaborating and communicatingcollaborating and communicating• gaining experience 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?
7
![Page 8: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/8.jpg)
ICCM 2010
Work Practice Modeling
• Groups & AgentsGroups & Agents– work as activitieswork as activities
– beliefs trigger workbeliefs trigger work
– bounded rationality is socially bounded rationality is socially and culturally definedand culturally defined
• Collaboration between Collaboration between AgentsAgents– agents react to and interact agents 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
![Page 9: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/9.jpg)
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 location agents have a location – artifacts have a locationartifacts have a location– detecting real-world factsdetecting real-world facts
• CommunicationCommunication– is situated is situated – the means of communication the 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
![Page 10: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/10.jpg)
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
![Page 11: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/11.jpg)
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
![Page 12: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/12.jpg)
ICCM 2010
From Simulation to From Simulation to ImplementationImplementation
12
![Page 13: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/13.jpg)
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
SurfaceHab
MobileAgents
OnboardISS
201113
![Page 14: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/14.jpg)
ICCM 2010 14
Brahms Overview
The Language
![Page 15: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/15.jpg)
ICCM 2010
BrahmsBrahms
Work is like a symphony,Well rehearsed, but always different
15
![Page 16: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/16.jpg)
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
![Page 17: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/17.jpg)
ICCM 2010
Types of Agent Languages
Goal
17
![Page 18: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/18.jpg)
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
![Page 19: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/19.jpg)
ICCM 2010 19
Where to download Brahms?
![Page 20: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/20.jpg)
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
![Page 21: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/21.jpg)
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
![Page 22: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/22.jpg)
ICCM 2010 22
Brahms InstallationCheck out Brahms Files
Files created by the Brahms installation are in:
C:\Program Files\ Brahms\AgentEnvironment
![Page 23: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/23.jpg)
ICCM 2010 23
Language Documentation
![Page 24: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/24.jpg)
ICCM 2010 24
![Page 25: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/25.jpg)
ICCM 2010 25
![Page 26: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/26.jpg)
ICCM 2010 26
Brahms Tutorial
![Page 27: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/27.jpg)
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 environment Areas 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
![Page 28: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/28.jpg)
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 are that 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. Activities that 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 and Facts 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 and that 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
![Page 29: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/29.jpg)
ICCM 2010 29
Anatomy of a Brahms ModelLanguage 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
![Page 30: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/30.jpg)
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
![Page 31: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/31.jpg)
ICCM 2010 31
Brahms: agent-oriented languageSymbolic 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
![Page 32: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/32.jpg)
ICCM 2010 32
Brahms Agent
Engine
Beliefs(atomic
formulas)
Desires(workframes
thoughtframes belief matching)
Plans(workframes
Thoughtframesactivities)
Intentions(workframes
thoughtframesinstantiations)
input
actionoutput
Beliefs-Desires-Intentions
![Page 33: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/33.jpg)
ICCM 2010
Event Scheduler
T:0 belief XT:1 fact Y….….T:N belief Z
Multiagent LanguageMultiagent Language
BRAHMSVirtual
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
![Page 34: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/34.jpg)
ICCM 2010 34
Brahms: Distributed MAS
AgentDirectoryService
![Page 35: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/35.jpg)
ICCM 2010 35
Brahms Agent Engine
![Page 36: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/36.jpg)
ICCM 2010
Architecture
Brahms Virtual Machine
VMController
EventNotifier
Logger
Compiler
CompiledConcepts
SourceCode
StaticModel
DynamicModel
WorldState
ModelDB
Logs
ConfigAgent /EngineScheduler
AnalysisTools
JAPI
Interactive Development Environment
BrahmsComposer
(Eclipse Plugin)
Brahms: the environment
36
![Page 37: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/37.jpg)
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
![Page 38: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/38.jpg)
ICCM 2010 38
Composer: Eclipse Plugin
![Page 39: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/39.jpg)
ICCM 2010 39
Model File
![Page 40: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/40.jpg)
ICCM 2010
Composer: Eclipse Plugin
40
![Page 41: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/41.jpg)
ICCM 2010 41
Compile Model
![Page 42: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/42.jpg)
ICCM 2010 42
Model in UML (Poseidon)
Compiler generates.XMI file
![Page 43: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/43.jpg)
ICCM 2010 43
Simulate
![Page 44: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/44.jpg)
ICCM 2010 44
Parse History File
![Page 45: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/45.jpg)
ICCM 2010 45
History File Format
![Page 46: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/46.jpg)
ICCM 2010 46
Brahms AgentViewer
![Page 47: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/47.jpg)
ICCM 2010
DEMO
47
![Page 48: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/48.jpg)
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
![Page 49: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/49.jpg)
ICCM 2010
Agents, Groups, Beliefs and Facts
49
![Page 50: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/50.jpg)
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
![Page 51: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/51.jpg)
ICCM 2010 51
Brahms Agentagent 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
![Page 52: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/52.jpg)
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
![Page 53: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/53.jpg)
ICCM 2010 53
Brahms Groupgroup 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
![Page 54: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/54.jpg)
ICCM 2010 54
Groups
group BaseGroup { … }
group Student memberof BaseGroup { … }
agent Alex memberof Student, BrahmsModeler { … }
BaseGroup
Student
Alex
BrahmsModeler
![Page 55: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/55.jpg)
ICCM 2010
NASA Mission ControlOrg Chart
Divisions
Branches
Groups
Roles
Agents
55
![Page 56: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/56.jpg)
ICCM 2010
56
Apollo 12 Groups and Agents
Roles
Functions
Agents
![Page 57: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/57.jpg)
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.
![Page 58: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/58.jpg)
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
![Page 59: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/59.jpg)
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 | ‘-’ | ‘:’ | ‘;’ | ‘.’ ] ” ]
}
![Page 60: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/60.jpg)
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) = 10myMap(2) = 20LmyMap(3) = currentmyMap(4) = truemyMap(5) = “a string”myMap(6) = asymbolmyMap(7) = unknown
myMap(“string1”) = 10myMap(“string2”) = 20LmyMap(“string3”) = currentmyMap(“string4”) = truemyMap(“string5”) = “a string”myMap(“string6”) = asymbolmyMap(“string7”) = unknown
![Page 61: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/61.jpg)
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 {
}
![Page 62: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/62.jpg)
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 groupAgent ::= any agentClass ::= any classObject ::= any objectActiveClass := any group or classActiveInstance ::= any agent or objectActiveConcept ::= any active class and active instanceConcept ::= any active concept, conceptual concept and geography concept
Example: Maarten.myGroup = Student
![Page 63: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/63.jpg)
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.
![Page 64: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/64.jpg)
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).
![Page 65: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/65.jpg)
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)
![Page 66: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/66.jpg)
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
![Page 67: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/67.jpg)
ICCM 2010 67
Initial Beliefsgroup Student {
attributes:public boolean male;
initial_beliefs:(current.male = unknown);
}
agent Alex memberof Student {}
agent Kim memberof Student {initial_beliefs:
(current.male = false);}
![Page 68: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/68.jpg)
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-basedagent 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);}
![Page 69: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/69.jpg)
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.unsignedfact-certainty::=fc : ID.unsigned
conclude((current.male = true), bc:100, fc:0);
![Page 70: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/70.jpg)
ICCM 2010 70
Relationship between Brahms Facts and Beliefs
![Page 71: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/71.jpg)
ICCM 2010 71
Brahms Facts & Beliefs
WorldFact: (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
![Page 72: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/72.jpg)
ICCM 2010
Classes and Objects
72
![Page 73: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/73.jpg)
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
![Page 74: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/74.jpg)
ICCM 2010
Brahms Class
• Describes the properties/behavior of abstract object classes
• Types of classes:– Physical artifacts– Computers– Data
• Multiple Inheritance
74
![Page 75: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/75.jpg)
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
![Page 76: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/76.jpg)
ICCM 2010 76
BREAK!!!
![Page 77: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/77.jpg)
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
![Page 78: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/78.jpg)
ICCM 2010
Thoughtframes
78
![Page 79: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/79.jpg)
ICCM 2010
What are some of Alex’s thoughts?
79
![Page 80: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/80.jpg)
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
![Page 81: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/81.jpg)
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
![Page 82: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/82.jpg)
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
![Page 83: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/83.jpg)
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
![Page 84: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/84.jpg)
ICCM 2010
How long before I am hungry?
• IF an hour has gone by THEN my hunger level goes up by 3
84
![Page 85: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/85.jpg)
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
![Page 86: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/86.jpg)
ICCM 2010
Thoughtframes Syntax
thoughtframe thoughtframe-name {display: literal-string;repeat: truth-value;priority: unsigned;variables: variable declarationwhen(precondition-declaration)do {
thoughtframe-body-element}
}
thoughtframe-name ::= name thoughtframe-body-decl ::= do { [ thoughtframe-body-element ; ]* }thoughtframe-body-element ::= CON.consequence
86
![Page 87: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/87.jpg)
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
![Page 88: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/88.jpg)
ICCM 2010
Knownval Preconditionthoughtframe 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
![Page 89: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/89.jpg)
ICCM 2010
Not Preconditionthoughtframe 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
![Page 90: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/90.jpg)
ICCM 2010
Known Preconditionthoughtframe 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
![Page 91: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/91.jpg)
ICCM 2010
Unknown Preconditionthoughtframe 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
![Page 92: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/92.jpg)
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
![Page 93: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/93.jpg)
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
![Page 94: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/94.jpg)
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
![Page 95: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/95.jpg)
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
![Page 96: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/96.jpg)
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 Referencehttp://www.agentisolutions.com/documentation/language/ls_var_stx.htm
96
![Page 97: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/97.jpg)
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)
andknownval(cashobj.amount < 10.00))
do { conclude( (cashobj.amount = cashobj.amount + 10.00), bc:100, fc:100);}//do
}//tf_PreferredCashOut
97
![Page 98: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/98.jpg)
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
![Page 99: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/99.jpg)
ICCM 201099
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
![Page 100: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/100.jpg)
ICCM 2010100
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); }}
![Page 101: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/101.jpg)
ICCM 2010101
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); }}
![Page 102: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/102.jpg)
ICCM 2010102
Forward Reasoning
Student.preferredCashOut
Init: T=0: (Alex_Agent.preferredCashOut = 8.00);
Student.preceivedTime
Cash.amountT=24700: (Alex_Cash.amount = 13.00);
T=25200: (Alex_Agent.perceivedtime = 8);
Campanile_Clock.timeT=28800: (Campanile_Clock.time = 9);
tf_feelHungry
T=28800: (Alex_Agent.howHungry = 21.00);T=28800: (Alex_Agent.perceivedtime = 9);
Student.howHungrytf_cash_Neededtf_cash_Not_Needed
T=28800: (Alex_Agent.needCash = false);
Student.needCash Student.checkedDiner
tf_ChooseRaleightf_ChooseBlakes
Student.chosenDiner
T=28800: (Alex_Agent.chosenDiner = Raleigh_Diner)T=28800: (Alex_Agent.checkedDiner = true);;
T=28800: (Alex_Agent.checkedDiner = false);
![Page 103: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/103.jpg)
ICCM 2010
Geography
103
![Page 104: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/104.jpg)
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
![Page 105: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/105.jpg)
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
![Page 106: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/106.jpg)
ICCM 2010
BaseAreaDef
• BaseAreaDef is the Brahms base class for areas
• Every area is an instance of BaseAreaDef
• Default special relations in BaseAreaDefpackage 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
![Page 107: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/107.jpg)
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
![Page 108: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/108.jpg)
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
![Page 109: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/109.jpg)
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
![Page 110: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/110.jpg)
ICCM 2010110
package projects.atm;
areadef University extends BaseAreaDef { }areadef UniversityHall extends Building { }areadef BankBranch extends Building { }areadef Restaurant extends Building { }
// ATM Worldarea AtmGeography instanceof World { }
// Berkeleyarea Berkeley instanceof City partof AtmGeography { }
// inside Berkeleyarea 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
![Page 111: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/111.jpg)
ICCM 2010111
Sub-Area Facts
![Page 112: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/112.jpg)
ICCM 2010112
Where in the world is Alex?
agent Alex_Agent memberof Student {location: SouthHall;
}
![Page 113: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/113.jpg)
ICCM 2010113
Where in the world is Alex?
agent Alex_Agent memberof Student {location: SouthHall;
}
![Page 114: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/114.jpg)
ICCM 2010114
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
![Page 115: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/115.jpg)
ICCM 2010115
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 ; }}
![Page 116: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/116.jpg)
ICCM 2010116
Paths to Restaurants
//paths to and from banks from spraul //and south hallspath SpH_to_from_WF {
area1: SpraulHall;area2: Bancroft_Av_77;distance: 200;
}
AtmGeography
BerkeleyTelegraph_Av_113
UCBSouthall
SpraulHall
Telegraph_Av_2134
Telegraph_Av_2405
Bancroft_AV-_77200
20080
100
360
240
400
280240
320
Student
Restaurant
Atm
![Page 117: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/117.jpg)
ICCM 2010117
Agent/Object Movement
![Page 118: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/118.jpg)
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
![Page 119: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/119.jpg)
ICCM 2010 119
Activities and Workframes
![Page 120: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/120.jpg)
ICCM 2010 120
Beyond Task/Goal AnalysisDescribing & 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
![Page 121: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/121.jpg)
ICCM 2010
Goals vs. Activities
Goal Stack
Problem-Solving Approach Activity Approach
6. Add 3 and 45. Solve x-4 = 34. Solve equation on screen3. Get experiment credit2. Pass introductory psychology1. Get college degree
Act: Taking an introductory psychology classDuration: 1 semester
Act: Going to collegeDuration: 4 years
Act: Doing an experimentDuration: 2 hours
Act: Solving equation x-4 = 3Duration: 2 mins
Act: Adding 2 and 4Duration: 1 sec
121
![Page 122: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/122.jpg)
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)
![Page 123: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/123.jpg)
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
![Page 124: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/124.jpg)
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.
![Page 125: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/125.jpg)
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.
![Page 126: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/126.jpg)
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
![Page 127: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/127.jpg)
ICCM 2010 127
Primitive Activitiesprimitive-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;
}
![Page 128: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/128.jpg)
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
![Page 129: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/129.jpg)
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)
![Page 130: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/130.jpg)
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.
![Page 131: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/131.jpg)
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;}
![Page 132: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/132.jpg)
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
![Page 133: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/133.jpg)
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
![Page 134: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/134.jpg)
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
![Page 135: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/135.jpg)
ICCM 2010 135
Brahms - FACET Integration
“Agentify” FACET– Wrap FACET as a
Brahms Agent
– Design Agent Communicative Acts
– Create Java Interface to FACET
![Page 136: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/136.jpg)
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 …
![Page 137: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/137.jpg)
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.
![Page 138: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/138.jpg)
ICCM 2010 138
Workframe Syntaxworkframe 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); }}
![Page 139: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/139.jpg)
ICCM 2010 139
AgentViewer Screenshot of Eat Worfkrame and Activity
![Page 140: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/140.jpg)
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); }}
![Page 141: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/141.jpg)
ICCM 2010 141
AgentViewer Screenshot of RepeatingEat Worfkrame and Activity
![Page 142: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/142.jpg)
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.
![Page 143: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/143.jpg)
Use of Activity Prioritiesactivities: 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( )
interruptresume
Example 2
143
![Page 144: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/144.jpg)
ICCM 2010 144
Interrupting Workframe and Activity using Priorities
![Page 145: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/145.jpg)
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
![Page 146: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/146.jpg)
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 }}
![Page 147: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/147.jpg)
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);
}}
![Page 148: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/148.jpg)
ICCM 2010 148
Wait for Reply Detectablecomposite_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);
}}
}
![Page 149: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/149.jpg)
ICCM 2010 149
Composite Activities
![Page 150: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/150.jpg)
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.
![Page 151: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/151.jpg)
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
![Page 152: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/152.jpg)
ICCM 2010 152
Workframe-Activity Hierarchy
![Page 153: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/153.jpg)
ICCM 2010 153
Activity Subsumption
ACTIVITY 4 ACTIVITY 3 ACTIVITY 1
(other activities)
WF 1
(other activities)
ACTIVITY 2
WF 2
ACTION X
(other workframes)
WF 4 (impasse)
WF 5
ACTIVITY 6
(other activities)
![Page 154: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/154.jpg)
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(…); }
}}
![Page 155: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/155.jpg)
ICCM 2010 155
Workframe/Activity States
highest priority
precondition true precondition false
not highest priority
impasse detectable
end workframe oriabort | complete | end_activity detectable
highest priority
repeat = true
impasse resolved
![Page 156: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/156.jpg)
Workframe Interruptiongroup 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
![Page 157: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/157.jpg)
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
![Page 158: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/158.jpg)
ICCM 2010 158
Speech Dialog Agent
![Page 159: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/159.jpg)
ICCM 2010 159
Agent Communication
![Page 160: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/160.jpg)
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
![Page 161: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/161.jpg)
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.
![Page 162: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/162.jpg)
ICCM 2010 162
What does Alex need to communicate?
Banking Institution
PIN Information
Amount of Money
PIN Verified
Withdrawal Amount
Approved
![Page 163: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/163.jpg)
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 | receivecommunicative-act ::= OBJ.object-name | PAC.param-name
![Page 164: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/164.jpg)
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;
![Page 165: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/165.jpg)
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>);
![Page 166: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/166.jpg)
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;}
![Page 167: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/167.jpg)
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) andnot(current contains bkc3) andknownval(current.chosenBank = ba3) andknownval(at3 ownedbyBank ba3) andknownval(current.pinCommunicated = false) andknownval(current.location = at3.location) andknownval(current.pinRemembered = true) andknownval(current.waitAtmAsksPin = false))
do {processCommunicatePin();communicatePIN(at3);conclude((current.waitAtmAsksAmount = true), bc:100, fc:100);conclude((current.pinCommunicated = true), bc:100, fc:100);
}}
![Page 168: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/168.jpg)
ICCM 2010 168
Alex Communicates with ATM
![Page 169: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/169.jpg)
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
![Page 170: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/170.jpg)
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
![Page 171: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/171.jpg)
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/fipa00037/index.html
![Page 172: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/172.jpg)
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> )
![Page 173: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/173.jpg)
ICCM 2010 173
Message PayloadThis 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> )
![Page 174: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/174.jpg)
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
![Page 175: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/175.jpg)
ICCM 2010 175
Receiving ComAct
![Page 176: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/176.jpg)
ICCM 2010
Brahms Hosting Environment
176
![Page 177: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/177.jpg)
ICCM 2010
Distributed MAS Communication Framework
177
![Page 178: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/178.jpg)
ICCM 2010
Robotic Recon Field TestJune 20, 2009
Blackpoint Lava Flow, AZ
178
Flight Control Team Science Operations Team
![Page 179: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/179.jpg)
ICCM 2010
Conversation Protocol
179
![Page 180: International Conference on Cognitive Modeling 2010 Brahms tutorial](https://reader037.vdocuments.us/reader037/viewer/2022110118/55512f28b4c905b3598b4dbc/html5/thumbnails/180.jpg)
ICCM 2010 180
More Information …
• E-mail: [email protected]
• Brahms URL: http://www.agentisolutions.com
• Brahms Papers in Publications on: http://homepage.mac.com/msierhuis http://Bill.Clancey.name