ILP Modulo Data - pdfs.semanticscholar.org › 548b › 88932a21456c403ee0ae32… · Id Cap Sector...
Embed Size (px)
Transcript of ILP Modulo Data - pdfs.semanticscholar.org › 548b › 88932a21456c403ee0ae32… · Id Cap Sector...
-
ILP Modulo Data
Pete Manolios Vasilis Papavasileiou Mirek Riedewald
Northeastern University
{pete,vpap,mirek}@ccs.neu.edu
October 23, 2014
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ n
xi ≠ xj, 1 ≤ i < j ≤ n∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ n
xi ≠ xj, 1 ≤ i < j ≤ n∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ n
xi ≠ xj, 1 ≤ i < j ≤ n∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ n
xi ≠ xj, 1 ≤ i < j ≤ n∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ n
xi ≠ xj, 1 ≤ i < j ≤ n∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ n
xi ≠ xj, 1 ≤ i < j ≤ n∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ nxi ≠ xj, 1 ≤ i < j ≤ n
∑{i | 1≤i≤n,si=s} ai ≤
∑1≤i≤n ai/3, for every sector s∑
{i | 1≤i≤n,ci=small} ai ≤∑
1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ nxi ≠ xj, 1 ≤ i < j ≤ n∑
{i | 1≤i≤n,si=s} ai ≤∑
1≤i≤n ai/3, for every sector s
∑{i | 1≤i≤n,ci=small} ai ≤
∑1≤i≤n ai/4
-
Id Cap Sector1 (EMC) large tech2 (FII) medium financials3 (AKR) small retail… … …
Id Diff1 1282 1173 89… …
Id Amountx1 a1x2 a2… …xn an
stocks quotes
portfolio
%maximizeΣ1≤i≤nai · disubject to(xi, ci, si) ∈ stocks, 1 ≤ i ≤ n(xi, di) ∈ quotes, 1 ≤ i ≤ nxi ≠ xj, 1 ≤ i < j ≤ n∑
{i | 1≤i≤n,si=s} ai ≤∑
1≤i≤n ai/3, for every sector s∑{i | 1≤i≤n,ci=small} ai ≤
∑1≤i≤n ai/4
-
Motivation
The Logic ∆
Efficient Solving
Experimental Evaluation
-
Motivation
The Logic ∆
Efficient Solving
Experimental Evaluation
-
• SQL
Query Languages
• QFLIA
Constraint Languages
• ∆
-
• SQL
Query Languages
• QFLIA
Constraint Languages
• ∆
-
• SQL
Query Languages
• QFLIA
Constraint Languages
• ∆
-
• SQL
Query Languages
• QFLIA
Constraint Languages
• ∆
-
• SQL
Query Languages
• QFLIA
Constraint Languages
• ∆
-
∆ ::= QFLIA % Relational Operators
-
Input Table
portfolio =
{(1, (x1, a1)),(2, (x2, a2)),. . . ,
(n, (xn, an))}
-
Input Table
portfolio =
{(1, (x1, a1)),(2, (x2, a2)),. . . ,
(n, (xn, an))}
unique ID
-
Input Table
portfolio =
{(1, (x1, a1)),(2, (x2, a2)),. . . ,
(n, (xn, an))}
unique ID
stock ID
-
Input Table
portfolio =
{(1, (x1, a1)),(2, (x2, a2)),. . . ,
(n, (xn, an))}
unique ID
stock ID
amount
-
Cross Product
portfolio× portfolio
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
σ
⟨σ p : first( left(p)) ̸= first( right(p)) ∧second( left(p)) = second( right(p))
: portfolio × portfolio ⟩
i.e.,
{(q, r) | q = (q1, (q2, q3)) ∈ portfolio,r = (r1, (r2, r3)) ∈ portfolio,q1 ̸= r1,q2 = r2}
-
Constraints
¬∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
¬∨
(q1, (q2, q3)) ∈ portfolio,(r1, (r2, r3)) ∈ portfolio
[q1 ̸= r1 ∧ q2 = r2]
O(n2) entries (general case: O(nn))
-
Constraints
¬∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
∃∃D : D is not empty
-
Constraints
¬∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
¬∨
(q1, (q2, q3)) ∈ portfolio,(r1, (r2, r3)) ∈ portfolio
[q1 ̸= r1 ∧ q2 = r2]
O(n2) entries (general case: O(nn))
-
Constraints
¬∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
¬∨
(q1, (q2, q3)) ∈ portfolio,(r1, (r2, r3)) ∈ portfolio
[q1 ̸= r1 ∧ q2 = r2]
O(n2) entries (general case: O(nn))
-
Motivation
The Logic ∆
Efficient Solving
Experimental Evaluation
-
F ∈ ∃∆
iff
{F ∈ ∆∃∃ only appears with positive polarity in F
-
∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
p ∈ [portfolio× portfolio]∧ first(left(p)) ̸= first(right(p))∧ second(left(p)) = second(right(p))
q ∈ portfolio∧ r ∈ portfolio∧ first(left((q, r))) ̸= first(right((q, r)))∧ second(left((q, r))) = second(right((q, r)))
p 7→ (q, r)
(q1, (q2, q3)) ∈ portfolio∧ (r1, (r2, r3)) ∈ portfolio∧ q1 ̸= r1∧ q2 = r2
q 7→ (q1, (q2, q3))r 7→ (r1, (r2, r3))
-
∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
p ∈ [portfolio× portfolio]∧ first(left(p)) ̸= first(right(p))∧ second(left(p)) = second(right(p))
q ∈ portfolio∧ r ∈ portfolio∧ first(left((q, r))) ̸= first(right((q, r)))∧ second(left((q, r))) = second(right((q, r)))
p 7→ (q, r)
(q1, (q2, q3)) ∈ portfolio∧ (r1, (r2, r3)) ∈ portfolio∧ q1 ̸= r1∧ q2 = r2
q 7→ (q1, (q2, q3))r 7→ (r1, (r2, r3))
-
∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
p ∈ [portfolio× portfolio]∧ first(left(p)) ̸= first(right(p))∧ second(left(p)) = second(right(p))
q ∈ portfolio∧ r ∈ portfolio∧ first(left((q, r))) ̸= first(right((q, r)))∧ second(left((q, r))) = second(right((q, r)))
p 7→ (q, r)
(q1, (q2, q3)) ∈ portfolio∧ (r1, (r2, r3)) ∈ portfolio∧ q1 ̸= r1∧ q2 = r2
q 7→ (q1, (q2, q3))r 7→ (r1, (r2, r3))
-
∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
p ∈ [portfolio× portfolio]∧ first(left(p)) ̸= first(right(p))∧ second(left(p)) = second(right(p))
q ∈ portfolio∧ r ∈ portfolio∧ first(left((q, r))) ̸= first(right((q, r)))∧ second(left((q, r))) = second(right((q, r)))
p 7→ (q, r)
(q1, (q2, q3)) ∈ portfolio∧ (r1, (r2, r3)) ∈ portfolio∧ q1 ̸= r1∧ q2 = r2
q 7→ (q1, (q2, q3))r 7→ (r1, (r2, r3))
-
∃∃
⟨σ p : first(left(p)) ̸= first(right(p)) ∧second(left(p)) = second(right(p))
: portfolio × portfolio ⟩
p ∈ [portfolio× portfolio]∧ first(left(p)) ̸= first(right(p))∧ second(left(p)) = second(right(p))
q ∈ portfolio∧ r ∈ portfolio∧ first(left((q, r))) ̸= first(right((q, r)))∧ second(left((q, r))) = second(right((q, r)))
p 7→ (q, r)
(q1, (q2, q3)) ∈ portfolio∧ (r1, (r2, r3)) ∈ portfolio∧ q1 ̸= r1∧ q2 = r2
q 7→ (q1, (q2, q3))r 7→ (r1, (r2, r3))
-
Table Membership
(x1, . . . , xk) ∈ {(y1,1, . . . , y1,k), . . . , (yl,1, . . . , yl,k)}
table (concrete and symbolic data)
-
Table Membership
(x1, . . . , xk) ∈ {(y1,1, . . . , y1,k), . . . , (yl,1, . . . , yl,k)}
table (concrete and symbolic data)
-
ILP % T [CAV 2013]
stably-infinite
∼
Data
≥
QFLIA
∃∆
-
ILP % T [CAV 2013]
stably-infinite
∼
Data
≥
QFLIA
∃∆
-
ILP % T [CAV 2013]
stably-infinite
∼
Data
≥
QFLIA
∃∆
-
ILP % T [CAV 2013]
stably-infinite
∼
Data
≥
QFLIA
∃∆
-
ILP % T [CAV 2013]
stably-infinite
∼
Data
≥
QFLIA
∃∆
-
Branching and Propagation Modulo Data
Input
C(x, y, a, b, . . .) ∧(x, y) ∈ {(1, 2), (2, 3), (3, 2), (a, b)} ∧
. . .
{C}
−→Branch{C · x < 2, C · x ≥ 2}−→
Branch{C · x < 2, C · x ≥ 2 · x ̸= a, C · x ≥ 2 · x = a}−→
D-Learn{C · x < 2, C · 2 ≤ x ≤ 3 · x ̸= a, C · x ≥ 2 · x = a}−→ . . .
{(1, 2),(2, 3),
(3, 2),
(a, b)}
{(1, 2),(a, b)}
{(2, 3),(3, 2),
(a, b)}
{(2, 3)(3, 2)}
{(2, 3)(3, 2),
(a, b)}
(x, y) ∈
(x, y) ∈(x, y) ∈
(x, y) ∈(x, y) ∈
x < 2 x ≥ 2
x ̸= a x = a
-
Branching and Propagation Modulo Data
Input
C(x, y, a, b, . . .) ∧(x, y) ∈ {(1, 2), (2, 3), (3, 2), (a, b)} ∧
. . .
{C}
−→Branch{C · x < 2, C · x ≥ 2}−→
Branch{C · x < 2, C · x ≥ 2 · x ̸= a, C · x ≥ 2 · x = a}−→
D-Learn{C · x < 2, C · 2 ≤ x ≤ 3 · x ̸= a, C · x ≥ 2 · x = a}−→ . . .
{(1, 2),(2, 3),
(3, 2),
(a, b)}
{(1, 2),(a, b)}
{(2, 3),(3, 2),
(a, b)}
{(2, 3)(3, 2)}
{(2, 3)(3, 2),
(a, b)}
(x, y) ∈
(x, y) ∈(x, y) ∈
(x, y) ∈(x, y) ∈
x < 2 x ≥ 2
x ̸= a x = a
-
Branching and Propagation Modulo Data
Input
C(x, y, a, b, . . .) ∧(x, y) ∈ {(1, 2), (2, 3), (3, 2), (a, b)} ∧
. . .
{C}−→
Branch{C · x < 2, C · x ≥ 2}
−→Branch{C · x < 2, C · x ≥ 2 · x ̸= a, C · x ≥ 2 · x = a}−→
D-Learn{C · x < 2, C · 2 ≤ x ≤ 3 · x ̸= a, C · x ≥ 2 · x = a}−→ . . .
{(1, 2),(2, 3),
(3, 2),
(a, b)}
{(1, 2),(a, b)}
{(2, 3),(3, 2),
(a, b)}
{(2, 3)(3, 2)}
{(2, 3)(3, 2),
(a, b)}
(x, y) ∈
(x, y) ∈(x, y) ∈
(x, y) ∈(x, y) ∈
x < 2 x ≥ 2
x ̸= a x = a
-
Branching and Propagation Modulo Data
Input
C(x, y, a, b, . . .) ∧(x, y) ∈ {(1, 2), (2, 3), (3, 2), (a, b)} ∧
. . .
{C}−→
Branch{C · x < 2, C · x ≥ 2}−→
Branch{C · x < 2, C · x ≥ 2 · x ̸= a, C · x ≥ 2 · x = a}
−→D-Learn{C · x < 2, C · 2 ≤ x ≤ 3 · x ̸= a, C · x ≥ 2 · x = a}−→ . . .
{(1, 2),(2, 3),
(3, 2),
(a, b)}
{(1, 2),(a, b)}
{(2, 3),(3, 2),
(a, b)}
{(2, 3)(3, 2)}
{(2, 3)(3, 2),
(a, b)}
(x, y) ∈
(x, y) ∈(x, y) ∈
(x, y) ∈(x, y) ∈
x < 2 x ≥ 2
x ̸= a x = a
-
Branching and Propagation Modulo Data
Input
C(x, y, a, b, . . .) ∧(x, y) ∈ {(1, 2), (2, 3), (3, 2), (a, b)} ∧
. . .
{C}−→
Branch{C · x < 2, C · x ≥ 2}−→
Branch{C · x < 2, C · x ≥ 2 · x ̸= a, C · x ≥ 2 · x = a}−→
D-Learn{C · x < 2, C · 2 ≤ x ≤ 3 · x ̸= a, C · x ≥ 2 · x = a}
−→ . . .
{(1, 2),(2, 3),
(3, 2),
(a, b)}
{(1, 2),(a, b)}
{(2, 3),(3, 2),
(a, b)}
{(2, 3)(3, 2)}
{(2, 3)(3, 2),
(a, b)}
(x, y) ∈
(x, y) ∈(x, y) ∈
(x, y) ∈(x, y) ∈
x < 2 x ≥ 2
x ̸= a x = a
-
Branching and Propagation Modulo Data
Input
C(x, y, a, b, . . .) ∧(x, y) ∈ {(1, 2), (2, 3), (3, 2), (a, b)} ∧
. . .
{C}−→
Branch{C · x < 2, C · x ≥ 2}−→
Branch{C · x < 2, C · x ≥ 2 · x ̸= a, C · x ≥ 2 · x = a}−→
D-Learn{C · x < 2, C · 2 ≤ x ≤ 3 · x ̸= a, C · x ≥ 2 · x = a}−→ . . .
{(1, 2),(2, 3),
(3, 2),
(a, b)}
{(1, 2),(a, b)}
{(2, 3),(3, 2),
(a, b)}
{(2, 3)(3, 2)}
{(2, 3)(3, 2),
(a, b)}
(x, y) ∈
(x, y) ∈(x, y) ∈
(x, y) ∈(x, y) ∈
x < 2 x ≥ 2
x ̸= a x = a
-
Motivation
The Logic ∆
Efficient Solving
Experimental Evaluation
-
http://scip.zib.de
http://caml.inria.fr
https://github.com/vasilisp/inez
http://scip.zib.dehttp://caml.inria.frhttps://github.com/vasilisp/inez
-
Benchmarks
http://www.ccs.neu.edu/home/vpap/fmcad-2014.html
http://www.ccs.neu.edu/home/vpap/fmcad-2014.html
-
1
10
100
1000
1 10 100 1000
Inez
Tim
e (s
)
InezDB Time (s)
-
1
10
100
1000
1 10 100 1000
Z3 T
ime
(s)
InezDB Time (s)
-
The End
MotivationThe Logic Efficient SolvingExperimental Evaluation