Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test...

26
Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December 5, 2014 Daniil Chivilikhin PhD student ITMO University Vladimir Ulyantsev PhD student ITMO University Anatoly Shalyto Dr.Sci., professor ITMO University Maxim Buzdalov PhD student ITMO University

Transcript of Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test...

Page 1: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties

ICMLA ’14

December 5, 2014

Daniil ChivilikhinPhD student

ITMO University

Vladimir UlyantsevPhD student

ITMO University

Anatoly ShalytoDr.Sci., professorITMO University

Maxim BuzdalovPhD student

ITMO University

Page 2: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Motivation: Reliable software

Systems with high cost of failure• Energy• Aviation• Space• …

We want to have reliable software

Testing can reveal errors• But cannot prove that

the program is correctVerification• Check properties in all

computational states

Exact and Metaheuristic Techniques for EFSM Inference

2

Page 3: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

Automata-based programming

Model-driven development

3

Softwarespecification

Model Code

Extended Finite-state machine

Page 4: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Extended Finite-State Machine

Exact and Metaheuristic Techniques for EFSM Inference

4

Page 5: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Conventional reliable program development workflow

Exact and Metaheuristic Techniques for EFSM Inference

5

Requirements

Programming

Testing

Verification

Page 6: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Automata-based programming workflow

Exact and Metaheuristic Techniques for EFSM Inference

6

Requirements

Program

Automated inference Easy for the userTime-consuming

for computersVerification Testing

Page 7: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Testing

Testing• “Test scenarios”• Check if model satisfies scenario

<e1, x, (z1)>, <e2, ¬x, (z1)>, <e2, ¬x, (z3)>

Candidate model

Exact and Metaheuristic Techniques for EFSM Inference

7

Page 8: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Verification

Verification• Linear Temporal Logic properties (LTL)• Use model checker

G(U(wasEvent(e1), wasEvent(e2)))

Exact and Metaheuristic Techniques for EFSM Inference

8

Page 9: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Automated inference problem statement

Exact and Metaheuristic Techniques for EFSM Inference

9

Given• Number of states C• Test scenarios• Temporal properties

Goal: find an EFSM with C states compliant with scenarios and temporal properties

Page 10: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

EFSM inference algorithms

Exact and Metaheuristic Techniques for EFSM Inference

10

Type of data

Testing + Verification Testing

Genetic algorithm MuACO SAT-based

algorithmTsarev, Egorov. GECCO 2011

Chivilikhin, Ulyantsev. GECCO 2014

Ulyantsev, Tsarev. ICMLA 2011

Page 11: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

EFSM inference algorithms

Exact and Metaheuristic Techniques for EFSM Inference

11

Type of data

Testing + Verification Testing

Genetic algorithm MuACO SAT-based

algorithmTsarev, Egorov. GECCO 2011

Chivilikhin, Ulyantsev. GECCO 2014

Ulyantsev, Tsarev. ICMLA 2011

Metaheuristics

Page 12: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

EFSM inference algorithms

Exact and Metaheuristic Techniques for EFSM Inference

12

Type of data

Testing + Verification Testing

Genetic algorithm MuACO SAT-based

algorithmTsarev, Egorov. GECCO 2011

Chivilikhin, Ulyantsev. GECCO 2014

Ulyantsev, Tsarev. ICMLA 2011Exact and fast

Page 13: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Paper Contributions

New exact algorithm based on Constraint Satisfaction Problem (CSP) solvers• No verification

Much simpler than previous algorithm based on SAT

Combined algorithm• CSP algorithm• MuACO

Uses CSP to find approximate solutionSolve full problem with MuACO

Exact and Metaheuristic Techniques for EFSM Inference

13

Page 14: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

EFSM inference using CSP solvers

Input• Test scenarios• Number of states C

Output• EFSM• Or message that it does

not exist

CSP algorithm1. Scenario tree construction2. Consistency graph

construction3. Constraint set construction4. Solving constraints5. Constructing an EFSM from

satisfying assignment

Exact and Metaheuristic Techniques for EFSM Inference

14

Page 15: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

1. Scenario tree construction

15

Basic idea – scenario tree coloring

Page 16: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

2. Consistency graph construction

Vertices are same as in scenario treeTwo vertices are connected by an edge if there is a sequence telling them apartBasically, that they cannot be merged into one stateConstructed using dynamic programming

16

Page 17: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

3. Used integer variables

xv – color of vertex v ∈ V (V – set of scenario tree vertices)• xv ∈ [0, C–1]

yi,e,f – state to which the transition from state i marked with event e and Boolean function f leads to• yi,e,f ∈ [0, C–1], e ∈ Σ, f ∈ Fe

17

Page 18: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

4. Constraint set construction

xv ≠ xu – colors of inconsistent vertices v and u should be different(xv = i) => (xu = yi,e,f) – tree coloring must comply with EFSM transitions• for each edge uv of scenario tree and each color i

18

Page 19: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

5. Solving constraints

Choco CSP solver• http://www.emn.ft/z-info/choco-solver

Java libraryEasy to useEfficient

19

Page 20: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

6. Constructing an EFSM from satisfying assignment

Merge vertices with same color

20

Page 21: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Proposed combined algorithm

Exact and Metaheuristic Techniques for EFSM Inference

21

Scenarios CSP algorithm

Approximate EFSM

MuACO Temporal properties

Final EFSM

Page 22: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Experimental setup

50 random EFSMs with 5–10 states

Two input variables

Two input events

Two output actions

Sequence length up to 2

Computer AMD 3.2 GHz Processor

Measured time

Exact and Metaheuristic Techniques for EFSM Inference

22

Page 23: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

Results

Small scenarios50 × C

Medium scenarios100 × C

Large scenarios200 × C

23

Page 24: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Exact and Metaheuristic Techniques for EFSM Inference

Statistical testing results

Scenarios size

C 50 × C 100 × C 200 × C

5 0.394 0.011 0.711

6 0.748 0.140 0.0180

7 0.011 0.019 0.0004

8 0.417 0.003 0.142

9 0.0001 0.0002 0.037

10 0.222 0.158 0.033

Wilcoxon signed-rank testAlternative: less

24

Page 25: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Acknowledgements

This work was financially supported by the Government of Russian Federation, Grant 074-U01, and also partially supported by RFBR, research project No. 14-07-31337 mol_a.

Exact and Metaheuristic Techniques for EFSM Inference

25

Page 26: Combining Exact and Metaheuristic Techniques For Learning Extended Finite-State Machines From Test Scenarios and Temporal Properties ICMLA ’14 December.

Thank you for your attention!

Exact and Metaheuristic Techniques for EFSM Inference

26

Daniil ChivilikhinVladimir Ulyantsev

Anatoly Shalyto

{chivdan,ulyantsev}@rain.ifmo.ru