首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到17条相似文献,搜索用时 140 毫秒
1.
Visual Prolog的搜索控制机制分析   总被引:8,自引:0,他引:8  
回溯机制是逻辑程序设计的重要设施。回溯本身是一种获得目标所有可能解的良好方法。然而回溯也有副作用,一是它可能导致Visual Prolog给出多余的答案,而Visual Prolog自己不能区分实质上相同的两个解,因此会降低效率;二是尽管一个特殊的目标已被满足,但是回溯机制可能还会强迫Visual Prolog继续手找另外的解,因此会增加系统开销。在这些情况下,必须仔细控制目标搜索求解的回溯过程。本文在揭示Visual Prolog回溯机制所存在问题的基础上,通过实例,对Visual Prolog的静态截断机制、失败谓词fail与否定谓词not等控制谓词,以及动态截断机制等所构成的完整的目标搜索求解控制机制进行了详细分析,从而揭示出回溯机制和搜索求解控制机制的本质特性及应用机理。  相似文献   

2.
徐彤  雷英杰  谢波  李松 《计算机工程》2005,31(22):192-193
阐明了Visual Prolog中确定性管理机制的目的和方法,归纳了编写确定性和非确定性谓词的基本原则,通过对代码示例中回溯和截断机制的详细分析,给出了结论。  相似文献   

3.
Visual Prolog语言是人工智能与专家系统领域最著名的逻辑程序设计语言,适合表达人的思维和推理规则,能够方便地实现模式匹配、回溯、事实数据库和谓词等功能;针对导弹测试设备结构复杂、故障隔离与定位困难等情况,充分利用Visual Prolog语言在专家系统知识表示及逻辑推理过程中的优点,建立了一个基于规则的导弹测试设备故障诊断专家系统;通过应用表明Visual Prolog语言十分适合构建此类专家系统,并具有良好的开发应用前景.  相似文献   

4.
有效的Prolog编译实现方法   总被引:1,自引:0,他引:1  
本文从实现的角度讨论了几种有效的Prolog编译技术,包括一个有效的抽象指令集、子句选择回溯,以及可插入子句的内部谓词assert a/z的实现方法.这些技术已被应用到在VAX机上开发的Prolog编译系统中.  相似文献   

5.
1.前言prolog 这个名词是由 Program 和 logic 合成而来的。顾名思义,它是以一阶谓词逻辑为基础的语言。用 Prolog 编程序有的叫programming in logic,或 logic programm-ing,这两个术语比 Prolog 语言的适用范围略微广泛一些。不管怎么叫法,反正 Prolog的最大特点都是与 logic 密切相关的。Prolog 的其它特点,还有:(1)模式匹配功能(2)自动回溯功能(3)有灵活性,其参数对于过程的输  相似文献   

6.
陈东方  王诚 《福建电脑》2005,(8):117-118
货郎担问题是一个典型的易于描述却难以处理地NP完全问题。而Visual Prolog语言的匹配合一、递归和回溯等特点非常适合求解这类问题。本文利用Visual Prolog实现了简单的货郎担问题。  相似文献   

7.
Turbo Prolog 的动态数据库,是相对于静态数据库而言的。对于静态数据库,事实和规则都放进程序,一旦程序编译完毕,知识便被“冻结”起来,要想改动事实和规则,就要重新编辑和编译。这些知识,在程序执行期间,并不变化。而动态数据库,一开始常为空的,在程序执行期间逐渐积累信息,所以也叫暂存器。一、用动态数据库为全局变量储存信息Prolog 语言中,变量总是属于某一具体谓词的具体子句中,与其它的语言不同,Prolog 中的变量不是属于全部程序的。但,有时却需要建立全局变量,以便几个谓词都可使用。例如,有时为了操作文件方便,想定义一个缺省驱动器,一旦定义,便可适用于整个程序。例1,用 var 数据库谓词储存所有的全局变量。此谓词有两个自变量:全局变量的名字和其值。例1表明,可用  相似文献   

8.
Godel语言是在Prolog语亩基础上发展而来的一种新型逻辑程序设计语言,而控制机制是逻辑程序设计语言的核心内容.针对Prolog语言控制机制存在的问题,引出了Godel语言中新的控制机制,包括DELAY延迟机制和剪枝操作然后通过实例分析,表明了这些新机制能有效地避免递归谓词的低效或无限循环调用,并能够实现子目标的协同执行,从而提高系统的运行效率.针对这一有效改进,在对Godel语言控制机制比较深入研究的基础上,最后给出了Godel语言控制机制的实现算法.该算法已在研发的Godel语言编译系统中得以实现,通过实例测试,验证了算法具有较高的效率.  相似文献   

9.
冯林  柴红霞  孙焘  殷志远 《计算机工程》2011,37(17):185-187,196
针对当前多数SLAM数据关联算法存在不能在线修正的问题,提出一种使用动态阈值的启发式图搜索数据关联算法.该方法使用回溯机制实现对错误数据的修正,在搜索过程中使用动态阈值进行门限过滤,减少可能的数据关联的数目,在不降低数据关联正确率的情况下,提高数据关联效率.仿真实验结果表明,该算法可有效地降低运算时间.  相似文献   

10.
本文分析和讨论了在多Transputer环境中,如何扩充Prolog语言成为CS—Prolog,使之保持回溯机制,适应并行特点。  相似文献   

11.
The added functionality such as contour tracking and corner detection which logic programming lends to standard image operators is described. An environment for implementing low-level imaging operations with Prolog predicates is considered. Within this environment, higher-level image predicates (contour tracking and corner detection) are constructed. The emphasis is not on building better corner detectors, but on presenting ways of using the unification and backtracking features of logic programming for these tasks. The performance of this implementation of contour tracking and corner detection has been very good in many more complex images, as it allows for feedback both ways between sensor input and symbolic models. More important is the parameter selection capability in a dynamic version where background properties change. The authors present examples of Prolog predicates for performing the contour and corner detection operations  相似文献   

12.
We propose a visual computation model called theBox and Plane Model (BPM), which visually clarifies the semantics of backtracking, the cut operator, and side-effects, thus allowing the procedural features of Prolog to be grasped. On the bases of the BPM, we developed a visual debugger for Prolog, PROEDIT2, which has proved that this kind of pragmatic computation model for Prolog increases the efficiency of the debugging work.  相似文献   

13.
本文提出一种支持PROLOG程序并行执行的智能回溯机制,它是基于数据相关性分析的动静结合的智能回溯策略,在静态编译时通过相关性分析产生各子目标带条件的智能回溯点集合,动态执行时通过对变量的简单测试及对当前运行结果的简单测试来确定当前失败目标的最佳回溯点。  相似文献   

14.
The ET* algorithm is a complete evaluation strategy for Datalog programs, which are logic programs without function symbols. The ET* algorithm uses extension tables and depth-first iterative deepening to provide the evaluation of pure function-free logic programs as declarative specifications. Extension tables are a memo facility that the algorithm uses both to cut infinite derivation paths for complete evaluation and to optimise the evaluation of logic programs. The original implementation of the ET* algorithm incorporated extension tables as part of the Prolog database using the built-in predicates assert and retract. The advantage of implementing the extension table using the Prolog database is the portability of the ET* algorithm. There are several disadvantages, however, with this approach. One disadvantage is the cost associated with the built-in predicates assert and retract, which are known to be expensive operations in most current Prolog systems. Another disadvantage is the differences across implementations in the semantics that these built-ins provide for dynamic predicates. This paper presents an efficient implementation of extension tables as a global data structure in Prolog, which includes a set of built-in primitives for manipulating the extension table. The ET* algorithm is updated to reflect the utilisation of the global extension table data structure. The implementations of the ET* algorithm are compared using time and space performance on a variety of benchmark programs.  相似文献   

15.
We present the implementation of a Prolog system composed of interpreter and compiler. The originality of our work consists in the adoption of a new framework to realize the main components of the system. The framework relies on new mechanisms, called sleepers. With their help we have developed a complete Prolog interpreter in which all the control activities, from backtracking up to last-call optimization, are performed by the sleeper mechanism. We have also produced a Prolog compiler by using a philosophy and tactics that are completely independent of hardware constraints; it exploits an incremental and abstract implementation technique, based on a delayed non-local execution protocol. Our approach to Prolog system implementation has been extremely useful both in terms of software design and overall performance.  相似文献   

16.
Abstract

A knowledge-based scheduling system has been developed for the domain of university class scheduling. The problem addressed is how to schedule courses during the various time periods throughout the day. The class schedule must satisfy a variety of appropriate constraints. The system, written in Prolog, resolves conflicting assignments through backtracking. The inefficiency of Prolog's backtracking feature, with respect to this application, is partly circumvented by the use of a dynamic circular array. The system is now being used to help schedule industrial engineering classes at the Pennsylvania State University.  相似文献   

17.
Corecursion is the ability of defining a function that produces some infinite data in terms of the function and the data itself, as supported by lazy evaluation. However, in languages such as Haskell strict operations fail to terminate even on infinite regular data, that is, cyclic data.Regular corecursion is naturally supported by coinductive Prolog, an extension where predicates can be interpreted either inductively or coinductively, that has proved to be useful for formal verification, static analysis and symbolic evaluation of programs.In this paper we use the meta-programming facilities offered by Prolog to propose extensions to coinductive Prolog aiming to make regular corecursion more expressive and easier to program with.First, we propose a new interpreter to solve the problem of non-terminating failure as experienced with the standard semantics of coinduction (as supported, for instance, in SWI-Prolog). Another problem with the standard semantics is that predicates expressed in terms of existential quantification over a regular term cannot directly defined by coinduction; to this aim, we introduce finally clauses, to allow more flexibility in coinductive definitions.Then we investigate the possibility of annotating arguments of coinductive predicates, to restrict coinductive definitions to a subset of the arguments; this allows more efficient definitions, and further enhance the expressive power of coinductive Prolog.We investigate the effectiveness of such features by showing different example programs manipulating several kinds of cyclic values, ranging from automata and context free grammars to graphs and repeating decimals; the examples show how computations on cyclic values can be expressed with concise and relatively simple programs.The semantics defined by these vanilla meta-interpreters are an interesting starting point for a more mature design and implementation of coinductive Prolog.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号