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

test based extended finite state machines induction with
SMART_READER_LITE
LIVE PREVIEW

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

Test-Based Extended Finite-State Machines Induction with Evolutionary Algorithms and Ant Colony Optimization Daniil Chivilikhin, Vladimir Ulyantsev, Fedor Tsarev tsarev@rain.ifmo.ru St. Petersburg National Research University of Information


slide-1
SLIDE 1

Test-Based Extended Finite-State Machines Induction with Evolutionary Algorithms and Ant Colony Optimization

Daniil Chivilikhin, Vladimir Ulyantsev, Fedor Tsarev tsarev@rain.ifmo.ru

  • St. Petersburg National Research University of Information Technologies,

Mechanics and Optics GECCO-2012 Graduate Students Workshop July 7, 2012

slide-2
SLIDE 2

2

Overview (1)

  • Part of a bigger project on automated software

engineering and automata-based programming

  • We focus on model driven-development
slide-3
SLIDE 3

3

Overview (2)

Set of tests EFSM

slide-4
SLIDE 4

4

Automata-based Programming

  • Entities with complex

behavior should be designed as automated controlled

  • bjects
  • Control states and

computational states

  • Events
  • Output actions
slide-5
SLIDE 5

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
  • n input variables

– A – reference sequence of output actions

  • EFSM on the picture complies with

– <A, !x>, <A, x> – z2, z1

  • EFSM on the picture does not

comply with

– <A, x> – z2

slide-6
SLIDE 6

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
slide-7
SLIDE 7

7

Example – Alarm Clock (2)

  • Test 1:

– T – z5

  • Test 2:

– H – z1

  • Test 3:

– A, H – z3

Tests Model

slide-8
SLIDE 8

8

Example – Stack (1)

  • Test 1:

– push, pop – ok, return element

  • Test 2:

– push, pop, pop – ok, return element, error

  • Test 3:

– push, push, pop, pop – ok, ok, return element, return element

Tests Model

Stack is empty Stack is not empty

push/ ok pop [size=1]/ return element pop [size>1]/ return element pop / error

slide-9
SLIDE 9

9

Problems Considered

  • Automated model design
  • Model mining
slide-10
SLIDE 10

10

Reduction to Automated Model Design

Well-known methods

slide-11
SLIDE 11

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

slide-12
SLIDE 12

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

slide-13
SLIDE 13

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

slide-14
SLIDE 14

14

Individual Representation

{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

slide-15
SLIDE 15

15

Transition Labeling Algorithm

  • Applied to each individual before

calculation of fitness function

slide-16
SLIDE 16

16

Mutation

  • Change of transition

– Final state – Event – Guard condition – Number of output actions

  • Addition of deletion of a transitions
slide-17
SLIDE 17

17

Fitness Function

( )

=

        − =

T j j j j j

A len O len A O ED T FF

1 1

) ( ), ( max ) , ( 1 1        = − ⋅ + < − ⋅ + ⋅ = 1 FF cnt), ( 1 20 1 FF cnt), ( 1 FF 10 FF

1 1 1 2

M M M M

slide-18
SLIDE 18

18

Test-based Crossover

Input sequences of tests EFSM Output sequences Output sequences are compared with reference

10% of tests for which edit distance between output and reference is minimal are selected

Transitions used while processing these tests are marked Marked transitions are kept together in EFSMs

slide-19
SLIDE 19

19

Example (1)

  • Test set contains:

– Test 1:

  • A [x], B [y]
  • z1, z2

– Test 2:

  • A [!x], B [!y]
  • z2, z1

– …

slide-20
SLIDE 20

20

Example (2)

  • Test set contains:

– Test 1:

  • A [x], B [y]
  • z1, z2

– Test 2:

  • A [!x], B [!y]
  • z2, z1

– …

slide-21
SLIDE 21

21

Example (3)

A[x] / z1 A [!x] / z1 A [!x] / z2 A [!x] / z2 A[x] / z1 A[x] / z2

Parents Offsprings

slide-22
SLIDE 22

22

Example (4)

  • Duplicate and contradictory transitions

removal

  • Showing for state 0 of first offspring

A[x] / z1 A [!x] / z2 A[x] / z2

Conflicting pair

slide-23
SLIDE 23

23

Example (5)

  • Both offsprings pass both tests
slide-24
SLIDE 24

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

slide-25
SLIDE 25

25

Choosing the Next Node

A A4

  • A2

A1

1 = τ

8 = τ

9 = τ

10 = τ

Transition to best successor “Roulette” method

P = P0 P = 1 - P0

=

} 4 , 3 , 2 , 1 { A A A A w uw uv Av

p τ τ

slide-26
SLIDE 26

26

Update Pheromone Values

  • Quality of solution (ant path) – max value of f

among all nodes in path

  • New pheromone value on edge:
  • ρ < 1 – evaporation rate
  • – max pheromone value ever added

to the edge (u, v)

best uv

τ ∆

best uv uv uv

τ ρτ τ ∆ + =

slide-27
SLIDE 27

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

slide-28
SLIDE 28

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
slide-29
SLIDE 29

29

Experiments (2)

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

slide-30
SLIDE 30

30

Experiments (3)

200000 400000 600000 800000 1000000 1200000 2000000 4000000 6000000 8000000 10000000 12000000

slide-31
SLIDE 31

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
  • f ACO and GA-2+HC is insignificant
slide-32
SLIDE 32

32

Related Publications

  • Tsarev F., Egorov K. Finite State Machine Induction

using Genetic Programming Based on Testing and Model Checking / Proceedings of the 2011 GECCO Conference Companion on Genetic and Evolutionary

  • Computation. NY. : ACM. 2011, pp. 759 – 762.
  • Alexandrov A. , Sergushichev A., Kazakov S., Tsarev F.

Genetic Algorithm for Induction of Finite Automation with Continuous and Discrete Output Actions / Proceedings

  • f the 2011 GECCO Conference Companion on Genetic

and Evolutionary Computation. NY. : ACM. 2011, pp. 775 – 778.

  • Ulyantsev V., Tsarev F. Extended Finite-State Machine

Induction using SAT-Solver / Proceedings of the Tenth International Conference on Machine Learning and Applications, ICMLA 2011, Honolulu, HI, USA, 18-21 December 2011. IEEE Computer Society, 2011. Vol. 2.

  • P. 346–349.
slide-33
SLIDE 33

Thank you!

Questions?

Email: tsarev@rain.ifmo.ru Twitter: @fedortsarev