test based extended finite state machines induction with
play

Test-Based Extended Finite-State Machines Induction with - PowerPoint PPT Presentation

NATIONAL RESEARCH UNIVERSITY Test-Based Extended Finite-State Machines Induction with Evolutionary Algorithms and Ant Colony Optimization Daniil Chivilikhin, Vladimir Ulyantsev, Fedor Tsarev St. Petersburg National Research University of


  1. NATIONAL RESEARCH UNIVERSITY Test-Based Extended Finite-State Machines Induction with Evolutionary Algorithms and Ant Colony Optimization Daniil Chivilikhin, Vladimir Ulyantsev, Fedor Tsarev St. Petersburg National Research University of Information Technologies, Mechanics and Optics GECCO-2012 Graduate Students Workshop July 7, 2012

  2. Overview (1) • Part of a bigger project on automated software engineering and automata-based programming • We focus on model driven-development Specification Model Code 2

  3. Overview (2) EFSM Set of tests Specification Model Code 3

  4. Automata-based Programming Output • Entities with complex Events actions behavior should be z1 e1 z2 designed as z2 automated controlled z3 e2 z4 objects • Control states and Automated Controlled Object A O Finite-State Machine Controlled Object computational states V Y f c Set of Set of Control Commands Computational States • Events X E States Z f q φ δ Requests Actions Transition • Output actions Function Function X o 4

  5. Definitions • EFSM: – input events – input Boolean variables – output actions • Test is a pair of two sequences – Input sequence of pairs I = < e , f> • e – input event • f – guard condition – Boolean formula on input variables – A – reference sequence of output actions • EFSM on the picture complies with – < A , ! x> , < A , x> – z 2, z 1 • EFSM on the picture does not comply with – < A , x> – z2 5

  6. Example – Alarm Clock (1) • Four events – H – button “H” pressed – M – button “M” pressed – A – button “A” pressed – T – occurs on each time tick • Two input variables • Seven output actions 6

  7. Example – Alarm Clock (2) Tests Model • Test 1: – T – z5 • Test 2: – H – z1 • Test 3: – A, H – z3 • … 7

  8. Example – Stack (1) Tests Model • Test 1: – push, pop pop [size>1]/ return element – ok, return element push/ ok • Test 2: Stack is Stack is – push, pop, pop not empty empty – ok, return element, pop [size=1]/ return error element • Test 3: pop / error – push, push, pop, pop – ok, ok, return element, return element • … 8

  9. Problems Considered • Automated model design Specification Model • Model mining Model Code 9

  10. Reduction to Automated Model Design Set of tests Model Code Well-known methods 10

  11. Problem Definition • Input data: – Set of tests – Number of states in EFSM ( C ) • Need to find an EFSM with C states complying with all tests 11

  12. Precomputations • For each pair of guard conditions from tests compute: – If they are same as Boolean functions – If they have common satisfying assignment • Time complexity: – O ( n 2 2 2 m ) where n is total size of tests’ input sequences, m is maximal number of input variables occurring in guard condition (in practice m is not greater than 5) 12

  13. Evolutionary Algorithms • Random mutation hill climber and evolutionary strategy can be easily used • Problem with genetic algorithms – no meaningful crossover (“it is hard to automatically identify functionally coherent modules in automata”) – Johnson, C. Genetic Programming with Fitness based on Model Checking. Lecture Notes in Computer Science . Springer Berlin / Heidelberg, 2007. Volume 4445/2007, pp. 114 – 124. – Lucas, S. and Reynolds, J. Learning Deterministic Finite Automata with a Smart State Labeling Algorithm. IEEE Transactions on Pattern Analysis and Machine Intelligence . Vol. 27, №7, 2005, pp. 1063 – 1074. • This problem can be solved with test-based crossover 13

  14. Individual Representation T / 1 A [x] / 0 0 1 T [!x] / 1 M / 2 {2, 0, {{A, x, 1, 0}, {T, !x, 1, 1}}, {{T, true, 1, 1}, {M, true, 0, 2}}} All EFSMs considered during one of evolutionary algorithm have the same number of states 14

  15. Transition Labeling Algorithm • Applied to each individual before calculation of fitness function T [x 2 ] / 1 T [x 2 ] / z 5 A [x 1 ] / 0 A [x 1 ] / 1 2 1 2 T [x 1 ] / 1 M [x 1 ] / 1 T [x 1 ] / z 5 M [x 1 ] / z 3 4 3 4 3 H [x 2 ] / 1 H [x 2 ] / z 4 15

  16. Mutation • Change of transition – Final state – Event – Guard condition – Number of output actions • Addition of deletion of a transitions 16

  17. Fitness Function    T ED ( O , A )  1    j j   FF 1   1 T max len ( O ), len ( A )    j 1 j j  1      10 FF ( M cnt), FF 1   1 1 M   FF 2 1      20 ( M cnt), FF 1   1 M 17

  18. Test-based Crossover Input Output Output sequences are sequences of EFSM sequences compared with reference tests 10% of tests for which edit Marked transitions are Transitions used while distance between output and kept together in processing these tests reference is minimal are EFSMs are marked selected 18

  19. Example (1) • Test set contains: – Test 1: A[x] / z1 B[y] / z2 • A [x], B [y] 0 1 2 • z1, z2 A [!x] / z1 B [!y] / z2 – Test 2: A[x] / z2 B[y] / z1 • A [!x], B [!y] 0 1 2 • z2, z1 A [!x] / z2 B [!y] / z1 – … 19

  20. Example (2) • Test set contains: – Test 1: A[x] / z1 B[y] / z2 • A [x], B [y] 0 1 2 • z1, z2 A [!x] / z1 B [!y] / z2 – Test 2: A[x] / z2 B[y] / z1 • A [!x], B [!y] 0 1 2 • z2, z1 A [!x] / z2 B [!y] / z1 – … 20

  21. Example (3) Offsprings Parents A[x] / z1 A[x] / z1 0 0 A [!x] / z2 A[x] / z2 A [!x] / z1 A[x] / z2 0 A [!x] / z2 A [!x] / z2 0 A[x] / z1 21 A [!x] / z1

  22. Example (4) • Duplicate and contradictory transitions removal • Showing for state 0 of first offspring A[x] / z1 A[x] / z1 Conflicting pair A [!x] / z2 A[x] / z2 A [!x] / z2 22

  23. Example (5) • Both offsprings pass both tests A[x] / z1 B[y] / z2 0 1 2 A [!x] / z2 B [!y] / z1 A[x] / z1 B[y] / z2 0 1 2 A [!x] / z2 B [!y] / z1 23

  24. Ant Colony Optimization • Graph:  Nodes – finite-state machines Edges – mutations of finite-state machines   Graph is too big to be constructed explicitly Algorithm: 1. Graph G = {random FSM} 2. While (true) Launch colony on graph G Update pheromone values Check stop conditions: if stagnation, restart 24

  25. Choosing the Next Node P = 1 - P 0 P = P 0 A1 A1 Mutation f(A1)=8   1 A2 A2   f(A2)=12 8 A   A 9 f(A)=10 A3 A3 f(A3)=0 “Roulette”   10 method   uv Transition to best  А 4 p Av A4  f(A4)=9 successor uw  w { A 1 , A 2 , A 3 , A 4 } 25

  26. Update Pheromone Values • Quality of solution (ant path) – max value of f among all nodes in path • New pheromone value on edge:       best uv uv uv • ρ < 1 – evaporation rate   best • – max pheromone value ever added uv to the edge (u, v) 26

  27. Choosing Start Nodes on Restart • Best path – path from some node to a node with max value of f • Start nodes are selected with “roulette” method from nodes of best path 27

  28. Experiments (1) • Six algorithms: – a genetic algorithm with traditional crossover (GA-1) – a random mutation hill climber (RMHC) – (1+1) evolutionary strategy (ES) – a genetic algorithm with test-based crossover (GA-2) – GA-2 hybridized with RMHC (GA-2+HC) – ant colony optimization (ACO) • Input data: 38 tests for alarm clock – total length of input sequences 242 – total length of reference sequences 195 • 1000 runs of each algorithm 28

  29. Experiments (2) Algorithm Min Max Avg Median GA-1 855390 38882588 5805943 4588736 RMHC 1150 9592213 1423983 957746 ES 1506 9161811 3447390 856730 GA-2 32830 599022 117977 83787 GA-2+HC 26740 188509 53706 48106 ACO 2440 210971 53944 46293 29

  30. Experiments (3) 1200000 Median number of fitness function evaluations 1000000 800000 600000 400000 200000 ACO 0 0 2000000 4000000 6000000 8000000 10000000 12000000 GA-2+HC Maximal number of RMHC fitness function ES GA-2 evaluations 30

  31. Summary • Test-based crossover greatly improves the performance of GA • GA on average significantly outperforms RMHC and ES • ACO outperforms GA-2 • Difference between average performance of ACO and GA-2+HC is insignificant 31

  32. Thank you! Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend