PROJECTOR: an automatic logic program rewriting tool for better performance Nick Hippen & Yuliya Lierler Nick Hippen University of Nebraska at Omaha
What is Answer Set Programming (ASP)? • Constraint programming paradigm geared towards solving difficult combinatorial search problems • Prolog-like syntax Logic Rule Meaning 𝑑ℎ𝑗𝑚𝑒 𝑌, 𝑍 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑍, 𝑌 . X is a child of Y if Y is a parent of X. 𝑗𝑜𝑜𝑝𝑑𝑓𝑜𝑢 𝑌 ← 𝑜𝑝𝑢 𝑣𝑗𝑚𝑢𝑧 𝑌 . X is innocent if I have no reason to believe that X is guilty Head ← Body Nick Hippen University of Nebraska at Omaha 2
ASP Solver Architecture logic grounded answer Grounder ASP Solver program program sets logic rewritten logic grounded answer Grounder ASP Solver PROJECTOR program program program sets Nick Hippen University of Nebraska at Omaha 3
Grounding Logic Programs Logic Program Grounded Program Intelligently Grounded Program 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑏𝑚𝑚𝑧 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑏𝑚𝑚𝑧 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑏𝑚𝑚𝑧 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑛𝑏𝑠𝑠𝑧, 𝑘𝑝ℎ𝑜 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑛𝑏𝑠𝑠𝑧, 𝑘𝑝ℎ𝑜 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑛𝑏𝑠𝑠𝑧, 𝑘𝑝ℎ𝑜 . 𝑡𝑗𝑐𝑚𝑗𝑜 𝑐𝑝𝑐, 𝑛𝑏𝑠𝑠𝑧 . 𝑡𝑗𝑐𝑚𝑗𝑜 𝑐𝑝𝑐, 𝑛𝑏𝑠𝑠𝑧 . 𝑡𝑗𝑐𝑚𝑗𝑜 𝑐𝑝𝑐, 𝑛𝑏𝑠𝑠𝑧 . 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑑𝑝𝑣𝑡𝑗𝑜 𝑘𝑝ℎ𝑜, 𝑛𝑏𝑠𝑠𝑧 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑏𝑚𝑚𝑧, 𝑘𝑝ℎ𝑜 , 𝑑𝑝𝑣𝑡𝑗𝑜 𝑏𝑚𝑚𝑧, 𝑘𝑝ℎ𝑜 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑏𝑚𝑚𝑧 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑛𝑏𝑠𝑠𝑧 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑛𝑏𝑠𝑠𝑧, 𝑘𝑝ℎ𝑜 , 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑡𝑗𝑐𝑚𝑗𝑜 𝑏𝑚𝑚𝑧, 𝑐𝑝𝑐 , 𝑡𝑗𝑐𝑚𝑗𝑜 𝑐𝑝𝑐, 𝑛𝑏𝑠𝑠𝑧 , 𝑌 ≠ 𝑍. 𝑘𝑝ℎ𝑜 ≠ 𝑛𝑏𝑠𝑠𝑧. 𝑏𝑚𝑚𝑧 ≠ 𝑘𝑝ℎ𝑜. … 𝑑𝑝𝑣𝑡𝑗𝑜 𝑐𝑝𝑐, 𝑐𝑝𝑐 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑐𝑝𝑐 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑐𝑝𝑐, 𝑐𝑝𝑐 , 𝑡𝑗𝑐𝑚𝑗𝑜 𝑐𝑝𝑐, 𝑐𝑝𝑐 , 𝑐𝑝𝑐 ≠ 𝑐𝑝𝑐. … Nick Hippen University of Nebraska at Omaha 4
Improving Performance Smaller grounding sizes often translate into faster solve times Idea: Split a logic rule into multiple rules so that the number of variables present in each new rule is smaller than that of the original. Projection Two types: 𝛽 and 𝛾 Nick Hippen University of Nebraska at Omaha 5
PROJECTOR Result: 𝛽 Logic Program PROJECTOR: 𝜷 -projection 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 ← 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 , 𝑞1 𝑍, 𝑌 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 . 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑌 ≠ 𝑍, 𝑞1 𝑍, 𝑌 . 𝑌 ≠ 𝑍. Nick Hippen University of Nebraska at Omaha 6
Nondeterministic behavior Logic Program PROJECTOR: 𝜷 -projection Scenario #1 PROJECTOR: 𝜷 -projection Scenario #2 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 ← 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 . 𝑞0 𝑄2, 𝑌 ← 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 , 𝑞1 𝑍, 𝑌 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 . 𝑞1 𝑍, 𝑌 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 , 𝑞0 𝑄2, 𝑌 . 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑌 ≠ 𝑍, 𝑞1 𝑍, 𝑌 . 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑌 ≠ 𝑍, 𝑞1 𝑍, 𝑌 . 𝑌 ≠ 𝑍. Nick Hippen University of Nebraska at Omaha 7
PROJECTOR Result: 𝛾 Logic Program PROJECTOR: 𝜷 -projection PROJECTOR: 𝜸 -projection 𝑛𝑏𝑚𝑓 ↓ 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 ← 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 . 𝑞0 𝑍, 𝑄1 ← 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 . 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄2, 𝑍 , 𝑞1 𝑍, 𝑌 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 . 𝑞1 𝑍, 𝑌 ← 𝑞𝑏𝑠𝑓𝑜𝑢 𝑄1, 𝑌 , 𝑞0 𝑍, 𝑄1 , 𝑛𝑏𝑚𝑓(𝑌). 𝑡𝑗𝑐𝑚𝑗𝑜 𝑄1, 𝑄2 , 𝑛𝑏𝑚𝑓 ↓ 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑌 ≠ 𝑍, 𝑛𝑏𝑚𝑓 𝑌 , 𝑞1 𝑍, 𝑌 . 𝑛𝑏𝑚𝑓 ↓ 𝑑𝑝𝑣𝑡𝑗𝑜 𝑌, 𝑍 ← 𝑌 ≠ 𝑍, 𝑛𝑏𝑚𝑓 𝑌 , 𝑞1 𝑍, 𝑌 . 𝑌 ≠ 𝑍 𝑛𝑏𝑚𝑓(𝑌). Nick Hippen University of Nebraska at Omaha 8
Experimental Analysis • ASPCCG : ASP based natural language parser • 3 encodings of increasing levels of human optimization • Created by Matthew Buddenhagen, Yuliya Lierler & Peter Schuller • Enc1: No human optimization • Enc7: Moderate human optimization • Enc19: Notable human optimization Nick Hippen University of Nebraska at Omaha 9
ASPCCG: Encoding 1 Solve Time Grounding Size Nick Hippen University of Nebraska at Omaha 10
ASPCCG: Encoding 7 Solve Time Grounding Size Nick Hippen University of Nebraska at Omaha 11
ASPCCG: Encoding 19 Solve Time Grounding Size Nick Hippen University of Nebraska at Omaha 12
ASPCCG: Overall Nick Hippen University of Nebraska at Omaha 13
Related, Current & Future Work • Related work: lpopt (Bichler, Morak, Woltran, 2016) • Paper will be submitted to Practical Aspects of Declarative Languages (PADL) 2019 this weekend • System PROJECTOR available on the UNO NLPKR Lab website Future Work • Gather more benchmarks • Grounding size prediction • Improve language support Nick Hippen University of Nebraska at Omaha 14
Acknowledgements • Michael Dingess • Brian Hodges • Daniel Houston • Roland Kaminski • Liu Liu • Dr. Mirek Truszczynski • Stefan Woltran Nick Hippen University of Nebraska at Omaha 15
Ques Questio ions? ns? Nick Hippen University of Nebraska at Omaha 16
Recommend
More recommend