Decoding Smart Cities Using a Rule-Based Programming Language Joaqun - - PowerPoint PPT Presentation

decoding smart cities using a rule based programming
SMART_READER_LITE
LIVE PREVIEW

Decoding Smart Cities Using a Rule-Based Programming Language Joaqun - - PowerPoint PPT Presentation

October 23, 2018 [Digital Cities Workshop EIT Digital] Decoding Smart Cities Using a Rule-Based Programming Language Joaqun Arias 1 , 2 Manuel Carro 1 , 2 1 IMDEA Software Institute, 2 Technical University of Madrid madrid institute for


slide-1
SLIDE 1

Decoding Smart Cities Using a Rule-Based Programming Language

October 23, 2018 [Digital Cities Workshop EIT Digital]

Joaquín Arias1,2 Manuel Carro1,2

1IMDEA Software Institute, 2Technical University of Madrid

madrid institute for advanced studies in software development technologies

slide-2
SLIDE 2

1 / 14

www.software.imdea.org

Motivation We want to speak to the digital cities

madrid institute for advanced studies in software development technologies

slide-3
SLIDE 3

2 / 14

www.software.imdea.org

Problems to be solved

1 The software used to analyze the digital cities is very complex, it has to:

  • Reason with static knowledge (e.g., city laws and regulations).
  • Process dynamic / stream data (e.g., mobility flow and energy consumption).

2 The code has to be modified / adapted due to:

  • Different users (e.g., local governs and enterprises ).
  • User requirements may differ (e.g., each citizen has it own interests).

3 The bottleneck is on the human side rather than on the machine side [6].

madrid institute for advanced studies in software development technologies

slide-4
SLIDE 4

3 / 14

www.software.imdea.org

Proposal

A rule-based programming language, based on logic and constraints: + makes it easier to translate requirements into code. + evaluates constraints answer set programs with control in mind. + uses constraints to prune the search during the analysis. + memorizes partial results to reuse them. + computes the aggregates of the analysis results incrementally. Implemented in Ciao, a high performance Prolog implementation.

https://ciao-lang.org madrid institute for advanced studies in software development technologies

slide-5
SLIDE 5

4 / 14

www.software.imdea.org

Where is our proposal?

madrid institute for advanced studies in software development technologies

slide-6
SLIDE 6

5 / 14

www.software.imdea.org

Preliminary Result

s(CASP): It is a novel non-monotonic reasoner for logic programs with negation and constraints. It is implemented with a goal-driven interpreter.

https://gitlab.software.imdea.org/joaquin.arias/sCASP

Modular TCLP: Is a modular design of TCLP which makes it easier to integrate tabling with different constraint solvers.

http://www.cliplab.org/papers/tplp2018-tclp/

ATCLP: Is a framework to incrementally compute user defined aggregates for elements in a lattice. Its semantics is consistent (also for recursive rules) with the LFP semantics of tabling.

http://www.cliplab.org/papers/padl2019-atclp/ madrid institute for advanced studies in software development technologies

slide-7
SLIDE 7

6 / 14

www.software.imdea.org

Let us discuss their contribution to the language

madrid institute for advanced studies in software development technologies

slide-8
SLIDE 8

7 / 14

www.software.imdea.org

s(CASP) [TPLP (ICLP) 2018]

Stream Data Reasoning: Consider a city dealing with data streams, Data, which can be contradictory. The data sources may have a different degree of trustworthiness, Pr, which we can use to select a given data item in case of inconsistency:

1

valid_stream(Pr,Data) :-

2

stream(Pr,Data),

3

not cancelled(Pr,Data).

4 5

cancelled(PrLo,DataLo) :-

6

PrHi #> PrLo,

7

stream(PrHi,DataHi),

8

incompt(DataLo,DataHi).

  • Constraints and a goal-driven strategy make it possible to answer queries without

evaluating the complete stream database.

madrid institute for advanced studies in software development technologies

slide-9
SLIDE 9

8 / 14

www.software.imdea.org

Modular TCLP [PPDP 2016, TPLP 2018]

Tabling engine Modular TCLP Interface Prolog-based CLP solver External CLP solver WAM

  • Its answer management strategy reduces execution time and space needs.
  • The integration of tabling and constraints improves: declarativeness, termination

properties, and performance.

madrid institute for advanced studies in software development technologies

slide-10
SLIDE 10

9 / 14

www.software.imdea.org

Modular TCLP

A: Discard B: Remove C: Discard+Remove 101 102 103 104 105 106 37,548 9.46 · 105 9,352 5.99 · 105 71,658 8.91 · 105 4,371 242 441 25 number of answers (log.)

Figure: Number of answers: saved, discarded, removed and returned to the query step_bound/4. madrid institute for advanced studies in software development technologies

slide-11
SLIDE 11

10 / 14

www.software.imdea.org

Modular TCLP

z a b c d Distance traversal in a graph: find nodes within a distance K.

Prolog CLP Tabling TCLP Left recursion x x 2311 1286 Without Right recursion > 5 min. 5136 3672 2237 cycles Left recursion x x x 742 With Right recursion x 10992 x 1776 cycles Table: Run time (ms) for dist/3. A ‘x’ means no termination. madrid institute for advanced studies in software development technologies

slide-12
SLIDE 12

11 / 14

www.software.imdea.org

ATCLP [submitted to PADL 2019]

Minimax Algorithm: Recursive rule under use defined aggregates.

1

:- table minimax(_, first/2, best/2).

2

minimax(Pos, Next, (Pos,Val)) :- move(Pos,Next), minimax(Next, _, (Next, Val)).

3

minimax(Pos, Pos, (Pos,Val)) :- \+ move(Pos,_), utility(Pos,Val).

4 5

best((Pos,ValA),(Pos,ValB)) :- move_min(Pos), ValA >= ValB. % Minimize

6

best((Pos,ValA),(Pos,ValB)) :- move_max(Pos), ValA =< ValB. % Maximize

7

first(_,_) :- true. % Chose first best option

Games: Graph traversal problem with two parameters to optimize.

Prolog Tabling TCLP Scenario 1 8062.49 14.66 2.89 Scenario 2 > 5 min. 37.59 4.87 Scenario 3 > 5 min. 1071.26 19.61 Scenario 4 > 5 min. 4883.00 23.21 Table: Run time (ms) for Games with different scenarios. madrid institute for advanced studies in software development technologies

slide-13
SLIDE 13

12 / 14

www.software.imdea.org

Conclusion We wanted to speak to the digital cities, so ...

madrid institute for advanced studies in software development technologies

slide-14
SLIDE 14

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

madrid institute for advanced studies in software development technologies

slide-15
SLIDE 15

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

1 The use of logic languages [1, 6] drastically reduce the overall complexity.

E.g., Etalis and Yedalog.

madrid institute for advanced studies in software development technologies

slide-16
SLIDE 16

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

1 The use of logic languages [1, 6] drastically reduce the overall complexity.

E.g., Etalis and Yedalog.

2 Common sense reasoning [7] (typically used by humans) uses the negation to

define general rules with exceptions. E.g., Medical advisor.

madrid institute for advanced studies in software development technologies

slide-17
SLIDE 17

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

1 The use of logic languages [1, 6] drastically reduce the overall complexity.

E.g., Etalis and Yedalog.

2 Common sense reasoning [7] (typically used by humans) uses the negation to

define general rules with exceptions. E.g., Medical advisor.

3 Constraints are useful dealing with continuous features and/or complex data [9].

E.g., Time intervals and ontology.

madrid institute for advanced studies in software development technologies

slide-18
SLIDE 18

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

1 The use of logic languages [1, 6] drastically reduce the overall complexity.

E.g., Etalis and Yedalog.

2 Common sense reasoning [7] (typically used by humans) uses the negation to

define general rules with exceptions. E.g., Medical advisor.

3 Constraints are useful dealing with continuous features and/or complex data [9].

E.g., Time intervals and ontology.

4 TCLP improves performance and termination of typical queries for the analysis of

social networks [8] and graph databases. E.g., Protocol Buffers by Google.

madrid institute for advanced studies in software development technologies

slide-19
SLIDE 19

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

1 The use of logic languages [1, 6] drastically reduce the overall complexity.

E.g., Etalis and Yedalog.

2 Common sense reasoning [7] (typically used by humans) uses the negation to

define general rules with exceptions. E.g., Medical advisor.

3 Constraints are useful dealing with continuous features and/or complex data [9].

E.g., Time intervals and ontology.

4 TCLP improves performance and termination of typical queries for the analysis of

social networks [8] and graph databases. E.g., Protocol Buffers by Google.

5 Incremental evaluation of lattice-based enhances performance, termination, and

problem/result representation. E.g., Stream data analysis.

madrid institute for advanced studies in software development technologies

slide-20
SLIDE 20

13 / 14

www.software.imdea.org

... why these results are important? [DC-ICLP 2016]

1 The use of logic languages [1, 6] drastically reduce the overall complexity.

E.g., Etalis and Yedalog.

2 Common sense reasoning [7] (typically used by humans) uses the negation to

define general rules with exceptions. E.g., Medical advisor.

3 Constraints are useful dealing with continuous features and/or complex data [9].

E.g., Time intervals and ontology.

4 TCLP improves performance and termination of typical queries for the analysis of

social networks [8] and graph databases. E.g., Protocol Buffers by Google.

5 Incremental evaluation of lattice-based enhances performance, termination, and

problem/result representation. E.g., Stream data analysis. Future work: we would like to improve it even more.

madrid institute for advanced studies in software development technologies

slide-21
SLIDE 21

14 / 14

www.software.imdea.org

Thank you for your attention

madrid institute for advanced studies in software development technologies

slide-22
SLIDE 22

15 / 14

www.software.imdea.org

Bibliography I

[1] D. Anicic, P . Fodor, S. Rudolph, R. Stühmer, N. Stojanovic, and R. Studer. A Rule-Based Language for Complex Event Processing and Reasoning. In International Conference on Web Reasoning and Rule Systems, pages 42–57. Springer, 2010. [2] J. Arias. Tabled CLP for Reasoning over Stream Data. In Technical Communications of the 32nd Int’l Conference on Logic Programming (ICLP’16), volume 52, pages 1–8. OASIcs, October 2016. Doctoral Consortium. [3] J. Arias and M. Carro. Description and Evaluation of a Generic Design to Integrate CLP and Tabled Execution. In 18th Int’l. ACM SIGPLAN Symposium on Principles and Practice

  • f Declarative Programming (PPDP’16), pages 10–23. ACM Press, September 2016.

[4] J. Arias and M. Carro. Description, Implementation, and Evaluation of a Generic Design for Tabled CLP. Theory and Practice of Logic Programming (to appear), 2018. [5] J. Arias, M. Carro, E. Salazar, K. Marple, and G. Gupta. Constraint Answer Set Programming without Grounding. Theory and Practice of Logic Programming, 34th Int’l. Conference on Logic Programming (ICLP’18) Special Issue, 2018. ISSN 1471-0684. URL https://arxiv.org/abs/1804.11162. madrid institute for advanced studies in software development technologies

slide-23
SLIDE 23

16 / 14

www.software.imdea.org

Bibliography II

[6] B. Chin, D. von Dincklage, V. Ercegovac, P . Hawkins, M. S. Miller, F. Och, C. Olston, and

  • F. Pereira. Yedalog: Exploring Knowledge at Scale. In LIPIcs-Leibniz International

Proceedings in Informatics, volume 32. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2015. [7] G. Gupta, E. Salazar, K. Marple, Z. Chen, and F. Shakerin. A case for query-driven predicate answer set programming. In G. Reger and D. Traytel, editors, ARCADE 2017. 1st International Workshop on Automated Reasoning: Challenges, Applications, Directions, Exemplary Achievements, volume 51 of EPiC Series in Computing, pages 64–68. EasyChair, 2017. doi: 10.29007/ngm2. URL https://easychair.org/publications/paper/GbHL. [8] T. Swift and D. S. Warren. Tabling with answer subsumption: Implementation, applications and performance. In T. Janhunen and I. Niemelä, editors, JELIA, volume 6341 of Lecture Notes in Computer Science, pages 300–312. Springer, 2010. ISBN 978-3-642-15674-8. [9] Y. Zou, T. Finin, and H. Chen. F-OWL: An Inference Engine for Semantic Web. In Formal Approaches to Agent-Based Systems, volume 3228 of Lecture Notes in Computer Science, pages 238–248. Springer Verlag, January 2005. madrid institute for advanced studies in software development technologies