![Page 1: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/1.jpg)
1
SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS
Emerson Chan Simbolon0806334773
Fakultas Ilmu Komputer
![Page 2: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/2.jpg)
2
Table of Contents
• Introduction• Related Works• Frameworks• Foundation Theory– Behavior Tree– ABS– Translation Scheme
• Experiment• Result and analysis• Conclusion and Future Works
![Page 3: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/3.jpg)
3
Aaaa BbbBb Ccccc
Ddddd
Programmer
Aaaa BbBBb CcDdBCd
Consistency?Ambiguity?Correctness?
Background
AA Bb CDd E
What client need What client describe
What programmer code
![Page 4: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/4.jpg)
Aaaa BbbBb Ccccc
Ddddd SOFTWARE METHODOLOGIES
Programmer
Aaaa BbbBb CcccCDdddd
Consistency?Ambiguity?Correctness?
Background (cont)
AA Bb CDd E
What client need What client describe
What programmer code4
![Page 5: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/5.jpg)
5
Aaaa BbbBb Ccccc
Ddddd BEHAVIOR TREE
Programmer
AA Bb CDd E
Consistency?Ambiguity?Correctness?
Background (cont)
AA Bb CDd E
What client need What client describe
What programmer code
![Page 6: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/6.jpg)
6
Motivation
• From design to code• UML ? (e.g. http
://www.altova.com/umodel/uml-code-generation.html)
• BT -> Model Checked
![Page 7: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/7.jpg)
7
Related Works
• Formal Method Lab research– SAL Model Checker – Animation of BT Simulation
• Behavior Tree for Next AI Design
![Page 8: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/8.jpg)
8
Tools
• Eclipse (IDE)• TextBE (Eclipse plugin)• ABS Plugin (Eclipse plugin)
![Page 9: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/9.jpg)
9
Foundation Theory
• Behavior Tree• ABS• Translation Scheme
![Page 10: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/10.jpg)
10
Behavior Tree
![Page 11: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/11.jpg)
11
State
• C[s] -> …• A treatment of a component, so states means a
set of treatments that component could realize• Kind of State:– Enumeration {Cold, Hot, Warm}– Assignment (x:=2, t:=Hot)– Action (put what Food where (to) Oven)– Statement ([{}], in SetNotation that statement means
an empty Set), a statement needs formal representation
![Page 12: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/12.jpg)
12
Selection
• C ?condition? -> … | … | …• Reflect as “If” block in programming language• A branch will be executed if satisfied the
condition (if more than one satisfied, than it will choose one branch un-deterministically)
• If none of branch satisfied, than terminated
![Page 13: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/13.jpg)
13
Event
• C??e?? (similar with “C > e <“)• Reflects as “input” request in programming
language (approach)• Will execute sub tree below, if C meets the
event e, block if not
![Page 14: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/14.jpg)
14
Guard
• C ??? s ??? -> …• Reflect as “While” block in programming
language• A branch will be executed if component C
realize state ‘s’ • Block the sub tree below
![Page 15: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/15.jpg)
15
Parallel branch
• C-> (…|…|…)• Reflects as multi process in programming
language• Each sub tree run concurrently and un-
deterministically• Needs scheduling (or apparent on the BT
design)
![Page 16: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/16.jpg)
16
Atomic Composition
• Commonly, a node is not atomic, so process between one node to next may be executed asynchronously
• C;;D ; …• Set of State realization that should be
executed simultaneously
![Page 17: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/17.jpg)
17
Reversion
• N* ^• Reflects “Go-to” statement in programming
language, as N as the label of destination PC• Ancestor node N*, N, will be executed,
terminate sibling process
![Page 18: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/18.jpg)
18
Synchronization
• N* =• Reflects “suspend” statement in programming
language, as N as the label of destination PC, N located in sibling process
• A node in sibling process, N, will be executed, block next statement, until it awaken
• Scheduling point to prevent starvation
![Page 19: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/19.jpg)
19
Behavior Tree in TextBE
• Define all possibility state and event • Define tree structure
#RT R1 R1 #C C1 DOOR #S 1 Closed #C C2 USER #E 1 Push #R What C3 #C C3 BUTTON #S 1 Pushed #C C4 POWER-TUBE #S 1 Energised #C C5 OVEN #S 1 Cooking[OneMinute] #T R1 C1 1; R1 C2 1; R1 C3 1; R1 C4 1; R1 C5 1
![Page 20: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/20.jpg)
20
Bounded-Buffer Problem
1. Given one buffer with size N, one producer, one consumer2. Producer put data to buffer until M times3. Consumer take data from buffer until M times4. Producer put data as long as buffer not full5. Consumer take data as long as buffer not empty
![Page 21: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/21.jpg)
21
BT Representation
• Shown
![Page 22: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/22.jpg)
22
ABS
![Page 23: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/23.jpg)
23
What is ABS?
• Stands for Abstract Behavioral Specication• Developed by HATS (http://www.hats-
project.eu) in 2009
![Page 24: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/24.jpg)
24
ABS as Modeling Language
• Compatible with UML• Formal & Executable• Not only modeling implementation of features,
but also feature space and dependencies among them
• Have language concepts to represent model evolution due to changing requirements
• Used to fill the gap between structural modeling language and implementation-close formalisms
![Page 25: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/25.jpg)
25
What make ABS powerful?
• Have 5 language-concepts that supports it to fit the needs of modeling large complex system
![Page 26: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/26.jpg)
26
Core ABS
• Object-based modeling language• Not support code reuse via class-based inheritance
(it’s supported by those other four languages)• Support user-defined data type with (non-higher-
order) functions and pattern matching• Contains non-deterministic constructs, which is not
executable (like modeling oven or train schedule) with its outcome is set of possible successor states from which one can be picked in simulation and visualization
![Page 27: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/27.jpg)
27
ABS Specification
• Data types• Object Based Programming• Concurrency model
![Page 28: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/28.jpg)
28
Built-in Data Types
• Unit value, Unit• Logical values, equality (==), unequality (!=),
negation (~), logical and (&&), and logical or (||)
• Numbers, ((-5+6)*4)/(2%1)• Character Sequences, "Hello" + "World“
![Page 29: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/29.jpg)
29
Algebraic Data Types
Syntax:DataTypeDecl ::= data TypeId [TypeParams] [= DataConstrList] ;TypeParams ::= < TypeId (, TypeId) >DataConstrList ::= DataConstr (| DataConstr)DataConstr ::= TypeId [( [TypeList] )]
Ex:data Fruit = Apple | Banana | Cherry;data Juice = Pure(Fruit) | Mixed(Juice, Juice);Mixed(Pure(Cherry),Pure(Banana))
![Page 30: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/30.jpg)
30
• Parametric data type, data List<T> = Nil | Cons(T, List<T>);
• Type Synonymstype Catalog = Map<String, Product>;
• Functionsdef A head<A>(List<A> list) = ...
• Pattern Matchingdef A head<A>(List<A> list) = case list {
Cons(h, _) => h}
![Page 31: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/31.jpg)
31
Object-Based Programming
• InterfaceSyntax:InterfaceDecl ::= interface TypeId [extends TypeName (, TypeName)] { MethSig }MethSig ::= Type Identifier ( [ParamList] ) ;ParamList ::= Param (, Param)Param ::= Type IdentifierEx:interface Empty {
Unit doNothing();}
![Page 32: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/32.jpg)
32
• ClassSyntax:ClassDecl ::= class TypeId [( ParamList )] [implements TypeName (, TypeName)]{ [FieldDeclList] [Block] [MethDeclList] }FieldDeclList ::= FieldDecl (, FieldDecl)FieldDecl ::= TypeId Identifier [= PureExp] ;MethDeclList ::= MethDecl (, MethDecl)MethDecl ::= Type Identifier ( ParamList ) Block
Ex:class IEmpty implements Empty {
Unit doNothing() { skip; }Unit thisIsPrivate() { skip; }
}
![Page 33: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/33.jpg)
33
• ModuleModel in ABS, represented by .abs file
• Statement:– assignments, (xx = yy)– conditional statements, (if xx then yy, case xx)– loops (while xx),– expression (new xx),– return,– basic statement (skip, await, suspend, assert).
![Page 34: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/34.jpg)
34
Concurrency Model• Concurrency Object Groups (COG)
Pong pong = new cog IPong();
• Asynchronous Method Callspong ! hi("Hello Pong");
• FutureFut<String> answerFut = pong ! hi("Hello Pong");String answer = answerFut.get;
• Cooperative Multi-TaskingFut<String> answerFut = ping ! hi("Hello Ping");skip; // do some processing ...await answerFut?;String answer = answerFut.get; // guaranteed not to block
![Page 35: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/35.jpg)
35
What is ABS?
• Stands to Abstract Behavioral Specication• Developed by HATS (http://www.hats-
project.eu) in 2009
![Page 36: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/36.jpg)
36
ABS as Modeling Language
• Compatible with UML• Formal & Executable• Not only modeling implementation of features,
but also feature space and dependencies among them
• Have language concepts to represent model evolution due to changing requirements
• Used to fill the gap between structural modeling language and implementation-close formalisms
![Page 37: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/37.jpg)
37
What make ABS powerful?
• Have 5 language-concepts that supports it to fit the needs of modeling large complex system
![Page 38: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/38.jpg)
38
Core ABS
• Object-based modeling language• Not support code reuse via class-based inheritance
(it’s supported by those other four languages)• Support user-defined data type with (non-higher-
order) functions and pattern matching• Contains non-deterministic constructs, which is not
executable (like modeling oven or train schedule) with its outcome is set of possible successor states from which one can be picked in simulation and visualization
![Page 39: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/39.jpg)
39
ABS Specification
• Data types• Object Based Programming• Concurrency model
![Page 40: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/40.jpg)
40
Built-in Data Types
• Unit value, Unit• Logical values, equality (==), unequality (!=),
negation (~), logical and (&&), and logical or (||)
• Numbers, ((-5+6)*4)/(2%1)• Character Sequences, "Hello" + "World“
![Page 41: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/41.jpg)
41
Algebraic Data Types
Syntax:DataTypeDecl ::= data TypeId [TypeParams] [= DataConstrList] ;TypeParams ::= < TypeId (, TypeId) >DataConstrList ::= DataConstr (| DataConstr)DataConstr ::= TypeId [( [TypeList] )]
Ex:data Fruit = Apple | Banana | Cherry;data Juice = Pure(Fruit) | Mixed(Juice, Juice);Mixed(Pure(Cherry),Pure(Banana))
![Page 42: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/42.jpg)
42
• Parametric data type, data List<T> = Nil | Cons(T, List<T>);
• Type Synonymstype Catalog = Map<String, Product>;
• Functionsdef A head<A>(List<A> list) = ...
• Pattern Matchingdef A head<A>(List<A> list) = case list {
Cons(h, _) => h}
![Page 43: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/43.jpg)
43
Object-Based Programming
• InterfaceSyntax:InterfaceDecl ::= interface TypeId [extends TypeName (, TypeName)] { MethSig }MethSig ::= Type Identifier ( [ParamList] ) ;ParamList ::= Param (, Param)Param ::= Type IdentifierEx:interface Empty {
Unit doNothing();}
![Page 44: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/44.jpg)
44
• ClassSyntax:ClassDecl ::= class TypeId [( ParamList )] [implements TypeName (, TypeName)]{ [FieldDeclList] [Block] [MethDeclList] }FieldDeclList ::= FieldDecl (, FieldDecl)FieldDecl ::= TypeId Identifier [= PureExp] ;MethDeclList ::= MethDecl (, MethDecl)MethDecl ::= Type Identifier ( ParamList ) Block
Ex:class IEmpty implements Empty {
Unit doNothing() { skip; }Unit thisIsPrivate() { skip; }
}
![Page 45: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/45.jpg)
45
• ModuleModel in ABS, represented by .abs file
• Statement:– assignments, (xx = yy)– conditional statements, (if xx then yy, case xx)– loops (while xx),– expression (new xx),– return,– basic statement (skip, await, suspend, assert).
![Page 46: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/46.jpg)
46
Concurrency Model• Concurrency Object Groups (COG)
Pong pong = new cog IPong();
• Asynchronous Method Callspong ! hi("Hello Pong");
• FutureFut<String> answerFut = pong ! hi("Hello Pong");String answer = answerFut.get;
• Cooperative Multi-TaskingFut<String> answerFut = ping ! hi("Hello Ping");skip; // do some processing ...await answerFut?;String answer = answerFut.get; // guaranteed not to block
![Page 47: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/47.jpg)
47
Translation Scheme
![Page 48: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/48.jpg)
48
Motivation
• BT and ABS have different semantic, but we can make a program that can be represented by both. It means also we can create BT representation from ABS manually, and we can create ABS representation given the BT manually too. We can also automated the manual approach using translation schema. In this case we use translation scheme BT to ABS, to automate ABS generation code just by giving the BT representation.
![Page 49: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/49.jpg)
Def. Heuristic
• Approach that needs to maintain elements of BT
• Heuristic will be specified on the behavior of a node (different kind of node, different heuristic)
• Next we will called it by H
![Page 50: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/50.jpg)
#C C1 DOOR #S 1 Closed #C C3 BUTTON #S 1 Pushed #C C4 POWER-TUBE #S 1 Energised
#C C5 OVEN #S 1 Cooking[OneMinute]
data door_data = closed_val;
data button_data = pushed_val;
data power_tube_data = energised_val;
data oven_data = cooking_val(oneminute);
Note..
There is always default value for each data, so when the data not reach one state, it must reach default state… so?
Scratch 1
![Page 51: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/51.jpg)
H 1
For each component that only contains enumeration state, we create component by declaring it as “data” and all the possible state as its possible value.
![Page 52: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/52.jpg)
Result from H 1
• data Door_data = Closed_val | Door_default_val;• data Button_data = Pushed_val | Button_default_val;• data Power_tube_data = Energised_val |
Power_tube_default_val;• data Waktu = OneMinute | TwoMinute | FiveMinute |
TenMinute;• data Oven_data = Cooking_val(Waktu) | Oven_default_val;
A little adjustment has been made (Why?)
![Page 53: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/53.jpg)
H 2
• For each component that contains action will become interface, and every action will become method, all others kind of state will be implemented in its class
#C C2 USER #S 1 Push #R What C3
interface User_int{Unit push(button_data);
}
![Page 54: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/54.jpg)
Translation result, … so far
data Door_data = Closed_val | Door_default_val;data Button_data = Pushed_val | Button_default_val;data Power_tube_data = Energised_val | Power_tube_default_val;data Waktu = OneMinute | TwoMinute | FiveMinute | TenMinute;data Oven_data = Cooking_val(Waktu) | Oven_default_val;
interface User_int{Unit push(Button_data);
}
![Page 55: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/55.jpg)
Class will be defined when we traverse the tree representation
Note…
![Page 56: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/56.jpg)
H 3
• If the node in a tree is event or method, next state will be placed in the body of method implementation
![Page 57: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/57.jpg)
H 4
• For node C??E??... Next node will executed only if C meets event E, it means,,, ??E?? Will become input request… (an approach to reducing complexity of real event)
• Note: there will be adjustment in the translating result
![Page 58: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/58.jpg)
Result from H1 – H4 (initialization)module SandBox;
data Door_data = Closed_val | Door_default_val;data Button_data = Pushed_val | Button_default_val;data Power_tube_data = Energised_val | Power_tube_default_val;data Waktu = OneMinute | TwoMinute | FiveMinute | TenMinute;data Oven_data = Cooking_val(Waktu) | Oven_default_val;interface User_int{
Unit push(Button_data button_rep);}class User_class implements User_int{
Unit push(Button_data button_var){button_var = Pushed_val;}
}
![Page 59: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/59.jpg)
Result of BT representation (execution summary)
{Door_data door_var = Closed_val;User_int user_var = new User_class();Button_data button_var = Button_default_val;Power_tube_data power_tube_var = Power_tube_default_val;Oven_data oven_var = Oven_default_val;
Var a = ask_input;
if(a ==Pushed_val){
power_tube_var = Energised_val;oven_var= Cooking_val(OneMinute);
}
}
![Page 60: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/60.jpg)
H 5
• For node C ???s???... It means when C reach state s, execute next node… if not, check again until C reach state s, in this case, the next node will become the body of “while” block, while the guard is a state
![Page 61: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/61.jpg)
61
Scratch 2
While(!locked){ suspend;}
Producer.lock(buffer);
![Page 62: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/62.jpg)
H 6
• For node C[s] -> (...)||1 ... ||m(...)• Every node after C[s] will be bounded by a
random-named method block, so we can run them non deterministically
![Page 63: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/63.jpg)
Example
In this example, we will encapsulate all the red subtree in one method named “run” in class consumer;and encapsulate blue subtree in one method named “run” in class Producer
And in main, when we execute it, we will only Call consumer!run, and producer!run.
![Page 64: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/64.jpg)
H 7
• For a node contains tag reversion ^, the approach is to use iteration
• a trace will help to find set of nodes (block) that need to be iterated, also to track down process that should be terminate
![Page 65: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/65.jpg)
65
Scratch 3
While(true){ if(buffer.ctr = buffer.capacity) {
producer.idle; } else {
break; } suspend;}
![Page 66: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/66.jpg)
H 8
• For a node contains tag synchronization =, we will use keyword ‘await’ or ‘suspend’
![Page 67: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/67.jpg)
P.s
• We will focusing the translation scheme only to those mentioned feature. For those only will be used in ProducerConsumerProblem
![Page 68: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/68.jpg)
Discussion
• Encapsulation• Assignment, and statement state
![Page 69: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/69.jpg)
69
Experiment
![Page 70: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/70.jpg)
70
To Do
• Parsing using XML from text representation• Coding & Implement the heuristic
![Page 71: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/71.jpg)
71
Reference
• Modeling Spatial and Temporal Variability with the HATS Abstract Behavioral Modeling Language?
• Behavior Tree Notation v1.0 (2007)• The ABS Language Specification• An Automated Failure Mode and Effect
Analysis Based on High-Level Design Specification with Behavior Trees
![Page 72: SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer 1](https://reader035.vdocument.in/reader035/viewer/2022062713/56649ccc5503460f94996880/html5/thumbnails/72.jpg)
72