Nitin Kumar Yadav RMIT University, Melbourne nitin.yadav@student.rmit.au

Post on 22-Feb-2016

97 views 0 download

Tags:

description

An empirical evaluation of regression and progression approaches for behavior composition. Nitin Kumar Yadav RMIT University, Melbourne nitin.yadav@student.rmit.edu.au. Minor thesis - semester 2, 2009, under the supervision of Dr. Sebastian Sardina , RMIT university. - PowerPoint PPT Presentation

Transcript of Nitin Kumar Yadav RMIT University, Melbourne nitin.yadav@student.rmit.au

Nitin Kumar YadavRMIT University, Melbourne

nitin.yadav@student.rmit.edu.au

Minor thesis - semester 2, 2009, under the supervision of Dr. Sebastian Sardina, RMIT university

An empirical evaluation of regression and progression approaches for behavior composition

Behavior CompositionRegression and Progression techniquesRegression approach ImplementationFramework for behavior composition experimentsExperimentsConclusion

Contents

An empirical evaluation of regression and progression approaches for behavior composition

Behavior Composition

3

What is a behavior ?

• Behavior – Logic of a machine– Web service– Stand alone component

• Abstracted as finite transition systems• Available behaviors can be non-deterministic

1. Sardina,Patrizi & De Giacomo, Proceedings of Principles of Knowledge Representation and Reasoning (KR),pages 640-650, September 2008. AAAI Press.

Painting Blocks Example1

Behavior Composition

4

Behaviors perform actions in a shared environment

ArmB: prepare

Behavior Composition

5

Behaviors perform actions in a shared environment

ArmA: clean

Behavior guards over the environments must be satisfied.

Behavior Composition

6

Behaviors perform actions in a shared environment

ArmA: dispose

Behavior Composition

7

Behaviors perform actions in a shared environment

ArmC: recharge

8

Behavior CompositionWhat is behavior composition ?

• Can the behaviors, executing one at a time realize a virtual target ?

• Does there exist a controller which can guarantee that the available behaviors can always do the actions that the target can request.

Behavior Composition

9

Enacted system of available behaviors

All what the system can do

a1 b1 c1

e1

a1 b2 c1

e2

a1 b1 c1

e2

a1 b3 c1

e2

a2 b1 c1

e2

a2 b1 c1

e3

a2 b3 c1

e2

a2 b3 c1

e3

a1 b1 c2

e1

a1 b1 c2

e2

B: prepare

B: paint

B: paint

A: clean

A: clean

A: clean

A: clean

C: recharge

C: prepare

A: recharge

a2 b2 c1

e2

a2 b2 c1

e3

A: clean

A: clean

Behavior Composition

10

Enacted target system

All what the target can request

t1

e1

t2

e2

t3

e2

t3

e3

t4

e3

t4

e2

t5

e1

t5

e4

recharge

prepare

recharge

clean

paintclean

paint

dispose

dispose

paint

• Does the enacted system ‘behave’ like the enacted target ?

11

Behavior Composition

Techniques

12

Two approaches for behavior composition based on simulation

• Regression based approach [Sardina,Patrizi & De Giacomo, KR 2008]

• Progression based approach [Stroeder & Pagnucco, 2009, IJCAI 2009]

Simulation

13

• A transition system T1 simulates another transition system T2 iff T1 can ‘mimic’ all the states of T2

• A state in the available system mimics another state in the target system if:– It can do all the actions that the target state can do– The successor state in the available system as a result of such

an action simulates the resulting state in the target system• Simulation is a relation of states of the enacted system

and the states of the enacted target which can be ‘mimicked’.

Progression approach – IJCAI ‘09

• Salient features– Works by expanding ‘decision nodes’ and marking

‘bad’ states and propagating marking backwards.– Expands states in relation to the target– Similar to how we reason– Implementation available

• Java based• Uses recursion to expand and mark states

18

Regression approach

• Step1 – Build the enacted system and enacted target

independent of each other• Step2

– Assume each system states simulates every target state. i.e. add a potential simulation link from each system state to every target state.

19

Regression approach

• Step3– Iteratively remove the links that violate the

simulation definition i.e.• Can the state simulate the target state ?• Is the resulting state in simulation with the resulting state

of the target ?• If the target state is final but the behavior states are not

• Stop when no more links can be removed• A solution exists if the initial state is in the

simulation relation

20

21

Example

Enacted Target

Regression approach

a1 b1 c1

e1

t1

e1

t2

e2

prepare

a1 b2 c1

e2

B:prepare

t4

e2

paint

a1 b1 c1

e2

a1 b3 c1

e2

B: paint

a2 b2 c1

e2

a2 b2 c1

e3

A: clean

dispose t5

e1

A: dispose

A: dispose

a1 b1 c1

e2

a1 b3 c1

e2

recharge t1

e1

a1 b3 c1

e2

a1 b1 c1

e2

A: RechargeB: Recharge

C: Recharge a1 b1 c2

e2

a1 b3 c1

e2

C: Recharge

a1 b1 c1

e2

A: Recharge

a1 b1 c2

e1

C:recharge

Enacted System

XX X

22

Example

Enacted Target

Regression approach

a1 b1 c1

e1

t1

e1

t2

e2

prepare

a1 b2 c1

e2

B:prepare

t4

e2

paint

a1 b1 c1

e2

a1 b3 c1

e2

B: paint

a2 b2 c1

e2

a2 b2 c1

e3

A: clean

dispose t5

e1

A: dispose

A: dispose

a1 b1 c1

e2

a1 b3 c1

e2

recharge t1

e1

a1 b3 c1

e2

a1 b1 c1

e2

A: RechargeB: Recharge

C: Recharge a1 b1 c2

e2

a1 b3 c1

e2

C: Recharge

a1 b1 c1

e2

A: Recharge

a1 b1 c2

e1

C:recharge

Enacted System

23

Example

Enacted Target

Regression approach

a1 b1 c1

e1

t1

e1

t2

e2

prepare

a1 b2 c1

e2

B:prepare

t4

e2

paint

a1 b1 c1

e2

a1 b3 c1

e2

B: paint

a2 b2 c1

e2

a2 b2 c1

e3

A: clean

dispose t5

e1

A: dispose

A: dispose

a1 b1 c1

e2

a1 b3 c1

e2

recharge t1

e1

a1 b3 c1

e2

a1 b1 c1

e2

A: RechargeB: Recharge

C: Recharge a1 b1 c2

e2

a1 b3 c1

e2

C: Recharge

a1 b1 c1

e2

A: Recharge

a1 b1 c2

e1

C:recharge

Enacted System

XXXXX

Assume

• Salient features– Enacted system and the enacted target are built

independent of each other– Allows recovery from behavior failure and any

uncontrolled action– The enacted system can be stored in memory and

different targets can then be checked for solution

24

Regression approach

• Related tools available– Symfony, Opus [De Giacomo et all, 2009, University of Rome ‘La Sapienza’]

• Used for web services composition• Do not have a concept of environment and guards

• Our implementation– First serious and complete implementation– Optimizations added on top of the original approach

25

Regression approachImplementation

• Step2 : Original– Starts with links from

every system state connected to every target state

– In each iteration check

• If the state is in simulation ?

• Is the resulting state in simulation ?

• Is the state final ?26

Regression approachOptimizations

• Step2: Optimization 1:- Starts with links between

the ‘similar’ states. i.e. add link only if the system state can do all what a target state can request.

- In each iteration• Is the resulting state in

simulation ?

27

Step2: Original

Enacted Target

Regression approach

a1 b1 c1

e1

t1

e1

t2

e2

prepare

a1 b2 c1

e2

B:prepare

t4

e2

paint

a1 b1 c1

e2

a1 b3 c1

e2

B: paint

a2 b2 c1

e2

a2 b2 c1

e3

A: clean

dispose t5

e1

A: dispose

A: dispose

a1 b1 c1

e2

a1 b3 c1

e2

recharge t1

e1

a1 b3 c1

e2

a1 b1 c1

e2

A: RechargeB: Recharge

C: Recharge a1 b1 c2

e2

a1 b3 c1

e2

C: Recharge

a1 b1 c1

e2

A: Recharge

a1 b1 c2

e1

C:recharge

Enacted System

28

Step2: Optimized

Enacted Target

Regression approach

a1 b1 c1

e1

t1

e1

t2

e2

prepare

a1 b2 c1

e2

B:prepare

t4

e2

paint

a1 b1 c1

e2

a1 b3 c1

e2

B: paint

a2 b2 c1

e2

a2 b2 c1

e3

A: clean

dispose t5

e1

A: dispose

A: dispose

a1 b1 c1

e2

a1 b3 c1

e2

recharge t1

e1

a1 b3 c1

e2

a1 b1 c1

e2

A: RechargeB: Recharge

C: Recharge a1 b1 c2

e2

a1 b3 c1

e2

C: Recharge

a1 b1 c1

e2

A: Recharge

a1 b1 c2

e1

C:recharge

Enacted System

• Parent state checking.– If a link is removed in the iteration, we need to check

ONLY the parent states.– Consider the chain example.

29

Regression approachOptimization 2

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

a s3

e1

a a s4

e1

b s5

e1

Enacted Target

Enacted System

• Original approach (also optimization 1)

• Optimization 2

30

Regression approachOptimization 2

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

a s3

e1

a a s4

e1

b s5

e1System

Target

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

a s3

e1

a a s4

e1

b s5

e1

System

Target

NO SOLUTION

• Original approach (also optimization 1)

• Optimization 2

31

Regression approachOptimization 2

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

a s3

e1

a a s4

e1

b s5

e1System

Target

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

a s3

e1

a a s4

e1

b s5

e1

System

Target

NO SOLUTION

NO SOLUTION

• 3rd optimization– Check if the initial state of the system is still in

simulation– Reduces the number of iterations if no solution

exists– Consider the modified chain example

32

Regression approachOptimization 3

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

b s3

e1

a a s4

e1

b s5

e1System

Target

• Original approach (also optimization 1)

• Optimization 3

33

Regression approachOptimization 3

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

b s3

e1

a a s4

e1

b s5

e1System

Target

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

b s3

e1

a a s4

e1

b s5

e1

System

Target

NO SOLUTION

NO SOLUTION

123

1

Benchmarking Framework

• Benchmarking in Java.– compilation

• First generation of JVM entirely interpreted• Just In Time compilation• Hot Spot dynamic compilation

– Class loading– Garbage Collection– Accuracy of system.currentTimeMillis() is platform

dependent.

34http://www.ibm.com/developerworks/library/j-jtp12214/

Benchmarking Framework

• Japex.– measures class loading, compilation time, garbage

collection time.– Easy to implement driver classes

• public void prepare(TestCase testCase);• public void warmup(TestCase testCase);• public void run(TestCase testCase);

– Define test cases in xml

35http://www.ibm.com/developerworks/library/j-jtp12214/

Benchmarking Framework

• Designing Benchmark Problems using a library of available behaviors by manipulating them.

36

Benchmarks

Number of Behaviors

Target Complexity

Environment Complexity

ND Amplification Chains

Benchmarking Framework

• No of behaviors– If a solution exists, increasing the number of

behaviors exponentially complicates the problem without affecting the ‘reliazability’.

– Example

• armA:1 1 1 1• armB:1 2 3 4• armC:1 1 1 1

37

Test case 1 Test case 2 Test case 3 Test case 4

Benchmarking Framework

• Target Complexity– Make the target do multiple loops without affecting

the solution.– Example

38

t1 t2

t3

t4

t5

prepare

clean

paint

paint

dispose

recharge

t1 t2

t3

t4

t5

prepare

clean

paint

paint

dispose

recharge

t1 t2

t3

t4

t5

prepare

clean

paint

paint

dispose

recharge

Benchmarking Framework

• Target Complexity with solution break– The last loop of the target requests an unknown

action.

– Multiple break points

39

Target 1 Target 1 Target 1 Target 1recharge recharge recharge

breakAction

Target 1 Target 1 Target 1 Target 1breakAction recharge recharge

breakAction

Benchmarking Framework

• Environment Complexity– Similar to target complexity except for

• Removal of guards from the target/behaviors

• Chains– Single behavior and target with ‘n’ states. – Behavior cannot do the last action of the target

40

t1

e1

t2

e1

a t3

e1

a a t4

e1

a t5

e1

s1

e1

s2

e1

a s3

e1

a a s4

e1

b s5

e1

Enacted Target

Enacted System

Benchmarking Framework

• ND Amplification– Add more non-deterministic states to an already

existing non-deterministic behavior

41

b1 b2prepare b3 b4

preparepaint

Paint, clean

recharge

clean

b1 b2prepare b3 b4

preparepaint

Paint, clean

recharge

clean

b2`Paint, clean

paint

prepare

ND Amplification = 1

Experiments

• No of Behaviors

42

Experiments

• No of Behaviors

43

Experiments

• Target Complexity

44

Experiments

• Target Complexity

45

Experiments

• Complex web services example

46From honor’s thesis of Paolo Felli, Service Composition through Synthesis Techniques based on Alternating-time Temporal Logic, University of Rome

Experiments

47

Tool Time

Symfony ~50 mins

Opus 18 hrs

Regression Original 23 seconds

Regression Optimized 15 seconds

TLV 100 ms

Conclusion

• First serious implementation of regression approach

• The first optimization should always be done• The second optimization is beneficial of patterns

similar to chain• Benchmark problems creation by modifying

existing problems.

48

Questions ?

Comparing the speed of the techniques