with asp
play

with ASP Alessandra Mileo Share, Remix, Reuse Legally This work is - PowerPoint PPT Presentation

How to Build a Stream Reasoning Application D. Dell'Aglio, E. Della Valle, T. Le-Pham, A. Mileo, and R. Tommasini http://streamreasoning.org/events/streamapp2017 Expressive Stream Reasoning with ASP Alessandra Mileo Share, Remix, Reuse


  1. How to Build a Stream Reasoning Application D. Dell'Aglio, E. Della Valle, T. Le-Pham, A. Mileo, and R. Tommasini http://streamreasoning.org/events/streamapp2017 Expressive Stream Reasoning with ASP Alessandra Mileo

  2. Share, Remix, Reuse — Legally This work is licensed under the Creative Commons  Attribution 3.0 Unported License. Your are free:  • to Share — to copy, distribute and transmit the work • to Remix — to adapt the work Under the following conditions  • Attribution — You must attribute the work by inserting a credits slide stating – These slides are partially based on “ How to Build a Stream Reasoning Application 2017 ” by D. Dell'Aglio, E. Della Valle, T. Le-Pham, Mileo, and R. Tommasini available online at http://streamreasoning.org/events/streamapp2017 To view a copy of this license, visit  http://creativecommons.org/licenses/by/3.0/ http://streamreasoning.org/events/sr4ld2015 2

  3. Expressivity Streams solution Data sets Non-monotonic Stream Reasoning Applications Streams entailed Data events DL-Stream Reasoning relevant Streams Data events Stream Query Processing Scalability http://streamreasoning.org/events/sr4ld2015 3

  4. Agenda Overview and ASP basics  StreamRule: A combined approach  Scalability vs. Expressivity trade-off  Ongoing work  • Boosting scalability: Distributed StreamRule http://streamreasoning.org/events/sr4ld2015 4

  5. Agenda Overview and ASP basics  StreamRule: A combined approach  Scalability vs. Expressivity trade-off  Ongoing work  • Boosting scalability: Distributed StreamRule http://streamreasoning.org/events/sr4ld2015 5

  6. Answer Set Programming (ASP) Goal: Declarative problem solving  “ what is the problem? ” instead of “ how to solve the problem? ” Problem Solution Modelling Interpretation Representation Output Computation (set of rules) http://streamreasoning.org/events/sr4ld2015 6

  7. Answer Set Programming (ASP) Features ASP combines:  • Rich yet simple modeling language – Default Reasoning, non-determinism, constraints, preferences, aggregates, … • High-performance solving capabilities – Based on guess/check/optimize strategy (generate & test) – Relies on CWA ASP has its roots in:  • Deductive databases • Logic programming (with negation) • KR and NMR • Constraint solving (mostly SAT) ASP = KR + DB + Search http://streamreasoning.org/events/sr4ld2015 7

  8. ASP Syntax & intuitive Semantics (1/2) Inference (deduction) Rule  a 1 :- b 1 ,…, b k , not b k+1 ,…, not b m head body “ if all b 1 ,…, b k are true and none of the b k+1 ,…, b m is true, then a 1 is true” (Disjunctive) Rule or Cardinality Constraint  l{a 1 ,…,a n }u :- b 1 ,… ,b k , not b k+1 , … , not b m head body “if all b 1 ,…, b k are true and none of the b k+1 ,… ,b m is true, then at least l and at most u among a 1 ,…,a n are true” http://streamreasoning.org/events/sr4ld2015 8

  9. ASP Syntax & intuitive Semantics (2/2) Consistency constraint (rule with empty head):  :- b 1 ,…, b k , not b k+1 ,…, not b m “it is not possible that all b 1 ,…, b k are true and none of the b k+1 ,…, b m is true” Fact (rule with empty body):  a 1 . “a 1 is true.” Other constructs allow for aggregates and preferences  (soft constraints) http://streamreasoning.org/events/sr4ld2015 9

  10. Example: graph colouring Problem encoding P:  % generating plausible colorings 1{col_V(V,C) : col(C)}1 :- vertex(V). % defining constraints :- col_V(V,C), col_V(V1,C), edge(V,V1). Input instance I:  col(red). col(green). col(blue). vertex(a). vertex(b). vertex(c). vertex(d). vertex(e). edge(a,b). edge(a,c). edge(a,d). edge(b,e). edge(c,d). edge(d,e). Answer Set(s) of P U I (one solution of the problem)  col_V(a,red). col_V(b,blue). col_V(c,blue). col_V(d,green). col_V(e,red). http://streamreasoning.org/events/sr4ld2015 10

  11. Stream Reasoning with ASP: What’s new? Normal Answer Set Programs are written to work with  static knowledge and non-monotonic rules Streaming ASP allows to externally input data into logic  programs and reason upon them to produce dynamic solutions (answer sets) to dynamic problems Implements windows for logic inference  Note:  reasoning over streams ≠ reasoning about time Incremental ASP 30/10/2017 http://streamreasoning.org/events/sr4ld2015 11

  12. Agenda Overview and ASP basics  StreamRule: A combined approach  Scalability vs. Expressivity trade-off  Ongoing work  • Boosting scalability: Distributed StreamRule http://streamreasoning.org/events/sr4ld2015 13

  13. The StreamRule idea What do we need? • – 2-tier approach: not all dynamic data streams are relevant for complex reasoning Reduced input = better scalability • Leverage existing engines from both semantic stream • processing and non-monotonic reasoning fields in practice ... http://streamreasoning.org/events/sr4ld2015 14

  14. StreamRule Architecture RDF Rule-based Files Query Expressive (e.g. Processing Reasoning Controller maps) Application LSD Wrappers C-SPARQL Clingo CQELS Web of Data Sensor Streams 30/10/2017 http://streamreasoning.org/events/sr4ld2015 15

  15. Example: Optimal Parking • Scenario: • Parkings are equipped with sensors for vehicle count that dynamically updates when cars go in and out • Users want to find the best parking spot at anytime, based on their location/point of interest and their optimized distance and/or cost, considering available space • Features: • Multicriteria optimization • Non-deterministic solutions generation (any of the available parking would do, with preference for those with a better value for distance and/or cost) • Defeasible reasoning (e.g. a parking is full unless I know there are spaces) 30/10/2017 http://streamreasoning.org/events/sr4ld2015 16

  16. Optimal Parking #input cost_per_hour/2, vacancy/2, walkingDistance/2, parkingCost/2, parking/1. %define parking full parkingStatus(ParkingID, "full") :- vacancy(ParkingID,NUMBER), NUMBER == 0. parkingStatus(ParkingID, "full") :- parking(ParkingID), not vacancy(ParkingID,_). %define available parking availableParkingLocation(ParkingID) :- not parkingStatus(ParkingID," full”), parking(ParkingID). %generation (must choose one parking among the available ones) 1{selected(ParkingID):availableParkingLocation(ParkingID)}1. %projection: distance of selected parking valueOf("DISTANCE", D) :- selected(ParkingID), walkingDistance((ParkingID,D)). %projection: cost of selected parking valueOf("COST", C):- selected(ParkingID),parkingCost(ParkingID, C). %weak constraints :~ valueOf("DISTANCE", AV). [AV@2] %optimization statement :~ valueOf("COST", AV). [AV@1] %optimization statement #show selected/1. #show valueOf/2. 30/10/2017 http://streamreasoning.org/events/sr4ld2015 17

  17. Limitations Grounding is a bottleneck in ASP • Does not scale when results are returned slower than • the new input window arrives How far can we go? http://streamreasoning.org/events/sr4ld2015 18

  18. Agenda Overview and ASP basics  StreamRule: A combined approach  Scalability vs. Expressivity trade-off  Ongoing work  • Boosting scalability: Distributed StreamRule http://streamreasoning.org/events/sr4ld2015 19

  19. Initial investigation If I divide the streaming window in partitions of size K, the  sum of the time needed to reason upon a number N of such partitions is smaller than the time needed to process the whole window of size N*K. For fixed complexity and streaming rate, I can find the  best partition size to handle the input within a certain unit of processing time (and keep the system scalable) No assumption is made on how the partitions are  generated (random) Stefano Germano, Thu-Le Pham, Alessandra Mileo: Web Stream Reasoning in Practice: On the Expressivity vs. Scalability Tradeoff . RR 2015: 105-112 http://streamreasoning.org/events/sr4ld2015

  20. Open issues and ongoing work Limitations  • Independence assumption • Experiments with a fixed logic program (i.e. fixed complexity) How to relax the independence assumption?  • Input dependency plays a role • For connected graphs, need heuristics to decide how to split then How to guarantee correctness?  http://streamreasoning.org/events/sr4ld2015 21

  21. Agenda Overview and ASP basics  StreamRule: A combined approach  Scalability vs. Expressivity trade-off  Ongoing work  • Boosting scalability: Distributed StreamRule Thu-Le Pham, Alessandra Mileo, Muhammad Intizar Ali: Towards Scalable Non- Monotonic Stream Reasoning via Input Dependency Analysis. ICDE 2017: 1553-1558 http://streamreasoning.org/events/sr4ld2015 22

  22. Extended Dependency Graph (r 1 ) very_slow_speed(X) :- average_speed(X,Y), Y < 20. (r 2 ) many_cars(X) :- car_number(X,Y), Y > 40. Rules (r 3 ) traffic_jam(X) :- very_slow_speed(X), many_cars(X), not traffic_light(X). .... average_speed very_slow_speed traffic_light Extended many_cars car_number Dependency Graph traffic_jam http://streamreasoning.org/events/sr4ld2015 23 23

Recommend


More recommend