25
1 Brahms Tutorial Overview of Brahms and Anatomy of a Brahms model

Brahms Agent-Based Modeling & Simulation Course #1

Embed Size (px)

Citation preview

1

Brahms Tutorial

Overview of Brahms and Anatomy of a Brahms model

Brahms

Multi-Agent LanguageMulti-Agent Language

Language CompilerLanguage Compiler

Interactive Development Environment Interactive Development Environment

Discrete-event Simulation Engine / Discrete-event Simulation Engine /

Virtual MachineVirtual Machine

End-user Simulation DisplaysEnd-user Simulation Displays

Simulation History Data BaseSimulation History Data Base

Java-based

Java API

XML

Runs on PC’s,Mac, Unix, Linux ...

© Maarten Sierhuis

Why 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

• Simulation as a work system design/analysis tool

• Humans as social and collaborative agents

• Agents are situated, deliberative, cognitive and reactive

• Brahms is a general purpose modeling and simulation environment

• Understanding how people really work• Developing multi-agent systems

Theoretical Practical

September 29, 2009 4

Methodology: Simulation to Implementation

Implementation

Future OpsFuture OpsSimulationSimulation

Metrics& Data

Current OpsSimulation

WorkSystemDesign

WorkflowTool

Observation

Operations

September 29, 2009 5

2

4

6

8

10

TRL

1992 1996 2000 2004 2008

NYNEX

JPL

JSC

APOLLO

VICTORIA

JSC MOD OCAMSPROJECT

BRAHMS – HISTORY OF APPLICATIONS

ISS

SurfaceHab

Mobile*Agents

* Supported ExPOC and Scout robot and crew in Sept’06 field test & Pogo Test in July ‘07

Aeronautics CTFM

PROJECT

Brahms 24x7 in Mission Control

6

Types of Agent Languages

7

Overview of BrahmsAgent Environment

Agent Environment consists of the following:• Brahms Agent Oriented Language• Composer for building models.

(or Integrated Development Environment).

• Compiler for compiling models.• Virtual Machine for simulating models.

(or Simulation Engine).

• Agent Viewer for viewing simulations.

8

Brahms Language

• Agent Oriented / BDI– Agents are first-class citizens– Agents are belief based– Agents are intention based:

• Beliefs become intentions that trigger reasoning- and/or situation-action rules

• Organizational Modeling– Agents can be modeled within an hierarchical member-of inheritance structure

• Object-based– Objects can represent physical artifacts, data and concepts to reason with– Integration of Java objects as data objects, Java activities and Java agents

• Geography-based– Areas can be conceptual representations of locations– Areas can be located within other areas, creating a hierarchical environment

model– Agents and objects can be located within an area

9

• Agent Organization– Group membership inheritance hierarchy

• Artifacts in the world as objects relevant in activities– Tools and artifacts people use– Class hierarchies

• Data as objects– Information modeling

• Environment and its state– Represented hierarchically as areas with sub-areas– Agents and objects are located within areas– World State (facts vs. beliefs of agents)– Detecting facts (reactive)

• Behavior as situated activities that take time– Constraint on beliefs (workframes)– Primitive or composite (decomposed)

• Goal-directed reasoning behavior as production rules within an activity that takes time– Forward-chaining rules that take no time (thoughtframes)

What Brahms Models Include

10

Anatomy of a Brahms ModelLanguage Concepts

GroupsAgentsClassesObjectsAreaDefsAreasPathsConceptual ClassesConceptual Objects

Attributes (OA-V)Relations (ORO)BeliefsFactsActivitiesWorkframesPreconditionsConsequencesDetectablesThoughtframes

agent-based

object-based

geo-based

object flows

mental state/world state

activity-based/subsumption

rule-based

reactive

inferences

11

Brahms Agent

Engine

Beliefs(atomic

formulas)

Desires(workframes

thoughtframes belief matching)

Plans(workframes

Thoughtframesactivities)

Intentions(workframes

thoughtframesinstantiations)

input

actionoutput

Beliefs-Desires-Intentions

12

Brahms: agent-oriented languageSymbolic Discrete Event BDI-like 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

Symbolic Discrete Event System

Production Rules represent Qualitative Relationships!!

Situation-action Rules

Multiagent Modeling Language

BRAHMSVirtual

Machine

Scheduler

T:0 belief XT:1 fact Y….….T:N belief Z

World Statefact F1

.fact Fn

fact YJava

class Activity2 extends AbstractExternalActivity{ …. }

class Agent5 extends AbstractExternalAgent

{ …. }

Java Agent 5

Worldenvironment

15

Brahms: Distributed MAS

AgentDirectoryService

16

Brahms Agent Engine

17

Brahms Virtual Machine

Agent

Engine

Discrete EventQueue

BeliefRSN

FactRSN

Belief Set

Work Selector

Work Executor

World State

Fact Set

Real-Time Mode

Scheduler

DiscreteEventQueue

EventDistributor

SIM Mode

18

Brahms Model

compilation-unit ::= [ PCK.package-declaration ]*[ IMP.import-declaration ]*[ GRP.group | AGT.agent | CLS.class |

OBJ.object | COC.conceptual-class | COB.conceptual-object | ADF.areadef | ARE.area | PAT.path ]*

• A Brahms model consists of an number of compilation units

• Each compilation unit is usually put in a separate .b file

19

Brahms Packages and Compilation Unit

• A compilation unit is a file with the extension '.b'.

• A compilation unit consists of 3 parts, each of which is optional:1. A package declaration, giving the fully

qualified name of the package to which the compilation unit belongs.

• For example, “package projects.Atm;” 2. Import statements that allow types from

other packages to be referred to using their simple names.

• For example, “import projects.Atm.*;”3. Type declarations of group, agent, class,

object, conceptual object class, conceptual object, area definition, area and path types.

20

Model Files

21

Brahms Compiler (bc)[~/Applications/AgentEnvironment/bin] sierhuis% ./bcNASA Ames Research Center Brahms Compiler Version 2.21.8Copyright (c) 1997-2008 NASA Ames Research Center. All Rights Reserved.

Usage: bc [options] <brahms file>

Options: -lp <library-path> set library path -source <source-path> set the source code path -d <destination-path> set the path where to write the compiled code to. -bar <archive file> the archive file in which to store the files with the compiled code. -dtd <dtd path> set the path where DTD files can be found -uml generate XMI-based UML for the model -cp set the Java class path to find Java activities -? displays usage textBrahms file: .b file to be compiled

22

sierhuis% pwd/Users/sierhuis/Documents/eclipse/workspace/Brahms Tutorial Files/AtmModel/final_source

sierhuis% ~/Applications/AgentEnvironment/bin/bc -lp ~/Applications/AgentEnvironment/Models/lib -source source -d build -bar ./lib/AtmModel.bar ./source/gov/nasa/arc/brahms/atm/AtmModel.b

NASA Brahms Compiler Version 2.21.8Copyright (c) 1997-2008 NASA Ames Research Center. All Rights Reserved.

0 error(s), 0 warning(s)Exporting model as XML

0 error(s), 0 warning(s)Creating Brahms archive file.Archive './lib/AtmModel.bar' created.

Command LineModel Compilation

23

Brahms Virtual Machine (bvm)

[~/Applications/AgentEnvironment/bin] sierhuis% ~/Applications/AgentEnvironment/bin/bvmBrahms Virtual Machine - Version: 4.0.31 CI Interface - Version: 1.4.28Copyright (c) 1999-2008 NASA Ames Research Center. All Rights Reserved.usage: bvm [-options] [<model>]

where options include: -cf <config file> use configuration file -vmname <vm name> name for vm to register in directory -mode (sim | rt | drt) mode of operation, simulation, real-time or distributed -date <date and time> the start date and time for the sim "MM/dd/yyyy HH:mm:ss zzzz" -time_unit <n> number of seconds represented by each unit of time -cp <class path> appended search path for Java class files -lp <library path> search path for brahms xml files -es <class files> external services to be loaded -ui display simulation control panel -no_auto_start do not automatically start the model, use the control panel to start model -no_auto_stop do not automatically stop the model when the simulation finishes, use the control panel

instead

24

Executing the model (cont’d)

sierhuis% ~/Applications/AgentEnvironment/bin/bvm -cf vm.cfg -ui gov.nasa.arc.brahms.atm.AtmModel

INFO : Brahms Virtual Machine - Version: 4.0.31 INFO : CI Interface - Version: 1.4.28INFO : Copyright (c) 1999-2008 NASA Ames Research Center. All Rights

Reserved.INFO : Serial number: 31069562272561010 License expires: 12/30/2050INFO : Initializing virtual machineINFO : Logger created and initializedINFO : Starting event notifierINFO : Loaded concept 'gov.nasa.arc.brahms.atm.Alex_Cash'INFO : Loaded concept 'gov.nasa.arc.brahms.atm.Telegraph_Av_2134'INFO : Loaded concept 'gov.nasa.arc.brahms.atm.Alex_Agent'INFO : Loaded concept 'gov.nasa.arc.brahms.atm.WF_to_from_BB’…INFO : Starting virtual machineINFO : Starting schedulerINFO : Starting engine for 'gov.nasa.arc.brahms.atm.Alex_Agent'INFO : Starting engine for 'gov.nasa.arc.brahms.atm.Kim_Agent'INFO : Starting engine for 'gov.nasa.arc.brahms.atm.Campanile_Clock'INFO : Starting engine for 'gov.nasa.arc.brahms.atm.Boa_Atm'INFO : Starting engine for 'gov.nasa.arc.brahms.atm.WF_Bank'INFO : Starting engine for 'gov.nasa.arc.brahms.atm.WF_Atm'INFO : Starting engine for 'gov.nasa.arc.brahms.atm.Boa_Bank'…

…INFO : Virtual machine started...INFO : Pausing virtual machineINFO : Pausing schedulerINFO : Resuming virtual machineINFO : Resuming schedulerINFO : Stopping virtual machineINFO : Stopping scheduler...INFO : Scheduler stoppedINFO : Stopping engine for 'gov.nasa.arc.brahms.atm.Alex_Agent'INFO : Stopping engine for 'gov.nasa.arc.brahms.atm.Kim_Agent'INFO : Stopping engine for 'gov.nasa.arc.brahms.atm.Campanile_Clock'INFO : Stopping engine for 'gov.nasa.arc.brahms.atm.Boa_Atm'INFO : Stopping engine for 'gov.nasa.arc.brahms.atm.WF_Bank'INFO : Stopping engine for 'gov.nasa.arc.brahms.atm.WF_Atm'INFO : Stopping engine for 'gov.nasa.arc.brahms.atm.Boa_Bank'INFO : Stopped event notifierVirtual Machine's running time: 0:0:24.456Model Loader's running time: 0:0:1.567Model Initializer's running time: 0:0:0.102Model Simulator's running time: 0:0:20.489Model Exporter's running time: 0:0:0.1

25