1 / 72

SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS

SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS. Emerson Chan Simbolon 0806334773 Fakultas Ilmu Komputer. Table of Contents. Introduction Related Works Frameworks Foundation Theory Behavior Tree ABS Translation Scheme Experiment Result and analysis

nami
Download Presentation

SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SIMULATION OF SOFTWARE REQUIREMENT IN BEHAVIOUR TREE USING ABS Emerson Chan Simbolon 0806334773 FakultasIlmuKomputer

  2. Table of Contents • Introduction • Related Works • Frameworks • Foundation Theory • Behavior Tree • ABS • Translation Scheme • Experiment • Result and analysis • Conclusion and Future Works

  3. Background What client need What client describe Programmer AA Bb CDd E AaaaBbbBbCccccDdddd AaaaBbBBb CcDdBCd Consistency? Ambiguity? Correctness? What programmer code

  4. Background (cont) What client need What client describe SOFTWARE METHODOLOGIES Programmer AA Bb CDd E AaaaBbbBbCccccDdddd AaaaBbbBbCcccCDdddd Consistency? Ambiguity? Correctness? What programmer code

  5. Background (cont) What client need What client describe BEHAVIOR TREE Programmer AA Bb CDd E AaaaBbbBbCccccDdddd AA Bb CDd E Consistency? Ambiguity? Correctness? What programmer code

  6. Motivation • From design to code • UML ? (e.g. http://www.altova.com/umodel/uml-code-generation.html) • BT -> Model Checked

  7. Related Works • Formal Method Lab research • SAL Model Checker • Animation of BT Simulation • Behavior Tree for Next AI Design

  8. Tools • Eclipse (IDE) • TextBE (Eclipse plugin) • ABS Plugin (Eclipse plugin)

  9. Foundation Theory • Behavior Tree • ABS • Translation Scheme

  10. Behavior Tree

  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

  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

  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

  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

  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)

  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

  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

  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

  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

  20. Bounded-Buffer Problem 1. Given one buffer with size N, one producer, one consumer 2. Producer put data to buffer until M times 3. Consumer take data from buffer until M times 4. Producer put data as long as buffer not full 5. Consumer take data as long as buffer not empty

  21. BT Representation • Shown

  22. ABS

  23. What is ABS? • Stands for Abstract Behavioral Specication • Developed by HATS (http://www.hats-project.eu) in 2009

  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

  25. What make ABS powerful? • Have 5 language-concepts that supports it to fit the needs of modeling large complex system

  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

  27. ABS Specification • Data types • Object Based Programming • Concurrency model

  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“

  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))

  30. Parametric data type, data List<T> = Nil | Cons(T, List<T>); • Type Synonyms type Catalog = Map<String, Product>; • Functions def A head<A>(List<A> list) = ... • Pattern Matching def A head<A>(List<A> list) = case list { Cons(h, _) => h }

  31. Object-Based Programming • Interface Syntax: InterfaceDecl ::= interface TypeId [extends TypeName (, TypeName)] { MethSig } MethSig ::= Type Identifier ( [ParamList] ) ; ParamList ::= Param (, Param) Param ::= Type Identifier Ex: interface Empty { Unit doNothing(); }

  32. Class Syntax: 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; } }

  33. Module Model 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).

  34. Concurrency Model • Concurrency Object Groups (COG) Pong pong = new cog IPong(); • Asynchronous Method Calls pong ! hi("Hello Pong"); • Future Fut<String> answerFut = pong ! hi("Hello Pong"); String answer = answerFut.get; • Cooperative Multi-Tasking Fut<String> answerFut = ping ! hi("Hello Ping"); skip; // do some processing ... await answerFut?; String answer = answerFut.get; // guaranteed not to block

  35. What is ABS? • Stands to Abstract Behavioral Specication • Developed by HATS (http://www.hats-project.eu) in 2009

  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

  37. What make ABS powerful? • Have 5 language-concepts that supports it to fit the needs of modeling large complex system

  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

  39. ABS Specification • Data types • Object Based Programming • Concurrency model

  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“

  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))

  42. Parametric data type, data List<T> = Nil | Cons(T, List<T>); • Type Synonyms type Catalog = Map<String, Product>; • Functions def A head<A>(List<A> list) = ... • Pattern Matching def A head<A>(List<A> list) = case list { Cons(h, _) => h }

  43. Object-Based Programming • Interface Syntax: InterfaceDecl ::= interface TypeId [extends TypeName (, TypeName)] { MethSig } MethSig ::= Type Identifier ( [ParamList] ) ; ParamList ::= Param (, Param) Param ::= Type Identifier Ex: interface Empty { Unit doNothing(); }

  44. Class Syntax: 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; } }

  45. Module Model 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).

  46. Concurrency Model • Concurrency Object Groups (COG) Pong pong = new cog IPong(); • Asynchronous Method Calls pong ! hi("Hello Pong"); • Future Fut<String> answerFut = pong ! hi("Hello Pong"); String answer = answerFut.get; • Cooperative Multi-Tasking Fut<String> answerFut = ping ! hi("Hello Ping"); skip; // do some processing ... await answerFut?; String answer = answerFut.get; // guaranteed not to block

  47. Translation Scheme

  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.

  49. 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

  50. Note.. Scratch 1 #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); There is always default value for each data, so when the data not reach one state, it must reach default state… so?

More Related