prolog中的符号传播算法

时间:2011-02-08 04:13:10

标签: algorithm prolog

我是prolog的新手。我已经了解了概率推理的定性概率网络(QPN)。 QPN是一组统计变量中概率影响的图形模型,其中每个影响与定性符号相关联。 QPN中用于推理的算法是符号传播算法,如下所示:

输入:定性概率网络,Q

输出:证据节点O对网络中每个节点的影响的标志

procedure PropagateObservation(Q, O, sign, Observed):
for each Vi  ϵ V (G)
do sign [Vi]   ← ‘0’;
PropagateSign (Ø, O, sign).

procedure PropagateSign(trail, to, messagesign):
sign[to] ← sign [to]        messagesign;     *//update the sign of to
trail ← trail     {to};  *// add to to the set of visited nodes
for each active neighbour Vi of  to  given {O}      Observed 
do linksign ← sign of (induced) influence between to and Vi;
    messagesign ← sign [to]      linksign;
    if Vi  ϵ  trail and sign [Vi] ≠  sign [Vi]        messagesign
    then PropagateSign (trail, Vi, messagesign).

V =变量/节点 O =证据节点

这个算法适用于定性符号乘法和加法表(对不起,我有问题把这些表放在这里)。 我想在prolog中编写这个算法(我现在使用swi-prolog)。不幸, 我不知道如何开始在prolog中编程这个算法,因为我是一个新手,不知道它是否可以在prolog中编程。如果我的问题不是很明确,我很抱歉。请告诉我是否需要解释更多。也许你们所有人的粗略想法可能有所帮助。谢谢你。

1 个答案:

答案 0 :(得分:1)

您可能需要查看Ivan Bratko ISBN-13:978-0-20140-375-6的Prolog Programming for Artificial Intelligence一书。第20章是关于定性推理的主题。该书的配套网站http://www.pearsoned.co.uk/highereducation/resources/bratkoprologprogrammingforartificialintelligence3e/具有在线提供的示例程序。您可以从查看这些程序开始,了解他如何在prolog中实现定性推理(尽管不是特别是QPN)。