CIS 540 Principles of Embedded Computation Spring 2015 Instructor: Rajeev Alur

Slides:



Advertisements
Similar presentations
Chapter 5: Tree Constructions
Advertisements

Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Lecture 19: Parallel Algorithms
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Hybrid Systems Presented by: Arnab De Anand S. An Intuitive Introduction to Hybrid Systems Discrete program with an analog environment. What does it mean?
Timed Automata.
The Theory of NP-Completeness
Compatibility between shared variable valuations in timed automaton network model- checking Zhao Jianhua, Zhou Xiuyi, Li Xuandong, Zheng Guoliang Presented.
CSE 101- Winter ‘15 Discussion Section January 26th 2015.
Graph Search Methods Spring 2007 CSE, POSTECH. Graph Search Methods A vertex u is reachable from vertex v iff there is a path from v to u. A search method.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Basic Feasible Solutions: Recap MS&E 211. WILL FOLLOW A CELEBRATED INTELLECTUAL TEACHING TRADITION.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
All Pairs Shortest Paths and Floyd-Warshall Algorithm CLRS 25.2
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
1 Lecture 25: Parallel Algorithms II Topics: matrix, graph, and sort algorithms Tuesday presentations:  Each group: 10 minutes  Describe the problem,
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
MAE 552 – Heuristic Optimization Lecture 26 April 1, 2002 Topic:Branch and Bound.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
1 Completeness and Complexity of Bounded Model Checking.
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Applied Discrete Mathematics Week 10: Equivalence Relations
C&O 355 Mathematical Programming Fall 2010 Lecture 17 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A.
Decision Procedures An Algorithmic Point of View
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
CSCI-455/552 Introduction to High Performance Computing Lecture 18.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
CS 312: Algorithm Analysis
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Graphs Data Structures and Algorithms A. G. Malamos Reference Algorithms, 2006, S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani Introduction to Algorithms,Third.
Computer Science CPSC 322 Lecture 9 (Ch , 3.7.6) Slide 1.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Lecture 81 Regional Automaton CS 5270 Lecture 8. Lecture 82 What We Need to Do Problem: –We need to analyze the timed behavior of a TTS. –The timed behavior.
The all-pairs shortest path problem (APSP) input: a directed graph G = (V, E) with edge weights goal: find a minimum weight (shortest) path between every.
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Two Discrete Optimization Problems Problem: The Transportation Problem.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CS 203: Introduction to Formal Languages and Automata
Chapter 13 Backtracking Introduction The 3-coloring problem
NPC.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘length’ c ij (cost, time, distance, …). Determine a path of shortest.
Variants of LTL Query Checking Hana ChocklerArie Gurfinkel Ofer Strichman IBM Research SEI Technion Technion - Israel Institute of Technology.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
C&O 355 Lecture 19 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A A A A A A A A.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Instructor: Rajeev Alur
Haim Kaplan and Uri Zwick
Shortest Path Problems
ESE535: Electronic Design Automation
Instructor: Shengyu Zhang
Shortest Path Problems
Algorithms (2IL15) – Lecture 7
Instructor: Aaron Roth
Instructor: Aaron Roth
Presentation transcript:

CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur

Timing Analysis Example x 1 >=3  x 2 :=0 A x 1 <=5 x 2 >= 6 x 1 = 7 Which of the modes D, E, F are reachable ? x 1, x 2 :=0x 2 >= 2 B x 1 <=7 C x 1 <=8 x 1 <= 4 D E F Requires propagation of the reachable combinations of x 1 and x 2 symbolically CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example A x 1, x 2 :=0 Initial set of clock-valuations: x 1 = 0 & x 2 = 0 Clock-zone: Uniform representation of constraints that arise during analysis Constraints of two types: 1. Lower/upper bound on value of a clock variable 2. Lower/upper bound on difference of two clock variables Clock-zone R 0 0 <= x 1 <= 0 0 <= x 2 <= 0 0 <= x 1 -x 2 <= 0 CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example A x 1 <= 5 Starting from a state in R 0, as time elapses, which clock-valuations are reachable ? Clock-zone R 0 0 <= x 1 <= 0 0 <= x 2 <= 0 0 <= x 1 -x 2 <= 0 During a timed transition, values of all clocks increase. How are the constraints impacted? What’s the effect of clock-invariant ? Step 1: Compute effect of timed transitions ignoring clock-invariants Constraints on individual clocks: Change upper bound to Infty Constraints on differences between clock values: unchanged (why?) Clock-zone R’ 0 0 <= x 1 <= Infty 0 <= x 2 <= Infty 0 <= x 1 – x 2 <= 0 CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example A x 1 <= 5 Desired clock-zone R 1 : Set of clock-valuations reachable while in mode A Intersection of constraints in R’ 0 and the clock-invariant Canonicalization: Tighten all bounds to reflect implied constraints Each lower bound should be as high as possible Each upper bound should be as low as possible Clock-zone R’ 0 0 <= x 1 <= Infty 0 <= x 2 <= Infty 0 <= x 1 -x 2 <= 0 Clock-zone R” 0 0 <= x 1 <= 5 0 <= x 2 <= Infty 0 <= x 1 -x 2 <= 0 Clock-zone R 1 0 <= x 1 <= 5 0 <= x 2 <= 5 0 <= x 1 -x 2 <= 0 CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example A x 1 <= 5 Desired clock-zone R 2 : What are set of clock-valuations upon entry to B ? Step 1: Intersect guard 3 <= x 1 with the clock-zone R 1 Clock-zone R 1 0 <= x 1 <= 5 0 <= x 2 <= 5 0 <= x 1 -x 2 <= 0 x 1 >=3  x 2 :=0 B 3 <= x 1 <= 5 0 <= x 2 <= 5 0 <= x 1 -x 2 <= 0 Step 2: Canonicalize by tightening constraints 3 <= x 1 <= 5 3 <= x 2 <= 5 0 <= x 1 -x 2 <= 0 Step 3: Capture the effect of assignment x 2 := 0 Bounds on x 2 change, and so do bounds on x 1 -x 2 Clock-zone R 2 3 <= x 1 <= 5 0 <= x 2 <= 0 3 <= x 1 -x 2 <= 5 Step 4: Canonicalize. In this case, constraints are already as tight as possible CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example B x 1 <= 7 Starting from a state in R 0, as time elapses, which clock-valuations are reachable ? Clock-zone R 2 3 <= x 1 <= 5 0 <= x 2 <= 0 3 <= x 1 -x 2 <= 5 Step 1: Set upper bounds on individual clock values to Infty 3 <= x 1 <= Infty 0 <= x 2 <= Infty 3 <= x 1 -x 2 <= 5 Step 2: Intersect with the clock-invariant x 1 <= 7 3 <= x 1 <= 7 0 <= x 2 <= Infty 3 <= x 1 -x 2 <= 5 Step 3: Canonicalize by tightening all the bounds What is a good data structure to represent clock-zones? What are algorithms for operations such as intersection, canonicalization? Clock-zone R 3 3 <= x 1 <= 7 0 <= x 2 <= 4 3 <= x 1 -x 2 <= 5 CIS 540 Spring 2015; Lecture April 22

Difference Bounds Matrix  Data structure for representing constraints, where each constraint expresses a bound on difference of values of two variables  Suppose clocks are named x 1, x 2, … x m  Let us introduce a dummy clock x 0 that is always 0. Then instead of the constraint L <= x i <= U, we have L <= x i – x 0 <= U  Lower bound constraint L <= x i – x j can be rewritten as upper bound constraint x j – x i <= -L  DBM R is (m+1) x (m+1) matrix representing for 0 <= i <= m, for 0 <= j <= m, x i – x j <= R[i,j]  Diagonal entries should be 0: x i – x j <= 0  There is a one-to-one correspondence between DBMs and clock-zones  Entries of DBM: Integers plus a special symbol Infty (to represent absence of a bound) CIS 540 Spring 2015; Lecture April 22

DBM Representation of Constraints 3 <= x 1 <= 7 0 <= x 2 <= Infty 3 <= x 1 - x 2 <= 5 3 <= x 1 - x 0 <= 7 0 <= x 2 – x 0 <= Infty 3 <= x 1 - x 2 <= 5 x 1 - x 0 <= 7 x 0 – x 1 <= -3 x 2 - x 0 <= Infty x 0 – x 2 <= 0 x 1 - x 2 <= 5 x 2 – x 1 <= -3 X0X1X2 X00-30 X1705 X2Infty-30 CIS 540 Spring 2015; Lecture April 22

DBM Canonicalization X0X1X2 X00-30 X1705 X2Infty-30 We know: x 2 – x 1 <= -3 and x 1 – x 0 <= 7, so we can conclude x 2 – x 0 <= 4 But current R[2,0] entry is Infty, to reflect tighter implied constraint, change it to 4 X0X1X2 X00-30 X1705 X24-30 General canonicalization step: If R[i,k] > R[i,j] + R[j,k] then R[i,k] = R[i,j] + R[j,k] Canonicalization: repeatedly apply above rule. A matrix is called canonical if all i, j, k, R[i,k] <= R[i,j] + R[j,k] Clock-zone R 3 3 <= x 1 <= 7 0 <= x 2 <= 4 3 <= x 1 – x 2 <= 5 CIS 540 Spring 2015; Lecture April 22

Canonical DBMs  Every canonicalization step does not change the set of clock-valuations that the DBM represents  Canonical DBM represents the “tightest” possible constraints  If R is canonical, for every i and j, R[i,j] is the least upper bound on the difference x i – x j for clock-valuations satisfying constraints in R  Alternative interpretation  Consider a graph with m+1 vertices corresponding to x 0, x 1, … x m  Entry R[i,j] = Cost labeling the edge from vertex x i to x j  Canonicalization: Compute costs of shortest paths in this graph  R is canonical if R[i,j] is the cost of shortest path from x i to x j  What if constraints are unsatisfiable ? CIS 540 Spring 2015; Lecture April 22

Checking Satisfiability/Non-emptiness X0X1X2 X0000 X15010 X2Infty-60 Suppose we know: 0 <= x 1 <= 5; 0 <= x 2 <= Infty; 6 <= x 1 – x 2 <= 10 X0X1X2 X00-60 X15010 X2Infty-60 Canonicalization step 1: Compare R[0,1] to R[0,2] + R[2,1], and change to -6 Canonicalization step 2: Compare R[1,1] to R[1,0] + R[0,1], and change to -1 X0X1X2 X00-60 X1510 X2Infty-60 R[1,1] entry says x 1 – x 1 <= -1, not possible! Means original constraints unsatisfiable! CIS 540 Spring 2015; Lecture April 22

Graph-based representation CIS 540 Spring 2015; Lecture April 22 Given: 1 = 0; 0 = 2 X0X1X2X3 X0000 X130-2infty X2infty 01 X33Infty0 X0 X0 X1X2X3 X X120-2 X24301 X

Canonicalization Algorithm  Problem same as computing shortest paths among all pairs of vertices in a directed graph  Need to account for detection of negative cycles (that is, unsatisfiable constraints)  Classical algorithm with time complexity cubic in the number of vertices/clocks CIS 540 Spring 2015; Lecture April 22

Canonicalization Algorithm Input: (m+1) x (m+1) DBM R Output: Check if constraints represented by R are satisfiable, and if so, return “canonical” version of R for l = 0 to m { /* R[i,j] reflects shortest path going through vertices < l */ for i = 0 to m { for j = 0 to m { /*Check if visiting vertex l improves i  j path */ R[i, j] = min ( R[i,j], R[i,l] + R[l,j] ) }; if R[i, i] < 0 then return “Unsatisfiable”; }; return R CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example B x 1 <= 7 Goal: Compute set of clock-valuations upon entry to C Step 1: Represent guard condition x 2 >= 2 as a canonical DBM x 2 >= 2 c Step 2: Intersect the two DBMs [i,j] entry of the result = Minimum of [i,j] entries of the given DBMs Step 3: Canonicalize. X0X1X2 X00-30 X1705 X24-30 X0X1X2 X000-2 X1Infty0 X2Infty 0 X0X1X2 X X1705 X24-30 X0X1X2 X X1705 X24-30 CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example Goal: Compute set of clock-valuations reachable due to timed transitions in mode C Step 1: Set upper bounds on all clocks, that is, first column, other than X0, to Infty c x 1 <=8 Step 2: Represent clock-invariant of C as a DBM, and take intersection Step 3: Canonicalize. X0X1X2 X X1705 X24-30 X0X1X2 X X1Infty05 X2Infty-30 X0X1X2 X X1805 X2Infty-30 X0X1X2 X X1805 X25-30 CIS 540 Spring 2015; Lecture April 22

Timing Analysis Example x 1 >=3  x 2 :=0 A x 1 <=5 x 2 >= 6 x 1 = 7 x 1, x 2 :=0x 2 >= 2 B x 1 <=7 C x 1 <=8 x 1 <= 4 D E F X0X1X2 X X1805 X25-30 DBM R 5 = Reachable states (x 1, x 2,mode=C) Intersection of R 5 and x 2 >=6 unsatisfiable; means mode D not reachable Intersection of R 5 and x 1 <= 4 unsatisfiable; means mode E not reachable Intersection of R 5 and x 1 =7 satisfiable; means mode F is reachable CIS 540 Spring 2015; Lecture April 22

Symbolic BFS Algorithm Given region Init over S, region Trans over S U S’, and region  over S, if  is reachable in T then return 1, else return 0 reg Reach := Init; /* States found reachable */ reg New := Init; /* States not yet explored for outgoing transitions */ while IsEmpty(New) = 0 { /* while there are states to be explored */ if IsEmpty(Conj(New,  )) =0 /* Property  found reachable */ then return 1 (and stop); New := Diff(Post(New,Trans),Reach); /*These are states in post-image of New, but not previously found reachable, so to be explored */ Reach := Disj(Reach, New); /* Update Reach by newly found states*/ }; return 0; /* All states explored without encountering  */ CIS 540 Spring 2015; Lecture April 22

Symbolic Search Using DBMs  State of a timed automaton = (Discrete state, clock valuation)  Discrete state assigns values to all variables other than clocks  Symbolic representation = (Discrete state s, DBM R)  Operations on DBMs used to implement symbolic search  When do (s, R) and (s’, R’) represent same set of states?  s = s’ and R = R’ (assuming they are canonical)  Image computation corresponding to timed transitions: already studied  Image computation corresponding to mode-switches  Intersect with guard, and reset clocks as needed  What’s the algorithm to compute, given DBM R, DBM for R[ x i := 0]  Cannot implement “Union” operation directly on DBMs  Union of DBMs R and R’ need not be a DBM, as each DBM represents a convex set of valuations CIS 540 Spring 2015; Lecture April 22

Symbolic Search Using DBMs  Data structure: discrete state and a list of DBMs ( s, R 1, R 2, …)  Search is partly enumerative and partly symbolic  Multiple paths ending up at same discrete state s would cause the list of DBMs associated with s to grow  Efficient implementation needs a way to keep this list compact  If number of reachable discrete states is finite, then search algorithm is guaranteed to terminate  Alternative algorithm for analyzing timed automata  Region equivalence: Finite partitioning of the set of all possible clock-valuations such that valuations belonging to the same partition behave similarly  See Section for details CIS 540 Spring 2015; Lecture April 22

Logistics  Homework 6 : Due Wed, April 29  Exercises 7.2, 7.8, 7.15, 7.17  Project phase 2: Due Fri, May 1  See post by Nimit on Piazza  Feedback for phase 1 on canvas  Recitation on Friday to discuss chapter 7 problems  Graded homeworks: pick up from Laura in Levine 308  Homework solutions posted on canvas CIS 540 Spring 2015; Lecture April 22