nitin kumar yadav rmit university, melbourne [email protected]

45
Nitin Kumar Yadav RMIT University, Melbourne [email protected] u.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

Upload: arvin

Post on 22-Feb-2016

96 views

Category:

Documents


0 download

DESCRIPTION

An empirical evaluation of regression and progression approaches for behavior composition. Nitin Kumar Yadav RMIT University, Melbourne [email protected]. Minor thesis - semester 2, 2009, under the supervision of Dr. Sebastian Sardina , RMIT university. - PowerPoint PPT Presentation

TRANSCRIPT

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

Nitin Kumar YadavRMIT University, Melbourne

[email protected]

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

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

Behavior CompositionRegression and Progression techniquesRegression approach ImplementationFramework for behavior composition experimentsExperimentsConclusion

Contents

An empirical evaluation of regression and progression approaches for behavior composition

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

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

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

Behavior Composition

4

Behaviors perform actions in a shared environment

ArmB: prepare

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

Behavior Composition

5

Behaviors perform actions in a shared environment

ArmA: clean

Behavior guards over the environments must be satisfied.

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

Behavior Composition

6

Behaviors perform actions in a shared environment

ArmA: dispose

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

Behavior Composition

7

Behaviors perform actions in a shared environment

ArmC: recharge

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

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.

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

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

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

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

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

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

11

Behavior Composition

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

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]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

• 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

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

• 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

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

• 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 ?

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

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

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

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

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

• 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

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

• 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

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

• 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

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

• 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

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

• 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

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

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/

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

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/

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

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

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

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

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

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

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

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

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

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

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

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

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

Experiments

• No of Behaviors

42

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

Experiments

• No of Behaviors

43

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

Experiments

• Target Complexity

44

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

Experiments

• Target Complexity

45

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

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

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

Experiments

47

Tool Time

Symfony ~50 mins

Opus 18 hrs

Regression Original 23 seconds

Regression Optimized 15 seconds

TLV 100 ms

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

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

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

Questions ?

Comparing the speed of the techniques