Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:rule_interpreter_certainty [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Rule interpreter certainty ======
 +{{tag>​rules interpreter}}
 +===== Description =====
 +An interpreter for rules with certainties.
 +
 +**Source**: ​ PROLOG programming for artificial intelligence,​ 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7.
 +===== Download =====
 +Program source code: {{rule_interpreter_certainty.pl}}
 +===== Listing =====
 +<code prolog>
 +% Figure 15.9  An interpreter for rules with certainties.
 +
 +:-  op( 800, fx, if).
 +:-  op( 700, xfx, then).
 +:-  op( 300, xfy, or).
 +:-  op( 200, xfy, and).
 +
 +% Rule interpreter with certainties
 +
 +% certainty( Proposition,​ Certainty)
 +
 +certainty( P, Cert)  :-
 +   ​given( P, Cert).
 +
 +certainty( Cond1 and Cond2, Cert)  :-
 +   ​certainty( Cond1, Cert1),
 +   ​certainty( Cond2, Cert2),
 +   min( Cert1, Cert2, Cert).
 +
 +certainty( Cond1 or Cond2, Cert)  :-
 +   ​certainty( Cond1, Cert1),
 +   ​certainty( Cond2, Cert2),
 +   max( Cert1, Cert2, Cert).
 +
 +certainty( P, Cert)  :-
 +   if Cond then P : C1,
 +   ​certainty( Cond, C2),
 +   Cert is C1 * C2.
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/rule_interpreter_certainty.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0