Title: FABLES: A Functional Agent-Based Language for Simulations
1 FABLES A Functional Agent-Based Language
for Simulations
- László Gulyás
- AITIA International, Inc
- lgulyas_at_aitia.ai
- with Sándor Bartha
- Simulation Center, Cooperative Research Center
- Faculty of Informatics, Lorand Eotvos University
- Supported by the GVOP-3.2.2-2004-07-0005/3.0
grant of the Hungarian National Office for
Research and Technology
2(No Transcript)
3- This page was intentionally left blank.
- That is, my presentation will have an approach
that is slightly unusual in this community.
4Motivation
- Software is not as it used to be.
- Traditional methodologies are aimed at a single,
monolithic program with well-defined and
controllable input streams. - Todays software is almost always situated in a
dynamic environments. - Computers are networked, but even on a single
computer, many programs are running
simultaneously. - The software designer/engineer can no longer
enumerate or control the state(s) of the
environment. - More importantly, the expected behavior of the
software is most often not independent of the
non-controlled components. - For example, the success of an autonomous agent
negotiating a deal on an auction site clearly
depends on the performance of other similar
agents, programmed by unknown parties. - We need methods, techniques and tools for
engineering emergent complex (software) systems.
5Outline
- Agent-Based Social Simulation
- FABLES (Functional Agent-Based LanguagE for
Simulation) - Goals, Concepts, Examples
- Context MASS (Multi-Agent Simulation Suite)
- ABM and participatory simulation
- Demo prototype
6Agent-based social simulation (ABSS)
- Scientific investigation of complex social
systems, where - many individuals (agents) interact,
- each pursuing its own agenda.
- Seeks to explain global phenomena from (often
relatively simple) local (individual-level)
behavior. - The practice of agent-based social simulation
requires - both programming skills and
- social science education.
- Often carried out by collaborating teams of
- social scientists and
- software engineers.
7Agent-Based Modeling and Simulation I.
- Computational models to create artificial
societies to study emergent social phenomena. - Agent-based modeling (ABM) and multi-agent
simulation (MAS) has gained popularity in many
disciplines, especially in the social sciences. - They provide a powerful and unique means to
experiment with and to understand the processes
underlying many complex phenomena in systems
involving many interacting individuals.
8Agent-Based Modeling and Simulation II.
- Agent-based models are computer programs where
agents represent the interacting individuals of
the system. - Agents here are independent behavioral engines
that satisfy the so-called weak notion of
agency. - However,
- they are often not pro-active.
- their behavior is typically fairly simple and
synchronized, - thus they are usually very different from
AI-agents. - The goal of ABM/social simulation is to
understand and to explain (the complex behavior
of the system given the local rules) - Therefore, the agents are usually in lack of
sophisticated knowledge representation and
communication.
9Practices of ABSSREPLICATION above everything
- Scientific experiments (tests and replicas)
- True (uncontrolled) parallelism is ruled out.
- Probabilistic models
- Pseudo RNGs
- Control over the seed
- Independent variables, Separate RNGs
- Full specification
- E.g. Standard practice of random choice among
equal maxima.
10Practices of ABSSGenerating and Handling of
Results
- Statistical nature of results
- One go is no go.
- Sensitivity Analysis and Confidence Intervals.
- Parameter Sweep
- Non-Linear Dependencies
- Tricks like Active Non-Linear Tests (ANTs)
11Practices of ABSSSeparating Model and Observer(s)
- Basic idea in science,
- but in computational practice its only been
around since Swarm (1994) - Several observers
- GUI
- Batch1
- Batch2
-
- Independence of the Observers RNGs from the
Models RNGs.
12Tools for ABM
- Swarm/MAML (1994-1998)
- RePast (2000)
- Ascape (1999-2001)
- MASON (2003-2004)
- MASS/FABLES (2005)
13FABLES Design Goals
- Source should be easily readable for readers
familiar with the basic mathematical formalism. - Should have a precise semantics and the source
should be the exact specification of the model. - The FABLES source should be as close to a
publishable model description as possible. - FABLES models should be executable.
- The model description should focus on the nature
of the model and leave implementation to the
compiler. - The language should be general enough to
accommodate possibly any agent-based model, but
should focus on the common techniques and methods.
14FABLES Solutions
- Separation of the observer. (Integrated
Environment) - Object-Orientation for structure.
- Functional Specifications to summarize
relationships and behavior. - Imperative elements to schedule the actual
dynamics.
15FABLES Development environment in Eclipse
16FABLES example Random walk
- model randomwalk
- agentNum 100
- class Agent begin
- pos // is Integer x Integer
- schedule step cyclic 1
- 2 pos pos discreteUniform( -1..1,
-1..1 ) -
- end
- schedule init
- 0 seed(0)
- 0 displayload("user.Display3",-20,20,-20,20)
- 1 new Agent pos0,0 i is
1..agentNum -
- //////////////////////////////// OBSERVER
//////////////////////////////////////
17FABLES example Mousetraps
- model Mousetrap
- worldSize 10 // Model parameter
- // Shorthand for the space
- world 1..worldSize, 1..worldSize
- mousetrapsFired // Counter
- // The agents
- class Mousetrap begin
- pos // is Integer x Integer
- hasFired // is Boolean
- activate (hasFired false) gt
- mousetrapsFired mousetrapsFired
1, - printLn("Activated"),
- hasFired true,
- generateTriggers
-
- otherwise gt
- // Main schedule
- schedule mainSchedule
- 2 discreteUniform(Mousetrap).activate
-
- generateTriggers addEvent( mainSchedule, 1,
triggers ) - triggers a.activate a is
Mousetrap, b is RndPositions when - a.pos(1)b(1) and
a.pos(2)b(2) -
- where (
- RndPositions discreteUniform(world) a is
1..2 - )
- //////////////////////// OBSERVER
/////////////////////////// - graph // variable to store the graph object
- schedule observer cyclic 1
18FABLES example Schellings Segregation
- model Schelling
- // Model parameters
- worldSize 10
- agentNum 70
- threshold 0.6
- // Constants
- red 1
- blue 2
- color red, blue
- // Spatial Constructs
- world 1..worldSize, 1..worldSize // The
world - occupied a.pos a is Resident // Occupied
positions - empty setMinus(world, occupied) // Empty
positions - // Helper function to implement a thorus
- norm(x) alt1 gt aworldSize
- // The agents
- class Resident begin
- pos // is world
- c // is color
- t // is 0.0..1.0
- neighbors a is Resident when a.pos
in neighborous(pos(1),pos(2)) - sameNeighbors a is neighbors when a.c c
- utility try( size(sameNeighbors)/size(neighbor
s), 1.0 ) - closestEmpty empty(minPlace(d(pos, loc)
loc is empty)) - schedule Step cyclic 1
- 2 pos ( utility gt t gt pos
- otherwise gt closestEmpty )
-
- end
- ////////////////////////// OBSERVER
/////////////////////////// - display // Variable for the display object
19FABLES example Conways Life
- model Life
- worldSize30
- world
- norm(x) a lt 1 gt aworldSize
- otherwise a where ( a x mod worldSize
) - neighbours(x,y) size ( 1 dx is -1..1,
- dy is -1..1
- when not
(dxdy0) and - world(norm(xdx))(no
rm(ydy)) - )
- step(n,old) n3 or (old and n2)
- newWorld
-
- step( neighbours(x,y), world(x)(y)
) y is 1..worldSize
- schedule Step cyclic 1
- 3 world newWorld
-
- ////////////////////////// OBSERVER
/////////////////////////// - display
- schedule Observer cyclic 1
- 2 display( (x-1,y-1,1) x is
1..worldSize, y is 1..worldSize - when world(x)(y) )
-
- end
20Summary
- Overview of Agent-Based Modeling Simulation
- As a means to engineer emergent phenomena in
complex software systems. - Easy to use formalism for ABM
- Report on an ongoing project.
- Context Multi-Agent Simulation Suite
- Web-enabled simulation environment for
participatory simulation. - Safely configurable simulations for educational
use.
21Thank you!
- Comments are welcome at
- lgulyas_at_aitia.ai