SlideShare ist ein Scribd-Unternehmen logo
1 von 50
AR (Action Rules) The Language, Implementation, and Applications A tutorial given at CICLOPS’06 Neng-Fa Zhou CUNY Brooklyn College and Graduate Center
Evolution from freeze to AR ,[object Object],[object Object],[object Object],[object Object],[object Object]
Evolution from freeze to AR (Cont.) ,[object Object],[object Object],[object Object]
Sources of this tutorial ,[object Object],[object Object],[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The AR language   Syntax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Agent, Condition, {EventSet} => Action
The AR language   Syntax (Cont.) ,[object Object],[object Object],[object Object],append([],Ys,Zs) => Ys=Zs. append([X|Xs],Ys,Zs) => Zs=[X|Zs1], append(Xs,Ys,Zs1).
The AR language Operational semantics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Agent, Condition, {EventSet} => Action
Events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Posting events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example  An echoing agent echo(X),{event(X,O)} => writeln(O).   ?-echo(X),post_event(X,hello). hello ?-echo(X),repeat,post_event(X,hello),fail. hello hello hello …
Killing agents ,[object Object],echo(Flag,X),var(Flag), {event(X,O),ins(Flag)} =>  writeln(O). echo(Flag,X) => true. ?-echo(Flag,X),post_event(X,hello),Flag=1. hello
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Co-routining and concurrency  freeze(X,G) freeze(X,G), var(X), {ins(X)} => true. freeze(X,G) => call(G). ?-freeze(X,writeln(X)),X=f(a). f(a)
Co-routining and concurrency  Delay clauses ,[object Object],[object Object]
Co-routining and concurrency Compiling flat GHC ,[object Object],[object Object],append([],Ys,Zs):-true | Ys=Zs. append([X|Xs],Ys,Zs):-true | Zs=[X|Zs1], append(Xs,Ys,Zs1). append(Xs,Ys,Zs),var(Xs),{ins(Xs)} => true. append([],Ys,Zs) => Ys=Zs. append([X|Xs],Ys,Zs) => Zs=[X|Zs1], append(Xs,Ys,Zs1).
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Events for programming constraint propagation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Posting events on domain variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],X :: 1..4, X#2, X#4, X#1.
Propagators for aX=bY+c ,[object Object],'aX=bY+c_forward'(A,X,B,Y,C),var(X),var(Y), {ins(X),ins(Y)}  => true.  'aX=bY+c_forward'(A,X,B,Y,C),var(X) =>  T is B*Y+C, X is T//A, A*X=:=T. 'aX=bY+c_forward'(A,X,B,Y,C) =>  T is A*X-C, Y is T//B, B*Y=:=T. When either  X  or  Y  is instantiated, instantiate the other variable.
Propagators for aX=bY+c ,[object Object],'aX in bY+c_interval'(A,X,B,Y,C),var(X),var(Y), {generated,bound(Y)}   =>  'aX in bY+c_reduce_domain'(A,X,B,Y,C).  'aX in bY+c_interval'(A,X,B,Y,C) => true. Whenever a bound of  Y ’s domain is updated, reduce  X ’s domain to achieve interval consistency.
Propagators for aX=bY+c ,[object Object],'aX in bY+c_arc'(A,X,B,Y,C),var(X),var(Y), {dom(Y,Ey)}   =>  T is B*Ey+C,  Ex is T//A,  (A*Ex=:=T -> X #Ex;true).  'aX in bY+c_arc'(A,X,B,Y,C) => true. Whenever an element  Ey  is excluded from  Y ’s domain, exclude  Ey ’s counterpart  Ex  from  X ’s domain.
Propagator for  A1*X1+...+An*Xn+C = 0 'A1*X1+...+An*Xn+C=0'(C,A1,A2,...,An,X1,X2,..,Xn), n_vars_gt(n,2), {generated,ins(X1),bound(X1),...,ins(Xn),bound(Xn)} => reduce domains of  X1,..,Xn  to achieve ic .  'A1*X1+...+An*Xn+C=0'(C,A1,A2,...,An,X1,X2,..,Xn)  =>  nary_to_binary(NewC,B1,B2,Y1,Y2),  call_binary_propagator(NewC,B1,Y1,B2,Y2). When the constraint contains  more than 2  variables, achieve interval consistency. When the constraint becomes  binary archive arc consistency.
The use of the  dom  and  dom_any  events ,[object Object],[object Object],[object Object]
The AC-4 algorithm for general support constraints ac4(BinaryRelation,X,Y), var(X),var(Y), {dom_any(X,Ex)}  => decrement_counters(BinaryRelation,Ex,Y). ac4(BinaryRelation,X,Y) => true. ,[object Object]
Channeling constraints in dual CSPs ,[object Object],[object Object],[object Object],[object Object],primal_dual(Xi,I,DualVarVector),var(Xi),   {dom_any(Xi,J)}    => arg(J,DualVarVector,Yj), Yj # I.  primal_dual(Xi,I,DualVarVector) => true.
Set constraints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Propagation for set constraints  ,[object Object],subset_from_R_to_S(set(Rl,_Ru,_Rc),S),   {dom(Rl,E)}   =>   clpset_add(S,E). subset_from_S_to_R(R,set(_Sl,Su,_Sc)), {dom(Su,E)} => clpset_exclude(R,E).
Benchmarking CLP(FD) systems (As of Aug. 14, 2006) BP: B-Prolog 6.9 EP: Eclipse 5.8 #107 GP: Gnu-Prolog 1.2.16 SP: Sicstus-Prolog 3.12.5 CPU time, Windows XP Benchmarks: www.probp.com/bench.tar.gz
Benchmarking CLP(FD) systems (Cont.) ,[object Object],CPU time, Windows XP
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Compiling CHR ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
An example CHR program  reflexivity  @  leq(X,X) <=> true. antisymmetry @  leq(X,Y), leq(Y,X) <=> X = Y. idempotence  @  leq(X,Y) leq(X,Y) <=> true. transitivity @  leq(X,Y), leq(Y,Z) ==>  leq(X,Z). simplification propagation simpagation
Translating CHR into AR General ideas ,[object Object],[object Object],[object Object],P <=> Body. P, Q <=> Body. P ==> Body. P Q <=> Body. P, Q ==> Body. constr(Cno,Alive,History,X)
Translating CHR into AR Example p(X):- gen_constr_num(Cno), Constr=constr(Cno,AliveP,HistoryP,X), get_channel(p_1_1,ChP), get_channel(q_1_1,ChQ), agent_p_1_1(ChP,AliveP,X), post_p_1(ChQ,Constr,AliveP,X). agent_p_1_1(ChP,AliveP,X),var(AliveP), {event(ChP,Q),ins(AliveP)}  => Q=constr(_,AliveQ,HistoryQ,Y), (var(AliveQ)->AliveP=0,AliveQ=0,r(X,Y);true). agent_p_1_1(ChP,AliveP,X) => true. p(X),q(Y) <=> r(X,Y).
CHR to AR Example (Cont.) post_p_1(ChQ,Constr,AliveP,X),var(AliveP), {generated,ins(X),ins(AliveP)} => post_event(ChQ,Constr). post_p_1(ChQ,Constr,AliveP,X) => true. p(X),q(Y) <=> r(X,Y).
Benchmarking CHR compilers CPU time: milliseconds, Windows XP 453 1,765 6,843 zebra 640 1,125 6,532 primes 360 2,313 6,406 leq 3,250 Leuven  (SWI) 109 938 fib AR (by hand) Leuven (B-Prolog) Program
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CGLIB ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
An example go:- cgButton(B,“Hello World!”),  handleButtonClick(B), cgShow(B).   handleButtonClick(B), {actionPerformed(B)}  =>  halt.
Events for programming GUI ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Timers and time events go:-  timer(T1,100),  timer(T2,1000),  ping(T1),  pong(T2),  repeat,fail.   ping(T),{time(T)} => writeln(ping). pong(T),{time(T)} => writeln(pong).    
Demo of CGLIB  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The implementation of AR (The ATOAM architecture) P code area X1 X2 ... Xn registers s AR stack heap trail H T TOP
The frame structure for deterministic predicates Arguments AR CPS BTM TOP Local vars ,[object Object],[object Object],[object Object],[object Object],[object Object]
The frame structure for agents (Suspension frames) Arguments AR CPS BTM TOP PREV STATE REEP EVENT Local vars ,[object Object],[object Object],[object Object],[object Object],[object Object]
The frame structure for non-deterministic predicates Arguments AR CPS BTM TOP B CPF H T SF Local vars ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Spaghetti stack ,[object Object],[object Object],[object Object],[object Object],[object Object]
Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (19)

Stochastic Control/Reinforcement Learning for Optimal Market Making
Stochastic Control/Reinforcement Learning for Optimal Market MakingStochastic Control/Reinforcement Learning for Optimal Market Making
Stochastic Control/Reinforcement Learning for Optimal Market Making
 
Risk-Aversion, Risk-Premium and Utility Theory
Risk-Aversion, Risk-Premium and Utility TheoryRisk-Aversion, Risk-Premium and Utility Theory
Risk-Aversion, Risk-Premium and Utility Theory
 
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
Goodfellow, Bengio, Couville (2016) "Deep Learning", Chap. 6
 
Proximal Splitting and Optimal Transport
Proximal Splitting and Optimal TransportProximal Splitting and Optimal Transport
Proximal Splitting and Optimal Transport
 
Low Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse ProblemsLow Complexity Regularization of Inverse Problems
Low Complexity Regularization of Inverse Problems
 
Clustering in Hilbert geometry for machine learning
Clustering in Hilbert geometry for machine learningClustering in Hilbert geometry for machine learning
Clustering in Hilbert geometry for machine learning
 
Classification with mixtures of curved Mahalanobis metrics
Classification with mixtures of curved Mahalanobis metricsClassification with mixtures of curved Mahalanobis metrics
Classification with mixtures of curved Mahalanobis metrics
 
Divergence center-based clustering and their applications
Divergence center-based clustering and their applicationsDivergence center-based clustering and their applications
Divergence center-based clustering and their applications
 
Overview of Stochastic Calculus Foundations
Overview of Stochastic Calculus FoundationsOverview of Stochastic Calculus Foundations
Overview of Stochastic Calculus Foundations
 
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
Program on Quasi-Monte Carlo and High-Dimensional Sampling Methods for Applie...
 
Comparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering modelsComparing estimation algorithms for block clustering models
Comparing estimation algorithms for block clustering models
 
A Tutorial of the EM-algorithm and Its Application to Outlier Detection
A Tutorial of the EM-algorithm and Its Application to Outlier DetectionA Tutorial of the EM-algorithm and Its Application to Outlier Detection
A Tutorial of the EM-algorithm and Its Application to Outlier Detection
 
Introductory maths analysis chapter 11 official
Introductory maths analysis   chapter 11 officialIntroductory maths analysis   chapter 11 official
Introductory maths analysis chapter 11 official
 
Divergence clustering
Divergence clusteringDivergence clustering
Divergence clustering
 
Simplified Runtime Analysis of Estimation of Distribution Algorithms
Simplified Runtime Analysis of Estimation of Distribution AlgorithmsSimplified Runtime Analysis of Estimation of Distribution Algorithms
Simplified Runtime Analysis of Estimation of Distribution Algorithms
 
The dual geometry of Shannon information
The dual geometry of Shannon informationThe dual geometry of Shannon information
The dual geometry of Shannon information
 
Ada boost brown boost performance with noisy data
Ada boost brown boost performance with noisy dataAda boost brown boost performance with noisy data
Ada boost brown boost performance with noisy data
 
Tensor Train data format for uncertainty quantification
Tensor Train data format for uncertainty quantificationTensor Train data format for uncertainty quantification
Tensor Train data format for uncertainty quantification
 
Patch Matching with Polynomial Exponential Families and Projective Divergences
Patch Matching with Polynomial Exponential Families and Projective DivergencesPatch Matching with Polynomial Exponential Families and Projective Divergences
Patch Matching with Polynomial Exponential Families and Projective Divergences
 

Andere mochten auch (10)

新潟古町の活性化
新潟古町の活性化新潟古町の活性化
新潟古町の活性化
 
ΙΜΙΑ 1996 Η ΑΛΗΘΕΙΑ
ΙΜΙΑ 1996 Η ΑΛΗΘΕΙΑΙΜΙΑ 1996 Η ΑΛΗΘΕΙΑ
ΙΜΙΑ 1996 Η ΑΛΗΘΕΙΑ
 
2014年問題における新潟の対策
2014年問題における新潟の対策2014年問題における新潟の対策
2014年問題における新潟の対策
 
Kokoria
KokoriaKokoria
Kokoria
 
งานอบรมครูสาธิตรามWeb
งานอบรมครูสาธิตรามWebงานอบรมครูสาธิตรามWeb
งานอบรมครูสาธิตรามWeb
 
Η ΕΡΧΟΜΕΝΗ ΟΞΕΙΑ ΚΑΙ ΔΙΣΤΟΜΟΣ ΡΟΜΦΑΙΑ
Η ΕΡΧΟΜΕΝΗ ΟΞΕΙΑ ΚΑΙ ΔΙΣΤΟΜΟΣ ΡΟΜΦΑΙΑΗ ΕΡΧΟΜΕΝΗ ΟΞΕΙΑ ΚΑΙ ΔΙΣΤΟΜΟΣ ΡΟΜΦΑΙΑ
Η ΕΡΧΟΜΕΝΗ ΟΞΕΙΑ ΚΑΙ ΔΙΣΤΟΜΟΣ ΡΟΜΦΑΙΑ
 
Ergenekon Nasıl Çökertilir'in e-kitap
Ergenekon Nasıl Çökertilir'in e-kitapErgenekon Nasıl Çökertilir'in e-kitap
Ergenekon Nasıl Çökertilir'in e-kitap
 
Presentazione Caffè Carbonelli al Toscanalab 2010
Presentazione Caffè Carbonelli al Toscanalab 2010Presentazione Caffè Carbonelli al Toscanalab 2010
Presentazione Caffè Carbonelli al Toscanalab 2010
 
Цветно настроение
 Цветно настроение Цветно настроение
Цветно настроение
 
" За винаги"
 " За  винаги" " За  винаги"
" За винаги"
 

Ähnlich wie Zhou ciclops floc06

Math130 ch09
Math130 ch09Math130 ch09
Math130 ch09
Putrace
 
09 logic programming
09 logic programming09 logic programming
09 logic programming
saru40
 

Ähnlich wie Zhou ciclops floc06 (20)

Pl vol1
Pl vol1Pl vol1
Pl vol1
 
Q-Metrics in Theory and Practice
Q-Metrics in Theory and PracticeQ-Metrics in Theory and Practice
Q-Metrics in Theory and Practice
 
Q-Metrics in Theory And Practice
Q-Metrics in Theory And PracticeQ-Metrics in Theory And Practice
Q-Metrics in Theory And Practice
 
Pl vol1
Pl vol1Pl vol1
Pl vol1
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
Planning Under Uncertainty With Markov Decision Processes
Planning Under Uncertainty With Markov Decision ProcessesPlanning Under Uncertainty With Markov Decision Processes
Planning Under Uncertainty With Markov Decision Processes
 
Finance Enginering from Columbia.pdf
Finance Enginering from Columbia.pdfFinance Enginering from Columbia.pdf
Finance Enginering from Columbia.pdf
 
Pata contraction
Pata contractionPata contraction
Pata contraction
 
Supervisory control of discrete event systems for linear temporal logic speci...
Supervisory control of discrete event systems for linear temporal logic speci...Supervisory control of discrete event systems for linear temporal logic speci...
Supervisory control of discrete event systems for linear temporal logic speci...
 
Declare Your Language: Constraint Resolution 1
Declare Your Language: Constraint Resolution 1Declare Your Language: Constraint Resolution 1
Declare Your Language: Constraint Resolution 1
 
Math130 ch09
Math130 ch09Math130 ch09
Math130 ch09
 
MUMS Opening Workshop - Panel Discussion: Facts About Some Statisitcal Models...
MUMS Opening Workshop - Panel Discussion: Facts About Some Statisitcal Models...MUMS Opening Workshop - Panel Discussion: Facts About Some Statisitcal Models...
MUMS Opening Workshop - Panel Discussion: Facts About Some Statisitcal Models...
 
09 logic programming
09 logic programming09 logic programming
09 logic programming
 
TR tabling presentation_2010_09
TR tabling presentation_2010_09TR tabling presentation_2010_09
TR tabling presentation_2010_09
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheet
 
Probability cheatsheet
Probability cheatsheetProbability cheatsheet
Probability cheatsheet
 
Identifiability in Dynamic Casual Networks
Identifiability in Dynamic Casual NetworksIdentifiability in Dynamic Casual Networks
Identifiability in Dynamic Casual Networks
 
Some fixed point theorems in fuzzy mappings
Some fixed point theorems in fuzzy mappingsSome fixed point theorems in fuzzy mappings
Some fixed point theorems in fuzzy mappings
 
Probability Cheatsheet.pdf
Probability Cheatsheet.pdfProbability Cheatsheet.pdf
Probability Cheatsheet.pdf
 
Maximum likelihood estimation of regularisation parameters in inverse problem...
Maximum likelihood estimation of regularisation parameters in inverse problem...Maximum likelihood estimation of regularisation parameters in inverse problem...
Maximum likelihood estimation of regularisation parameters in inverse problem...
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Zhou ciclops floc06

  • 1. AR (Action Rules) The Language, Implementation, and Applications A tutorial given at CICLOPS’06 Neng-Fa Zhou CUNY Brooklyn College and Graduate Center
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. Example An echoing agent echo(X),{event(X,O)} => writeln(O). ?-echo(X),post_event(X,hello). hello ?-echo(X),repeat,post_event(X,hello),fail. hello hello hello …
  • 12.
  • 13.
  • 14. Co-routining and concurrency freeze(X,G) freeze(X,G), var(X), {ins(X)} => true. freeze(X,G) => call(G). ?-freeze(X,writeln(X)),X=f(a). f(a)
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. Propagator for A1*X1+...+An*Xn+C = 0 'A1*X1+...+An*Xn+C=0'(C,A1,A2,...,An,X1,X2,..,Xn), n_vars_gt(n,2), {generated,ins(X1),bound(X1),...,ins(Xn),bound(Xn)} => reduce domains of X1,..,Xn to achieve ic . 'A1*X1+...+An*Xn+C=0'(C,A1,A2,...,An,X1,X2,..,Xn) => nary_to_binary(NewC,B1,B2,Y1,Y2), call_binary_propagator(NewC,B1,Y1,B2,Y2). When the constraint contains more than 2 variables, achieve interval consistency. When the constraint becomes binary archive arc consistency.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29. Benchmarking CLP(FD) systems (As of Aug. 14, 2006) BP: B-Prolog 6.9 EP: Eclipse 5.8 #107 GP: Gnu-Prolog 1.2.16 SP: Sicstus-Prolog 3.12.5 CPU time, Windows XP Benchmarks: www.probp.com/bench.tar.gz
  • 30.
  • 31.
  • 32.
  • 33. An example CHR program reflexivity @ leq(X,X) <=> true. antisymmetry @ leq(X,Y), leq(Y,X) <=> X = Y. idempotence @ leq(X,Y) leq(X,Y) <=> true. transitivity @ leq(X,Y), leq(Y,Z) ==> leq(X,Z). simplification propagation simpagation
  • 34.
  • 35. Translating CHR into AR Example p(X):- gen_constr_num(Cno), Constr=constr(Cno,AliveP,HistoryP,X), get_channel(p_1_1,ChP), get_channel(q_1_1,ChQ), agent_p_1_1(ChP,AliveP,X), post_p_1(ChQ,Constr,AliveP,X). agent_p_1_1(ChP,AliveP,X),var(AliveP), {event(ChP,Q),ins(AliveP)} => Q=constr(_,AliveQ,HistoryQ,Y), (var(AliveQ)->AliveP=0,AliveQ=0,r(X,Y);true). agent_p_1_1(ChP,AliveP,X) => true. p(X),q(Y) <=> r(X,Y).
  • 36. CHR to AR Example (Cont.) post_p_1(ChQ,Constr,AliveP,X),var(AliveP), {generated,ins(X),ins(AliveP)} => post_event(ChQ,Constr). post_p_1(ChQ,Constr,AliveP,X) => true. p(X),q(Y) <=> r(X,Y).
  • 37. Benchmarking CHR compilers CPU time: milliseconds, Windows XP 453 1,765 6,843 zebra 640 1,125 6,532 primes 360 2,313 6,406 leq 3,250 Leuven (SWI) 109 938 fib AR (by hand) Leuven (B-Prolog) Program
  • 38.
  • 39.
  • 40. An example go:- cgButton(B,“Hello World!”), handleButtonClick(B), cgShow(B).   handleButtonClick(B), {actionPerformed(B)} => halt.
  • 41.
  • 42. Timers and time events go:- timer(T1,100), timer(T2,1000), ping(T1), pong(T2), repeat,fail.   ping(T),{time(T)} => writeln(ping). pong(T),{time(T)} => writeln(pong).  
  • 43.
  • 44.
  • 45. The implementation of AR (The ATOAM architecture) P code area X1 X2 ... Xn registers s AR stack heap trail H T TOP
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.