chrome ref n.
Skip this Video
Loading SlideShow in 5 Seconds..
CHROME-REF PowerPoint Presentation
play fullscreen
1 / 21
Download Presentation

CHROME-REF - PowerPoint PPT Presentation

henrik
136 Views
Download Presentation

CHROME-REF

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. CHROME-REF CHRvOnline Model-driven Engine with Reasoning Explanation Facilities INRIA / UFPE Rafael Oliveira – Rafael.Oliveira@inria.fr Jacques Robin - robin.jacques@gmail.com Pierre Deransart - Pierre.Deransart@inria.fr Rocquencourt, France October 28, 2009

  2. Agenda • Separation of concerns (CHROME-REF Project) • Engine, Extraction, Driver and Analyzer • Generic CHRv Trace Schema for Debugging • Trace Driver • Trace Analyzer • Conclusion • Future Works

  3. Separation of Concerns • At present, there exists a number of useful debugging tools for CHR • Tools were designed and implemented in a specific way for each solver • Each implementation results in a set of one-to-one specialized connections between a solver and its tools CHR ECLiPSe Prolog Debugging Tool CHR SWI Prolog Debugging Tool … … CHR SICStus Prolog Debugging Tool

  4. Separation of Concerns • To propose a generic architecture that produces generic debugging information • Flexible • Portable CHR Trace Schema query CHR ECLiPSe Prolog Extraction CHR Trace Driver Analyzer CHR SWI Prolog Extraction … CHR SICStus Prolog Extraction

  5. CHROME-REF Project • Engine • CHROME engine • a compiler that take a CHR base into imperative Java objects • MDE approach during its process of compilation by means of ATL transformations. • Extraction • Theoretical Operational Semantics ωt • Integration (ωt + CHROME) • Generic CHRv Trace Schema for Debugging • Driver • A processor, on the fly, of traces events according to the query requested by the analyzer. • Analyzer • Debugging Tool

  6. CHROME-REF Project • Engine • CHROME engine • a compiler that take a CHR base into imperative Java objects • MDE approach during its process of compilation by means of ATL transformations. • Extraction • Theoretical Operational Semantics ωt • Integration (ωt+ CHROME) • Generic CHRv Trace Schema for Debugging • Driver • A processor, on the fly, of traces events according to the query requested by the analyzer. • Analyzer • Debugging Tool

  7. Generic CHRv Trace Schema for Debugging

  8. Trace Driver

  9. Trace Analyzer

  10. Conclusion

  11. Any questions?

  12. References • VITORINO, J. Model-Driven Engineering a Versatile, Extensible, Scalable Rule Engine through Component Assembly and Model Transformations. Universidade Federal de Pernambuco. CIn. CiênciadaComputação, 2009. • DUCK, G., STUCKEY, P., DE LA BANDA, M., and HOLZABAUR, C. The refined operational semantics of Constraint Handling Rules. Lecture notes in computer science (2004), 90–104.

  13. ECLiPSe Prolog • add • A new constraint is added to the constraint store. • already_in • A constraint to be added was already present. • try_rule • A rule is tried. • delay_rule • The last tried rule cannot fire because the guard did not succeed. • fire_rule • The last tried rule fires. • try_label • A label_with declaration is checked. • delay_label • The last label_with declaration delays because the guard did not succeed. • fire_label • The last tried label_with declaration succeeds, so the clauses of the associated constraint will be used for built-in labeling.

  14. ECLiPSe Prolog (LEQ example) • leq(A,B), leq(B,C), leq(C,A).ADD (2) leq(B, C)leq(B, C)TRY (2) leq(B, C)withbuilt_inRULE 'built_in' DELAYEDTRY (2) leq(B, C) (1) leq(A, B)withtransitivityRULE 'transitivity' FIREDADD (3) leq(A, C)leq(A, C)TRY (3) leq(A, C)withbuilt_inRULE 'built_in' DELAYEDADD (4) leq(C, A)leq(C, A)TRY (4) leq(C, A)withbuilt_inRULE 'built_in' DELAYEDTRY (4) leq(C, A) (3) leq(A, C)withantisymmetryRULE 'antisymmetry' FIREDleq(A, B)TRY (1) leq(A, B)withbuilt_inRULE 'built_in' DELAYEDTRY (1) leq(A, B) (2) leq(B, A)withantisymmetryRULE 'antisymmetry' FIREDA = BB = BC = B

  15. SWI Prolog • call • A new constraint is called and becomes active. • Exit • An active constraint exits: it has either been inserted in the store after trying all rules or has been removed from the constraint store. • Fail • An active constraint fails. • Redo • An active constraint starts looking for an alternative solution. • Wake • A suspended constraint is woken and becomes active. • Insert • An active constraint has tried all rules and is suspended in the constraint store. • Remove • An active or passive constraint is removed from the constraint store. • Try • An active constraints tries a rule with possibly some passive constraints. • Apply • An active constraints commits to a rule with possibly some passive constraints.

  16. ECLiPSe Prolog (LEQ example) • leq(A,B), leq(B,C), leq(C,A). CHR:   (0) Insert: leq(_G21593, _G21594) # <175>CHR:   (1) Call: leq(_G21593, _G21594) # <175> ? [creep]CHR:   (1) Exit: leq(_G21593, _G21594) # <175> ? [creep]CHR:   (0) Insert: leq(_G21594, _G21597) # <176>CHR:   (1) Call: leq(_G21594, _G21597) # <176> ? [creep]CHR:   (1) Try: leq(_G21593, _G21594) # <175>, leq(_G21594, _G21597) # <176> ==> leq(_G21593, _G21597).CHR:   (1) Apply: leq(_G21593, _G21594) # <175>, leq(_G21594, _G21597) # <176> ==> leq(_G21593, _G21597). ? [creep]CHR:   (1) Insert: leq(_G21593, _G21597) # <177>CHR:   (2) Call: leq(_G21593, _G21597) # <177> ? [creep]CHR:   (2) Exit: leq(_G21593, _G21597) # <177> ? [creep]CHR:   (1) Exit: leq(_G21594, _G21597) # <176> ? [creep]CHR:   (0) Insert: leq(_G21597, _G21593) # <178>CHR:   (1) Call: leq(_G21597, _G21593) # <178> ? [creep]CHR:   (1) Try: leq(_G21597, _G21593) # <178>, leq(_G21593, _G21597) # <177> <=> _G21597=_G21593.CHR:   (1) Apply: leq(_G21597, _G21593) # <178>, leq(_G21593, _G21597) # <177> <=> _G21597=_G21593. ? [creep]CHR:   (1) Remove: leq(_G21593, _G21597) # <177>CHR:   (1) Remove: leq(_G21597, _G21593) # <178>CHR:   (2) Wake: leq(_G21594, _G21593) # <176> ? [creep]CHR:   (2) Try: leq(_G21594, _G21593) # <176>, leq(_G21593, _G21594) # <175> <=> _G21594=_G21593.CHR:   (2) Apply: leq(_G21594, _G21593) # <176>, leq(_G21593, _G21594) # <175> <=> _G21594=_G21593. ? [creep]CHR:   (2) Remove: leq(_G21593, _G21594) # <175>CHR:   (2) Remove: leq(_G21594, _G21593) # <176>CHR:   (2) Exit: leq(_G21593, _G21593) # <176> ? [creep]CHR:   (1) Exit: leq(_G21593, _G21593) # <178> ? [creep]A = C,B = C .

  17. SICStus Prolog • call • Prompt when a constraint is executed for the first time. • Exit • Prompt when the constraint is successfully processed, i.e. the applicable rules have applied. • Fail • Prompt when a constraint fails. • Redo • Prompt at subsequent exits generated by non-deterministic rule bodies. • Wake • Prompt when a constraint from the constraint store is woken and reconsidered because one of its variables has been touched. • try • Prompt just before the guard evaluation of a rule, after constraints matching the heads have been found. • apply • Prompt upon the application of a rule, after the successful guard evaluation, when the rule commits and fires, just before evaluating the body • insert • Prompt when a constraint gets inserted into the constraint store, i.e. after all rules have been tried. • remove • Prompt when a constraint gets removed from the constraint store

  18. Etrace label:String EInitialState EIntroduce ESolve EApply EFail Goal UDC BIC Built-ins Rule * *

  19. contextTraceDriver::registerAnalyzer(a:Analyzer) post: analyzer->includes(d) contextTraceDriver::notifyDriver(eTrace:ETrace) post: analyzers->forAll(a | a^notification(filterTrace(a.request, eTrace))) contextTraceDriver::updateFilter(a:Analyzer, request:Request) post: a.request = request