欢迎来到麦多课文档分享! | 帮助中心 海量文档,免费浏览,给你所需,享你所想!
麦多课文档分享
全部分类
  • 标准规范>
  • 教学课件>
  • 考试资料>
  • 办公文档>
  • 学术论文>
  • 行业资料>
  • 易语言源码>
  • ImageVerifierCode 换一换
    首页 麦多课文档分享 > 资源分类 > PPT文档下载
    分享到微信 分享到微博 分享到QQ空间

    Tabled Prolog and Linear Tabling.ppt

    • 资源ID:389596       资源大小:185KB        全文页数:20页
    • 资源格式: PPT        下载积分:2000积分
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    二维码
    微信扫一扫登录
    下载资源需要2000积分(如需开发票,请勿充值!)
    邮箱/手机:
    温馨提示:
    如需开发票,请勿充值!快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如需开发票,请勿充值!如填写123,账号就是123,密码也是123。
    支付方式: 支付宝扫码支付    微信扫码支付   
    验证码:   换一换

    加入VIP,交流精品资源
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Tabled Prolog and Linear Tabling.ppt

    1、Linear Tabling,1,Tabled Prolog and Linear Tabling,Neng-Fa Zhou (City Univ. of New York) Yi-Dong Shen (Chinese Academy of Sciences) Taisuke Sato (Tokyo Inst. of Technology),Linear Tabling,2,Tabling is Useful,Eliminate infinite loops path(X,Y):-edge(X,Y). path(X,Y):-edge(X,Z),path(Z,Y). Reduce redunda

    2、nt computations fib(0,1). fib(1,1). fib(N,F):-N1, N1 is N-1,fib(N1,F1), N2 is N-2,fib(N2,F2), F is F1+F2.,Linear Tabling,3,Tabling in OLDT (SLG-WAM),A.,A.,.,producer,consumer,suspend/resume Complicate implementation freeze stacks overhead on standard programs garbage collection,table,A is suspended

    3、after the existing answers are exhausted,Linear Tabling,4,Linear Tabling,A.,A.,.,pioneer,follower,table,A fails or becomes a producer after consuming existing answersA needs to be re-evaluated in some cases,Advantages Easy to implement Space efficient Overhead-free Disadvantage Re-computation Optimi

    4、zations Subgoal optimization Semi-nave evaluation,Linear Tabling,5,The Linear Tabling Framework,Augmented programs,p(X,Y):-p(X,Z),e(Z,Y),memo(p(X,Y). p(X,Y):-e(X,Y),memo(p(X,Y). p(X,Y):-check_completion(p(X,Y).,p(X,Y):-p(X,Z),e(Z,Y). p(X,Y):-e(X,Y).,Linear Tabling,6,The Linear Tabling Framework (con

    5、t.),table_start(A) Executed when a tabled subgoal A is encountered memo(A) Executed when a clause succeeds check_completion(A) Executed after all clauses have been tried.,Linear Tabling,7,Definitions,Loops, pioneers and followers,A derivation GiGj forms a loop if Gi=(A,) and Gj=(A,) A and A are vari

    6、ants A is an ancestor of A Subgoal A is called a pioneer and A is called a follower of A.,Linear Tabling,8,Definitions (cont.),Top-most looping nodes and subgoalsA node in an SLD-tree is called a top-most looping node if the selected subgoal of the node is the pioneer of a loop that is not contained

    7、 in any other loops.,Linear Tabling,9,A Linear Tabling Method,table_start(A) If A is complete, resolve A by using answers. If A is a pioneer, register A and resolve A by using program clauses. If A is a follower, resolve A by using answers and fail A after all existing answers are exhausted.,Linear

    8、Tabling,10,A Linear Tabling Method (cont.),memo(A) Add A into the table and fail.,Linear Tabling,11,A Linear Tabling Method (cont.),check_completion(A) If A has never occurred in a loop, complete A and resolve A by using the answers. If A is a top-most looping subgoal If no new answer was produced i

    9、n the last round, then complete A and resolve A by using the answers Otherwise, start a new round of evaluation of A. If A is a looping subgoal but not a top-most one Set As state to temporary complete and resolve A by using the answers,Linear Tabling,12,Example,p(X,Y):-p(X,Z),e(Z,Y),memo(p(X,Y). (p

    10、1) p(X,Y):-e(X,Y),memo(p(X,Y). (p2) p(X,Y):-check_completion(p(X,Y). (p3)e(a,b). (e1) e(b,c). (e2),1. p(a,Y0).,2. p(a,Z1), e(Z1,Y0), memo(p(a,Y0).,3. e(a,Y0), memo(p(a,Y0).,4. memo(p(a,b).,5. check_comp(p(a,Y0).,First round,p1,p2,e1,p3,program,Linear Tabling,13,1. p(a,Y0).,6. p(a,Z1), e(Z1,Y0), memo

    11、(p(a,Y0).,10. check_comp(p(a,Y0).,Second round,p1,p3,7. e(b,Y0), memo(p(a,Y0).,8. memo(p(a,c).,use p(a,b),e2,9. e(c,Y0), memo(p(a,Y0).,use p(a,c),p(X,Y):-p(X,Z),e(Z,Y),memo(p(X,Y). (p1) p(X,Y):-e(X,Y),memo(p(X,Y). (p2) p(X,Y):-check_completion(p(X,Y). (p3) e(a,b). (e1) e(b,c). (e2),p(a,b).,program,t

    12、able,p2,p(a,b). p(a,c).,Linear Tabling,14,Characteristics of the Method,Fixpoints are computed by iterating the evaluation of top-most looping subgoals Followers consume answers only Pioneers consume answers lazily Top-most looping subgoals consume answers after they are complete Other looping subgo

    13、als consume answers after all clauses have been tried,Linear Tabling,15,Adopted and Related Tabling Strategies,Lazy answer consumption Local scheduling strategy in SLG-WAM Freire96 What to do after a follower consumes all available answers? Steals the pioneers choice pointer Zhou00 Fails the followe

    14、r Guo & Gupta 01 Where to start re-computation? At the top-most looping subgoal Shen98 At every looping subgoal Guo01,Linear Tabling,16,Strengths and Weaknesses,Lazy answer consumption is suitable for all-solution search A basic operation used in PRISM Not suitable for single-solution search or prog

    15、rams with cuts For the query, once(p(X), all solutions are computed even though only one is needed.,Linear Tabling,17,Optimization Techniques,Subgoal Optimization In each round of evaluation of a top-most looping subgoal, each subgoal needs to be evaluated only once. Semi-nave Optimization Mimic the

    16、 semi-nave technique in bottom-up evaluation: at least one new answer is involved in the join of answers for each rule.,Linear Tabling,18,Semi-nave Evaluation in Linear Tabling,Let H:-A1,Ak,An be a rule where Ak is the last dependent subgoal of H. For a subgoal C of H, it is safe for Ak to consume o

    17、nly new answers if: 1. C has occurred in an early round 2. No subgoal Ai (ik) has consumed a new answer.,Linear Tabling,19,Performance Evaluation,BP vs. XSB (CPU time),BP vs. XSB (Stack space),Linear Tabling,20,Papers,N.F. Zhou, Y.D. Shen, L. Yuan, and J. You: A Linear Tabling Mechanism, The Journal

    18、 of Functional and Logic Programming, 2001. N.F. Zhou and T. Sato: Efficient Fixpoint Computation in Linear Tabling, ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP), pp.275-283, 2003. N.F. Zhou, Y. Shen, and T. Sato: Semi-naive Evaluation in Linear Tabling, ACM PPDP, pp.90-97, 2004.,


    注意事项

    本文(Tabled Prolog and Linear Tabling.ppt)为本站会员(unhappyhay135)主动上传,麦多课文档分享仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知麦多课文档分享(点击联系客服),我们立即给予删除!




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1 

    收起
    展开