440 likes | 453 Views
Improving the Precision of INCA by Preventing Spurious Cycles. Stephen F. Siegel and George S. Avrunin University of Massachusetts Laboratory for Advanced Software Engineering Research. Approaches to Finite State Verification. Traditional Reachability Enumerate all states
E N D
Improving the Precision of INCA by Preventing Spurious Cycles Stephen F. Siegel and George S. Avrunin University of Massachusetts Laboratory for Advanced Software Engineering Research
Approaches to Finite State Verification • Traditional Reachability • Enumerate all states • Precise, but State Explosion Problem • INCA approach • Formulate necessary conditions for the existence of a violation • Trade precision for tractability Improving the Precision of INCA by Preventing Spurious Cycles
Query Source How INCA Works INCA Front End answer FSAs Integer Linear Programming (ILP) Problem INCA Back End CPLEX INCA Improving the Precision of INCA by Preventing Spurious Cycles
Inequality Necessary Condition Analyzer Improving the Precision of INCA by Preventing Spurious Cycles
Simple Example t1 1 c 2 t2 5 b a c t3 7 c b 6 3 4 8 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Property for simple example Requirement: “On no execution is there a b preceded by an a.” (defquery “no-a-before-b” “nofair” (omega-star-less (sequence (interval :initial t :ends-with ’((rend “t3;t1.b”)) :require ’((rend “t2;t1.a”)))))) Improving the Precision of INCA by Preventing Spurious Cycles
t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
x1+x6 = x2+x4 t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
x1+x6 = x4+x5 = x2+x4 x5+x6 t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
x1+x6 = x4 = x2+x4 x6 t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Flow Equations 1 = x1+x6 = x2+x3 = x4 = 1 = x7+x8 = 1 = x9 = x1 x2+x4 x3+1 x6 x7 x8+1 x9 1 t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Flow Equations x3 +x4 +x5 = x8 1 = x1+x6 = x2+x3 = x4 = 1 = x7+x8 = 1 = x9 = x1 x2+x4 x3+1 x6 x7 x8+1 x9 1 t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Communication Equations Flow Equations x3 +x4 +x5 = x2 = x1+x6 = x8 x9 x7 1 = x1+x6 = x2+x3 = x4 = 1 = x7+x8 = 1 = x9 = x1 x2+x4 x3+1 x6 x7 x8+1 x9 1 t1 1 1 c 2 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Communication Equations Flow Equations x3 +x4 +x5 = x2 = x1+x6 = x8 x9 x7 1 = x1+x6 = x2+x3 = x4 = 1 = x7+x8 = 1 = x9 = x1 x2+x4 x3+1 x6 x7 x8+1 x9 1 t1 1 1 c Requirement Inequality 2 x8 ≥ 1 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Communication Equations Flow Equations x3 +x4 +x5 = x2 = x1+x6 = x8 x9 x7 1 = x1+x6 = x2+x3 = x4 = 1 = x7+x8 = 1 = x9 = x1 x2+x4 x3+1 x6 x7 x8+1 x9 1 t1 1 1 c Requirement Inequality 2 x8 ≥ 1 t2 5 b a c 7 t3 7 c 2 4 9 b 6 8 3 4 5 8 3 6 a a a Improving the Precision of INCA by Preventing Spurious Cycles
Spurious Cycle Improving the Precision of INCA by Preventing Spurious Cycles
The Cycle Elimination Problem • Add constraints to ILP System so that (i) any solution with disconnected flow is eliminated, and (ii) no connected solutions are eliminated. • Naïve solution: exponential number of constraints • Our solution: linear Improving the Precision of INCA by Preventing Spurious Cycles
Distinguishing Solutions Improving the Precision of INCA by Preventing Spurious Cycles
Distinguishing Solutions Improving the Precision of INCA by Preventing Spurious Cycles
Connected solution has spanning tree Improving the Precision of INCA by Preventing Spurious Cycles
Our Solution toCycle Elimination Problem • Add to INCA-generated ILP Problem: • For each node v: new variable dv • For each edge e: new binary variable se Improving the Precision of INCA by Preventing Spurious Cycles
Given connected solution: 0 Let se=1 if e is in spanning tree, 0 otherwise. Let dv=depth of v in tree if v is in solution, 0 otherwise. 1 3 1 1 1 1 0 4 2 0 0 1 1 0 3 5 1 4 Improving the Precision of INCA by Preventing Spurious Cycles
Constraints (i) For each edge e: If xe=0 then se=0. 0 1 3 1 1 1 1 0 4 2 0 0 1 1 0 3 5 1 4 Improving the Precision of INCA by Preventing Spurious Cycles
Constraints (i) For each edge e: If xe=0 then se=0. (ii) For each edge e=(u,v): If se=1 then dv > du. 0 1 3 1 1 1 1 0 4 2 0 0 1 1 0 3 5 1 4 Improving the Precision of INCA by Preventing Spurious Cycles
Constraints (i) For each edge e: If xe=0 then se=0. (ii) For each edge e=(u,v): If se=1 then dv > du. (iii) For each node v: If ∑xe > 0 then for some e=(u,v), se=1. 0 1 3 1 1 1 1 0 4 2 0 0 1 1 0 3 5 1 4 Improving the Precision of INCA by Preventing Spurious Cycles
Disconnected solution cannot satisfy constraints (i) For each edge e: If xe=0 then se=0. (ii) For each edge e=(u,v): If se=1 then dv > du. (iii) For each node v: If ∑xe > 0 then for some e=(u,v), se=1. u e v Improving the Precision of INCA by Preventing Spurious Cycles
Expressing Constraints in ILP Suppose x,y ≥ 0. Problem: express “If x = 0 then y = 0” as linear constraint. Impossible! y x Improving the Precision of INCA by Preventing Spurious Cycles
Expressing Constraints in ILP Suppose x,y ≥ 0. Problem: express “If x = 0 then y = 0” as linear constraint. Impossible! (But y ≤ xy works.) y x Improving the Precision of INCA by Preventing Spurious Cycles
“If x = 0 then y = 0” B Add restriction: 0 ≤ y ≤ B y Then “if x = 0 then y = 0” is equivalent to y ≤ Bx x Improving the Precision of INCA by Preventing Spurious Cycles
Compromise • We must use bounds 0 ≤ xe ≤ B for flow variables. • For experiments, B=10,000. • Strictly speaking, INCA analysis is not conservative. Improving the Precision of INCA by Preventing Spurious Cycles
Preliminary Experiments • Can we solve a problem we could not solve before? • How does cost (CPLEX time) scale? • Compare cost to inconclusive case. • For problems we could already solve: • Compare cost of using cycle-elimination with cost of not using it Improving the Precision of INCA by Preventing Spurious Cycles
Experiment 1: Scaled Simple • tasks: linear in n • nodes: linear in n • edges: quadratic in n • new variables: quadratic in n • new constraints: quadratic in n Improving the Precision of INCA by Preventing Spurious Cycles
Improving the Precision of INCA by Preventing Spurious Cycles
Improving the Precision of INCA by Preventing Spurious Cycles
Improving the Precision of INCA by Preventing Spurious Cycles
Conclusions • Technique eliminates solutions with spurious cycles, but not real solutions (except for those which exceed bound). • Number of new variables & constraints linear in number of nodes, edges. • ILP analysis time seems quite reasonable. Improving the Precision of INCA by Preventing Spurious Cycles
Future Work • Fully incorporate cycle-elimination into INCA. • Do extensive experimentation. • Work on the other major source of imprecision in INCA, the “Order Problem” • solutions in which there is no global ordering of events which is consistent with the order implied by the flow in each task. Improving the Precision of INCA by Preventing Spurious Cycles
Expressing Constraint (i) (i) For each edge e: if xe=0 then se=0. (i’) For each edge e: xe ≥ se Improving the Precision of INCA by Preventing Spurious Cycles
Expressing Constraint (ii) (ii) For each edge e=(u,v): if se=1 then dv > du. BOUND: 0 ≤ dv ≤ N, N = number of nodes (ii’) dv ≥ du+(N+1)si - N Improving the Precision of INCA by Preventing Spurious Cycles
Expressing Constraint (iii) (iii) For each node v: if ∑xe > 0 then for some e=(u,v), se=1. BOUND: 0 ≤ xe ≤ B (B=10,000 for now) v Improving the Precision of INCA by Preventing Spurious Cycles
Expressing Constraint (iii) (iii) For each node v: if ∑xe > 0 then for some e=(u,v), se=1. BOUND: 0 ≤ xe ≤ B (B=10,000 for now) (iii’) B In(v) ∑se ≥ ∑xe v Improving the Precision of INCA by Preventing Spurious Cycles
Chiron client architecture Client Initializer Application Artist Manager Client Protocol Manager Wrapper Artist(s) ADT Dispatcher Mapper Improving the Precision of INCA by Preventing Spurious Cycles
Chiron Notification Property • If Dispatcher receives event e1 from ADT Wrapper then it does not notify any artist of event e2 until it has notified the appropriate artists of event e1. Improving the Precision of INCA by Preventing Spurious Cycles
Chiron Unregister Property • Artist a1 never unregisters for event e1 unless a1 is already registered for e1. Improving the Precision of INCA by Preventing Spurious Cycles