如何使用 Swi-Prolog 为专家系统创建元规则和/或元解释器 [英] how to create Meta-rules and/or meta-interpreter for an Expert System with Swi-Prolog

查看:17
本文介绍了如何使用 Swi-Prolog 为专家系统创建元规则和/或元解释器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 SWI-Prolog 创建一个带有元解释器的专家系统......什么是最好和更简单的方法?制作它的程序是什么?

I wanna create an expert system with meta-interpreter with SWI-Prolog... what is the best and the easier way to make it? which is the procedure to make it?

推荐答案

许多专家系统的元解释器都是基于所谓的香草解释器.这是一个口译员Prolog 没有剪辑和没有内置插件.内容如下:

Many of the meta-interpreters for expert systems are based on the so called vanilla interpreter. This is an interpreter for Prolog without cut and without built-ins. it reads as follows:

solve(true) :- !.
solve((A,B)) :- !, solve(A), solve(B).
solve(H) :- clause(H,B), solve(B).

您可以轻松使用它来解决以下知识库和查询.在一些Prolog系统中,ISO越兼容的系统,你需要将谓词标记为动态的,以便clause/2可以找到它们:

You can readily use it to solve the following knowledge base and query. In some Prolog systems, the more ISO compatible ones, you need to mark the predicates dynamic, so that clause/2 can find them:

pet(dog):- size(medium), noise(woof).
pet(cat):- size(medium), noise(meow).
pet(mouse):- size(small), noise(squeak).
size(medium).
noise(meow).

?- solve(pet(X)).
X=cat

从原版解释器开始,您可以添加各种专家系统之类的功能:

Starting from the vanilla interpreter you can add various expert system like features:

  • 知识获取
  • 解释
  • 确定性因素
  • 前向链接
  • 框架表示
  • 等等……

再见

P.S.:下面的书展示了如何:http://www.amzi.com/ExpertSystemsInProlog/

P.S.: The following book shows how: http://www.amzi.com/ExpertSystemsInProlog/

这篇关于如何使用 Swi-Prolog 为专家系统创建元规则和/或元解释器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆