October 23, 2018 [Digital Cities Workshop EIT Digital] Decoding Smart Cities Using a Rule-Based Programming Language Joaquín Arias 1 , 2 Manuel Carro 1 , 2 1 IMDEA Software Institute, 2 Technical University of Madrid madrid institute for advanced studies in software development technologies
www.software.imdea.org Motivation We want to speak to the digital cities madrid institute for advanced studies in software development technologies 1 / 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 2 / 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 3 / 14
www.software.imdea.org Where is our proposal? madrid institute for advanced studies in software development technologies 4 / 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 5 / 14
www.software.imdea.org Let us discuss their contribution to the language madrid institute for advanced studies in software development technologies 6 / 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: valid_stream(Pr,Data) :- cancelled(PrLo,DataLo) :- 1 5 stream(Pr,Data), PrHi #> PrLo, 2 6 not cancelled(Pr,Data). stream(PrHi,DataHi), 3 7 incompt(DataLo,DataHi). 4 8 • 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 7 / 14
www.software.imdea.org Modular TCLP [PPDP 2016, TPLP 2018] Modular TCLP External CLP solver Interface Tabling engine Prolog-based 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 8 / 14
www.software.imdea.org Modular TCLP 9 . 46 · 10 5 8 . 91 · 10 5 5 . 99 · 10 5 number of answers (log.) 71 , 658 37 , 548 10 6 9 , 352 10 5 4 , 371 10 4 441 242 10 3 10 2 25 10 1 A: Discard B: Remove C: Discard+Remove Figure: Number of answers: saved, discarded, removed and returned to the query step_bound/4 . madrid institute for advanced studies in software development technologies 9 / 14
www.software.imdea.org Modular TCLP z a b 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 c Right recursion x 10992 x 1776 cycles Table: Run time (ms) for dist/3 . A ‘x’ means no termination. d madrid institute for advanced studies in software development technologies 10 / 14
www.software.imdea.org ATCLP [submitted to PADL 2019] Minimax Algorithm: Recursive rule under use defined aggregates. :- table minimax(_, first/2, best/2). 1 minimax(Pos, Next, (Pos,Val)) :- move(Pos,Next), minimax(Next, _, (Next, Val)). 2 minimax(Pos, Pos, (Pos,Val)) :- \+ move(Pos,_), utility(Pos,Val). 3 4 best((Pos,ValA),(Pos,ValB)) :- move_min(Pos), ValA >= ValB. % Minimize 5 best((Pos,ValA),(Pos,ValB)) :- move_max(Pos), ValA =< ValB. % Maximize 6 first(_,_) :- true. % Chose first best option 7 Games: Graph traversal problem with two parameters to optimize. Prolog Tabling TCLP 2.89 Scenario 1 8062.49 14.66 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 11 / 14
www.software.imdea.org Conclusion We wanted to speak to the digital cities, so ... madrid institute for advanced studies in software development technologies 12 / 14
www.software.imdea.org ... why these results are important? [DC-ICLP 2016] madrid institute for advanced studies in software development technologies 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 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 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 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 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 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 13 / 14
www.software.imdea.org Thank you for your attention madrid institute for advanced studies in software development technologies 14 / 14
Recommend
More recommend