Actors for Behavioural Simulation
Tony Clark
Sheffield Hallam University, UK
t.clark@shu.ac.uk
Work in collaboration with:
Vinay Kulkarni, Souvik Barat
Tata Consultancy Services Research, India
vinay.vkulkarni@tcs.com, souvik.barat@tcs.com
Balbir Barn, Middlesex University, UK
b.barn@mdx.ac.uk
March 9, 2017
System Models
Goals g : (M1, . . . , Mk) → {true, false}
Example: Profit is increasing.
System Models
Goals g : (M1, . . . , Mk) → {true, false}
Example: Profit is increasing.
Goals can be decomposed: g1 & g2 ⇒ g
Example: Decreasing costs and increasing sales produce
increasing profit.
System Models
Goals g : (M1, . . . , Mk) → {true, false}
Example: Profit is increasing.
Goals can be decomposed: g1 & g2 ⇒ g
Example: Decreasing costs and increasing sales produce
increasing profit.
Measures m : ([V1], . . . , [Vn]) → M
Example: Profit is calculated in terms of costs and sales over
time.
System Models
Goals g : (M1, . . . , Mk) → {true, false}
Example: Profit is increasing.
Goals can be decomposed: g1 & g2 ⇒ g
Example: Decreasing costs and increasing sales produce
increasing profit.
Measures m : ([V1], . . . , [Vn]) → M
Example: Profit is calculated in terms of costs and sales over
time.
Properties p : N → V
Example: Costs at a given time.
System Models
Goals g : (M1, . . . , Mk) → {true, false}
Example: Profit is increasing.
Goals can be decomposed: g1 & g2 ⇒ g
Example: Decreasing costs and increasing sales produce
increasing profit.
Measures m : ([V1], . . . , [Vn]) → M
Example: Profit is calculated in terms of costs and sales over
time.
Properties p : N → V
Example: Costs at a given time.
System structures: ({g1, . . .}, {m1, . . .}, {p1 . . .})
Problem: How to construct these structures?
Simulations and Decision Support
System Dynamics
https://commons.wikimedia.org/w/index.php?curid=7240226(Patrhoue)
Incremental Decision Making: A Requirement for Search
Carnegie: Incompleteness and Sense Making
Simulation Approaches
Simulation Method
A Computational Basis for Simulation
ESL Architecture
The ESL Language: Factorial
type Customer = Act { Value( I n t ) };
type Fact = Act{ Get( Int ,Customer) };
act fact::Fact {
Get(0,c::Customer) → c ← Value (1);
Get(n:: Int ,c::Customer) →
l e t cc::Customer = new cust(n,c)
i n s e l f ← Get(n-1,cc)
}
act cust(n:: Int ,c::Customer)::Customer {
Value(m:: I n t ) c ← Value(n*m)
}
act main::Customer {
f::Fact = new fact;
computeFact(n:: I n t )::Void = f ← Get(n, s e l f );
→ {
computeFact (6);
computeFact (6);
computeFact (6)
}
Value(n:: I n t ) → print[ I n t ](n)
}
Visualization
The ESL Language: Dining Philosophers
eat ()::Void = f o r x:: I n t i n 0.. random(eatTime) do {}
think ()::Void = f o r x:: I n t i n 0.. random(thinkTime) do {}
act philosopher(i:: Int ,left ,right::Chopstick)::Philosopher {
Time(n:: I n t ) when n < timeLimit → {
think ();
grab (left.active ,right.active) {
eat ()
}
}
}
act chop::Chopstick {
export active;
active::Bool = false
}
chops::[Chopstick] = [ new chop | i:: I n t ← 0..(max -1) ];
philosophers::[Philosopher ] =
[ new philosopher(i,nth(chops ,i),nth(chops ,(i+1)%max)) |
i:: I n t ← 0..(max -1) ];
act main::Main {
Time(n:: I n t ) when n > timeLimit → {
edb ← Filmstrip(’Philosophers ’, getFilmstrip ());
stopAll ()
}
}
Philosopher Histories
Traffic and Adaptive Behaviour
Nils Bulling, Mehdi Dastani, and Max Knobbout. Monitoring Norm
Violations in Multi-Agent Systems. International Foundation for
Autonomous Agents and Multiagent Systems, 2013.
The ESL Language: Traffic Monitors
act light(colour:: Str )::TrafficLight {
export colour , change;
change ()::Void =
case colour {
’RED ’ → colour := ’GREEN ’;
’GREEN ’ → colour := ’RED ’
}
}
act approach(id:: Str ,light::TrafficLight ,isCar:: I n t )::Approach {
cars:: I n t = 0;
Move →
i f light.colour=’GREEN ’ and cars >0 then s e l f ← DeQueue;
DeQueue →
cars := cars - 1;
Queue →
cars := cars + 1
Time(n:: I n t ) →
probably (isCar) s e l f ← Queue e l s e s e l f ← Move
};
l1::TrafficLight = new light(’RED ’);
l2::TrafficLight = new light(’GREEN ’);
left::Approach = new approach(’left ’,l1 ,10);
right::Approach = new approach(’right ’,l2 ,20);
westEast ()= i f l2.colour=’RED ’ then {l2.change ();l1.change ()}
eastWest ()= i f l1.colour=’RED ’ then {l1.change ();l2.change ()}
Traffic Filmstrip
Prioritise East West
Traffic Filmstrip
West East If Nothing Waiting
Traffic Filmstrip
West East Must Not Build Up
Traffic Filmstrip
Back to Equilibrium
Monitor Actors
Monitor Actors
Monitor Actors
Monitor Actors
Monitor Language
p,q ::= monitors.
n a named monitor.
| holds for any history.
| (p) holds when p holds at all times.
| µ(λ(n)p) recursive definitions: [µ(λ(n)p)/n]p
| p;q holds when p and q both hold now.
| p|q holds when p or q (or both) holds now.
| p ⊕ q holds when p or q (not both) holds now.
| p ⇒ q if p holds then q must hold now.
| N(p) holds when p holds for time now + 1.
| P(p) holds when p holds for time now - 1.
| ?(c) holds when the condition c is true now.
| ! (a) always holds and performs action a.
| p ↑ q splits two merged histories.
| p ↓ q (re)merges two split histories.
Actors controlled by monitor rules: p ⇒ !(a)
Tony Clark, Vinay Kulkarni, Souvik Barat, Balbir Barn. Actor Monitors
for Adaptive Behaviour. ISEC 2017. pp. 85--95
Traffic Monitor
1P0(p) = p
2Pn(p) = p;P(Pn-1(p))
3
4(PmaxQDuration (?(gre(maxQSize))) ↑ ⇒ ! (westEast) ⊕
5
6↑ ?(gre (0)) ⇒ ! (eastWest) ⊕
7
8?(gre (0)) ↑ ⇒ ! (westEast) ⊕
9
10)
ESL Monitor Types
type Mtd[T] = Act {
export history::[T];
Time( Int )
}
data Tree[T] = Leaf(T) | Pair(Tree[T],Tree[T])
data MTree[T] = Tree(Mtd[T])
history[T](t::MTree[T])::Tree [[T]] =
case t {
Leaf(a::Mtd[T]) → Leaf(a.history);
Pair(left::MTree[T],right::MTree[T]) →
Pair(history[T]( left),history[T]( right))
}
type Fail = () → Void
type Mtr[T] = rec M. Act {
Check(Mtd[T], Int ,M,Fail);
Time( Int )
}
ESL Monitor Definitions
act [T]::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
s ← Check(a,c, s e l f ,f)
}
idle[T]::Mtr[T] = new nothing[T]()
ESL Monitor Definitions
act ! [T]( command ::() → Void)::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
{
command ();
s ← Check(a,c,idle[T],f)
}
}
ESL Monitor Definitions
act (_;_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
p ← Check(a,c,new (q;s),f)
}
act (_⊕_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
p ← Check(a,c,s,λ()::Void q ← Check(a,c,s,f))
}
act (_|_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → {
p ← Check(a,c,s,f);
q ← Check(a,c,s,f)
}
}
ESL Monitor Definitions
minLength[T](t::Tree[T]):: Int =
case t {
Leaf(l::[T]) → length[T](l);
Pair(left::Tree[T],right::Tree[T]) →
min(minLength[T]( left),minLength[T]( right))
}
treeNth[T](t::Tree[T],n:: Int )::Tree[T] =
case t {
Leaf(l::[T]) → nth[T](l,n);
Pair(left::Tree[T],right::Tree[T]) →
Pair(treeNth[T](left ,n),treeNth[T](right ,n))
}
act ?[T]( pred::(Tree[T]) → Bool)::Mtr[T] {
Check(t::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
i f minLength[T]( history(t)) > c
then {
i f pred(treeNth[T]( history(t),c))
then s ← Check(t,c,idle[T],f)
e l s e f()
} e l s e s e l f ← Check(t,c,s,f)
}
ESL Monitor Definitions
act µ[T](g::(Mtr[T]) → Mtr[T])::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
g(new rec [T](g)) ← Check(a,c,s,f)
}
[T](p::Mtr[T])::Mtr[T] =
new µ[T](λ(q::Mtr[T])::Mtr[T]
new seq[T](p,new N[T](q)))
act N[T](p::Mtr[T])::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
p ← Check(a,c+1,s,f)
}
act P[T](p::Mtr[T])::Mtr[T] {
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
p ← Check(a,c-1,s,f)
}
act (_ ⇒ _)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] =
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
p ← Check(a,c,new (q;s),λ()::Void s ← Check(a,c,
idle[T],f)
}
ESL Monitor Definitions
act (_↑_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] {
Check(t::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
case t {
Pair[T](t1::MTree[T],t2::MTree[T]) →
l e t j::Mtr[T] = new (t1 ↓ t2)
in {
p ← Check(t1 ,c,j,f);
q ← Check(t2 ,c,j,f)
}
}
}
act (_↓_)[T](t1::MTree[T],t2::MTree[T])::Mtr[T]{
done::Bool = false
Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) →
i f not(done)
then done := true
e l s e s ← Check(Pair(t1 ,t2),c,s,f)
}
Traffic Sequence Diagram
Shopping Simulation
Peer-Olaf Siebers and Uwe Aickelin. A first approach on modelling staff
proactiveness in retail simulation models. J. Artificial Societies and
Social Simulation, 14(2), 2011.
Actor Structure Models: Shop Simulation
Actor Behaviour Models: Customer
Visualisation of Results
Simulation execution produces a history.
History Query Language
rule ::= fact ← element , . . .
element ::=
fact
| actor (id ,behaviour ,time)
| send(source ,target ,message ,time)
| state (id ,name ,value ,time)
| next [element]
| prev [element]
| always [element]
| e v e n t u a l l y [element]
| past [element]
| s t a r t
| end
| f o r a l l [element ](value ,value)
Query Language: Typed Relational Programming
append[T] :: ([T],[T],[T]);
append[T]([],l,l) ← !;
append[T]([x|l1],l2 ,[x|l3]) ←
append[T](l1 ,l2 ,l3);
length[T] :: ([T], Int );
length[T]([] ,0);
length[T]([_ | l],n) ←
length[T](l,m),
n := m + 1;
Query Language: Processing Histories
allActors :: ([ Actor( Int , Str )]);
allActors ([]) ← end , !;
allActors(actors) ←
f o r a l l [ actor (id ,beh ,_)]( Actor(id ,beh),actors ’),
next [allActors(actors ’’)],
append[Actor( Int , Str )](actors ’,actors ’’,actors);
customers :: ([ Int ]);
customers(cs) ←
f o r a l l [ e v e n t u a l l y [ actor (a,’customer ’,_)]](a,cs);
Query Language: Customers With No Sales
noSales :: ([ Int ]);
noSales(cs ’’) ←
customers(cs),
makesPurchase(cs ,cs ’),
removeAll[ Int ](cs ’,cs ,cs ’’);
makesPurchase :: ([ Int ],[ Int ]);
makesPurchase ([] ,[]);
makesPurchase ([c | cs],[c | cs ’]) ←
makePurchase(c), !,
makesPurchase(cs ,cs ’);
makesPurchase ([_ | cs],cs ’) ←
makesPurchase(cs ,cs ’);
makePurchase :: ( Int );
makePurchase(c) ←
e v e n t u a l l y [send(_,c,SaleConcluded ,_)];
Query Language: Detecting Raids
raid :: ([ Int ], union { NoRaid (), Raid ([ Int ])});
raid(assistants ,Raid(times ’)) ←
f o r a l l [ // get the assistant actors . . .
e v e n t u a l l y [ actor (a,’assistant ’,_)]
](a,assistants),
f o r a l l [ // times when they are all occupied . . .
e v e n t u a l l y [allHelping(assistants ,time)]
](time ,times), !;
raid ([], NoRaid);
allHelping ::([ Int ],[ Int ]);
allHelping ([],_);
allHelping ([a|as],t) ←
state (a,’advising ’,Ref(_),t),
allHelping(as ,_);
Selected Publications
Tony Clark, Vinay Kulkarni, Souvik Barat, Balbir Barn: Actor Monitors for Adaptive
Behaviour. Proceedings of the 10th Innovations in Software Engineering Conference, ISEC
2017: 85-95
Souvik Barat, Vinay Kulkarni, Tony Clark, and Balbir Barn. A Simulation-based Aid for
Organisational Decision-making.In Proceedings of the 11th International Joint Conference
on Software Technologies. 2016.
Souvik Barat, Vinay Kulkarni, Tony Clark, Balbir Barn: Enterprise Modeling as a Decision
Making Aid: A Systematic Mapping Study. PoEM 2016: 289-298
Vinay Kulkarni, Souvik Barat, Tony Clark, and Balbir Barn. Toward overcoming accidental
complexity in organisational decision-making. In Model Driven Engineering Languages and
Systems (MODELS), 2015 ACM/IEEE 18th International Conference on, pages 368-377. IEEE,
2015.
Vinay Kulkarni, Souvik Barat, Tony Clark, Balbir Barn: A Wide-Spectrum Approach to
Modelling and Analysis of Organisation for Machine-Assisted Decision-Making. EOMAS@CAiSE
2015: 87-101
Vinay Kulkarni, Souvik Barat, Tony Clark, Balbir Barn: Using simulation to address
intrinsic complexity in multi-modelling of enterprises for decision making. SummerSim
2015: 9:1-9:11
Balbir Barn, Tony Clark, and Vinay Kulkarni. Can organisational theory and multi-agent
systems influence next generation enterprise modelling? In International Conference on
Software Technologies, pages 202-216. Springer, 2014.
Vinay Kulkarni, Tony Clark, Souvik Barat, Balbir Barn: Model Based Enterprise Simulation
and Analysis - A Pragmatic Approach Reducing the Burden on Experts. ER Workshops 2014:
3-12
Get Involved
http://tonyclark.github.io/ESL/

Actors for Behavioural Simulation

  • 1.
    Actors for BehaviouralSimulation Tony Clark Sheffield Hallam University, UK t.clark@shu.ac.uk Work in collaboration with: Vinay Kulkarni, Souvik Barat Tata Consultancy Services Research, India vinay.vkulkarni@tcs.com, souvik.barat@tcs.com Balbir Barn, Middlesex University, UK b.barn@mdx.ac.uk March 9, 2017
  • 2.
    System Models Goals g: (M1, . . . , Mk) → {true, false} Example: Profit is increasing.
  • 3.
    System Models Goals g: (M1, . . . , Mk) → {true, false} Example: Profit is increasing. Goals can be decomposed: g1 & g2 ⇒ g Example: Decreasing costs and increasing sales produce increasing profit.
  • 4.
    System Models Goals g: (M1, . . . , Mk) → {true, false} Example: Profit is increasing. Goals can be decomposed: g1 & g2 ⇒ g Example: Decreasing costs and increasing sales produce increasing profit. Measures m : ([V1], . . . , [Vn]) → M Example: Profit is calculated in terms of costs and sales over time.
  • 5.
    System Models Goals g: (M1, . . . , Mk) → {true, false} Example: Profit is increasing. Goals can be decomposed: g1 & g2 ⇒ g Example: Decreasing costs and increasing sales produce increasing profit. Measures m : ([V1], . . . , [Vn]) → M Example: Profit is calculated in terms of costs and sales over time. Properties p : N → V Example: Costs at a given time.
  • 6.
    System Models Goals g: (M1, . . . , Mk) → {true, false} Example: Profit is increasing. Goals can be decomposed: g1 & g2 ⇒ g Example: Decreasing costs and increasing sales produce increasing profit. Measures m : ([V1], . . . , [Vn]) → M Example: Profit is calculated in terms of costs and sales over time. Properties p : N → V Example: Costs at a given time. System structures: ({g1, . . .}, {m1, . . .}, {p1 . . .}) Problem: How to construct these structures?
  • 7.
  • 8.
  • 9.
    Incremental Decision Making:A Requirement for Search
  • 10.
  • 11.
  • 12.
  • 13.
    A Computational Basisfor Simulation
  • 14.
  • 15.
    The ESL Language:Factorial type Customer = Act { Value( I n t ) }; type Fact = Act{ Get( Int ,Customer) }; act fact::Fact { Get(0,c::Customer) → c ← Value (1); Get(n:: Int ,c::Customer) → l e t cc::Customer = new cust(n,c) i n s e l f ← Get(n-1,cc) } act cust(n:: Int ,c::Customer)::Customer { Value(m:: I n t ) c ← Value(n*m) } act main::Customer { f::Fact = new fact; computeFact(n:: I n t )::Void = f ← Get(n, s e l f ); → { computeFact (6); computeFact (6); computeFact (6) } Value(n:: I n t ) → print[ I n t ](n) }
  • 16.
  • 17.
    The ESL Language:Dining Philosophers eat ()::Void = f o r x:: I n t i n 0.. random(eatTime) do {} think ()::Void = f o r x:: I n t i n 0.. random(thinkTime) do {} act philosopher(i:: Int ,left ,right::Chopstick)::Philosopher { Time(n:: I n t ) when n < timeLimit → { think (); grab (left.active ,right.active) { eat () } } } act chop::Chopstick { export active; active::Bool = false } chops::[Chopstick] = [ new chop | i:: I n t ← 0..(max -1) ]; philosophers::[Philosopher ] = [ new philosopher(i,nth(chops ,i),nth(chops ,(i+1)%max)) | i:: I n t ← 0..(max -1) ]; act main::Main { Time(n:: I n t ) when n > timeLimit → { edb ← Filmstrip(’Philosophers ’, getFilmstrip ()); stopAll () } }
  • 18.
  • 19.
    Traffic and AdaptiveBehaviour Nils Bulling, Mehdi Dastani, and Max Knobbout. Monitoring Norm Violations in Multi-Agent Systems. International Foundation for Autonomous Agents and Multiagent Systems, 2013.
  • 20.
    The ESL Language:Traffic Monitors act light(colour:: Str )::TrafficLight { export colour , change; change ()::Void = case colour { ’RED ’ → colour := ’GREEN ’; ’GREEN ’ → colour := ’RED ’ } } act approach(id:: Str ,light::TrafficLight ,isCar:: I n t )::Approach { cars:: I n t = 0; Move → i f light.colour=’GREEN ’ and cars >0 then s e l f ← DeQueue; DeQueue → cars := cars - 1; Queue → cars := cars + 1 Time(n:: I n t ) → probably (isCar) s e l f ← Queue e l s e s e l f ← Move }; l1::TrafficLight = new light(’RED ’); l2::TrafficLight = new light(’GREEN ’); left::Approach = new approach(’left ’,l1 ,10); right::Approach = new approach(’right ’,l2 ,20); westEast ()= i f l2.colour=’RED ’ then {l2.change ();l1.change ()} eastWest ()= i f l1.colour=’RED ’ then {l1.change ();l2.change ()}
  • 21.
  • 22.
    Traffic Filmstrip West EastIf Nothing Waiting
  • 23.
    Traffic Filmstrip West EastMust Not Build Up
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
    Monitor Language p,q ::=monitors. n a named monitor. | holds for any history. | (p) holds when p holds at all times. | µ(λ(n)p) recursive definitions: [µ(λ(n)p)/n]p | p;q holds when p and q both hold now. | p|q holds when p or q (or both) holds now. | p ⊕ q holds when p or q (not both) holds now. | p ⇒ q if p holds then q must hold now. | N(p) holds when p holds for time now + 1. | P(p) holds when p holds for time now - 1. | ?(c) holds when the condition c is true now. | ! (a) always holds and performs action a. | p ↑ q splits two merged histories. | p ↓ q (re)merges two split histories. Actors controlled by monitor rules: p ⇒ !(a) Tony Clark, Vinay Kulkarni, Souvik Barat, Balbir Barn. Actor Monitors for Adaptive Behaviour. ISEC 2017. pp. 85--95
  • 30.
    Traffic Monitor 1P0(p) =p 2Pn(p) = p;P(Pn-1(p)) 3 4(PmaxQDuration (?(gre(maxQSize))) ↑ ⇒ ! (westEast) ⊕ 5 6↑ ?(gre (0)) ⇒ ! (eastWest) ⊕ 7 8?(gre (0)) ↑ ⇒ ! (westEast) ⊕ 9 10)
  • 31.
    ESL Monitor Types typeMtd[T] = Act { export history::[T]; Time( Int ) } data Tree[T] = Leaf(T) | Pair(Tree[T],Tree[T]) data MTree[T] = Tree(Mtd[T]) history[T](t::MTree[T])::Tree [[T]] = case t { Leaf(a::Mtd[T]) → Leaf(a.history); Pair(left::MTree[T],right::MTree[T]) → Pair(history[T]( left),history[T]( right)) } type Fail = () → Void type Mtr[T] = rec M. Act { Check(Mtd[T], Int ,M,Fail); Time( Int ) }
  • 32.
    ESL Monitor Definitions act[T]::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → s ← Check(a,c, s e l f ,f) } idle[T]::Mtr[T] = new nothing[T]()
  • 33.
    ESL Monitor Definitions act! [T]( command ::() → Void)::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → { command (); s ← Check(a,c,idle[T],f) } }
  • 34.
    ESL Monitor Definitions act(_;_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → p ← Check(a,c,new (q;s),f) } act (_⊕_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → p ← Check(a,c,s,λ()::Void q ← Check(a,c,s,f)) } act (_|_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → { p ← Check(a,c,s,f); q ← Check(a,c,s,f) } }
  • 35.
    ESL Monitor Definitions minLength[T](t::Tree[T])::Int = case t { Leaf(l::[T]) → length[T](l); Pair(left::Tree[T],right::Tree[T]) → min(minLength[T]( left),minLength[T]( right)) } treeNth[T](t::Tree[T],n:: Int )::Tree[T] = case t { Leaf(l::[T]) → nth[T](l,n); Pair(left::Tree[T],right::Tree[T]) → Pair(treeNth[T](left ,n),treeNth[T](right ,n)) } act ?[T]( pred::(Tree[T]) → Bool)::Mtr[T] { Check(t::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → i f minLength[T]( history(t)) > c then { i f pred(treeNth[T]( history(t),c)) then s ← Check(t,c,idle[T],f) e l s e f() } e l s e s e l f ← Check(t,c,s,f) }
  • 36.
    ESL Monitor Definitions actµ[T](g::(Mtr[T]) → Mtr[T])::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → g(new rec [T](g)) ← Check(a,c,s,f) } [T](p::Mtr[T])::Mtr[T] = new µ[T](λ(q::Mtr[T])::Mtr[T] new seq[T](p,new N[T](q))) act N[T](p::Mtr[T])::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → p ← Check(a,c+1,s,f) } act P[T](p::Mtr[T])::Mtr[T] { Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → p ← Check(a,c-1,s,f) } act (_ ⇒ _)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] = Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → p ← Check(a,c,new (q;s),λ()::Void s ← Check(a,c, idle[T],f) }
  • 37.
    ESL Monitor Definitions act(_↑_)[T](p::Mtr[T],q::Mtr[T])::Mtr[T] { Check(t::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → case t { Pair[T](t1::MTree[T],t2::MTree[T]) → l e t j::Mtr[T] = new (t1 ↓ t2) in { p ← Check(t1 ,c,j,f); q ← Check(t2 ,c,j,f) } } } act (_↓_)[T](t1::MTree[T],t2::MTree[T])::Mtr[T]{ done::Bool = false Check(a::MTree[T],c:: Int ,s::Mtr[T],f::Fail) → i f not(done) then done := true e l s e s ← Check(Pair(t1 ,t2),c,s,f) }
  • 38.
  • 39.
    Shopping Simulation Peer-Olaf Siebersand Uwe Aickelin. A first approach on modelling staff proactiveness in retail simulation models. J. Artificial Societies and Social Simulation, 14(2), 2011.
  • 40.
    Actor Structure Models:Shop Simulation
  • 41.
  • 42.
    Visualisation of Results Simulationexecution produces a history.
  • 43.
    History Query Language rule::= fact ← element , . . . element ::= fact | actor (id ,behaviour ,time) | send(source ,target ,message ,time) | state (id ,name ,value ,time) | next [element] | prev [element] | always [element] | e v e n t u a l l y [element] | past [element] | s t a r t | end | f o r a l l [element ](value ,value)
  • 44.
    Query Language: TypedRelational Programming append[T] :: ([T],[T],[T]); append[T]([],l,l) ← !; append[T]([x|l1],l2 ,[x|l3]) ← append[T](l1 ,l2 ,l3); length[T] :: ([T], Int ); length[T]([] ,0); length[T]([_ | l],n) ← length[T](l,m), n := m + 1;
  • 45.
    Query Language: ProcessingHistories allActors :: ([ Actor( Int , Str )]); allActors ([]) ← end , !; allActors(actors) ← f o r a l l [ actor (id ,beh ,_)]( Actor(id ,beh),actors ’), next [allActors(actors ’’)], append[Actor( Int , Str )](actors ’,actors ’’,actors); customers :: ([ Int ]); customers(cs) ← f o r a l l [ e v e n t u a l l y [ actor (a,’customer ’,_)]](a,cs);
  • 46.
    Query Language: CustomersWith No Sales noSales :: ([ Int ]); noSales(cs ’’) ← customers(cs), makesPurchase(cs ,cs ’), removeAll[ Int ](cs ’,cs ,cs ’’); makesPurchase :: ([ Int ],[ Int ]); makesPurchase ([] ,[]); makesPurchase ([c | cs],[c | cs ’]) ← makePurchase(c), !, makesPurchase(cs ,cs ’); makesPurchase ([_ | cs],cs ’) ← makesPurchase(cs ,cs ’); makePurchase :: ( Int ); makePurchase(c) ← e v e n t u a l l y [send(_,c,SaleConcluded ,_)];
  • 47.
    Query Language: DetectingRaids raid :: ([ Int ], union { NoRaid (), Raid ([ Int ])}); raid(assistants ,Raid(times ’)) ← f o r a l l [ // get the assistant actors . . . e v e n t u a l l y [ actor (a,’assistant ’,_)] ](a,assistants), f o r a l l [ // times when they are all occupied . . . e v e n t u a l l y [allHelping(assistants ,time)] ](time ,times), !; raid ([], NoRaid); allHelping ::([ Int ],[ Int ]); allHelping ([],_); allHelping ([a|as],t) ← state (a,’advising ’,Ref(_),t), allHelping(as ,_);
  • 63.
    Selected Publications Tony Clark,Vinay Kulkarni, Souvik Barat, Balbir Barn: Actor Monitors for Adaptive Behaviour. Proceedings of the 10th Innovations in Software Engineering Conference, ISEC 2017: 85-95 Souvik Barat, Vinay Kulkarni, Tony Clark, and Balbir Barn. A Simulation-based Aid for Organisational Decision-making.In Proceedings of the 11th International Joint Conference on Software Technologies. 2016. Souvik Barat, Vinay Kulkarni, Tony Clark, Balbir Barn: Enterprise Modeling as a Decision Making Aid: A Systematic Mapping Study. PoEM 2016: 289-298 Vinay Kulkarni, Souvik Barat, Tony Clark, and Balbir Barn. Toward overcoming accidental complexity in organisational decision-making. In Model Driven Engineering Languages and Systems (MODELS), 2015 ACM/IEEE 18th International Conference on, pages 368-377. IEEE, 2015. Vinay Kulkarni, Souvik Barat, Tony Clark, Balbir Barn: A Wide-Spectrum Approach to Modelling and Analysis of Organisation for Machine-Assisted Decision-Making. EOMAS@CAiSE 2015: 87-101 Vinay Kulkarni, Souvik Barat, Tony Clark, Balbir Barn: Using simulation to address intrinsic complexity in multi-modelling of enterprises for decision making. SummerSim 2015: 9:1-9:11 Balbir Barn, Tony Clark, and Vinay Kulkarni. Can organisational theory and multi-agent systems influence next generation enterprise modelling? In International Conference on Software Technologies, pages 202-216. Springer, 2014. Vinay Kulkarni, Tony Clark, Souvik Barat, Balbir Barn: Model Based Enterprise Simulation and Analysis - A Pragmatic Approach Reducing the Burden on Experts. ER Workshops 2014: 3-12
  • 64.