|
|
pl:prolog:pllib:uncertaint_reasoning [2019/06/27 15:50] |
pl:prolog:pllib:uncertaint_reasoning [2019/06/27 15:50] (aktualna) |
| ====== Uncertaint reasoning ====== |
| {{tag>cut recursion}} |
| ===== Description ===== |
| Reasoning with uncertainty with threshold cutoff |
| |
| **Source**: The Art of Prolog |
| ===== Download ===== |
| Program source code: {{uncertaint_reasoning.pl}} |
| ===== Listing ===== |
| <code prolog> |
| /* |
| solve(Goal,Certainty,Threshold) :- |
| Certainty is our confidence, greater than threshold, that Goal is true. |
| */ |
| solve(true,1,T) :- !. |
| solve((A,B),C,T) :- !, |
| solve(A,C1,T), solve(B,C2,T), minimum(C1,C2,C). |
| solve(A,1,T) :- builtin(A), !, A. |
| solve(A,C,T) :- |
| clause_cf(A,B,C1), C1 > T, T1 is T/C1, |
| solve(B,C2,T1), C is C1 * C2. |
| |
| minimum(X,Y,X) :- X =< Y, !. |
| minimum(X,Y,Y) :- X > Y, !. |
| |
| % Program 17.10 Reasoning with uncertainty with threshold cutoff |
| </code> |
| ===== Comments ===== |
| |