Spaces:
Runtime error
Runtime error
Create problog_model.pl
Browse files- problog_model.pl +19 -0
problog_model.pl
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
% problog_model.pl
|
| 2 |
+
% Component facts (will be asserted dynamically)
|
| 3 |
+
:- dynamic component/2, depends/2, connected/2.
|
| 4 |
+
|
| 5 |
+
% Failure rules
|
| 6 |
+
failure(C) :- component(C, switch), fails(C).
|
| 7 |
+
failure(C) :- component(C, server), fails(C).
|
| 8 |
+
failure(C) :- component(C, service), fails(C).
|
| 9 |
+
|
| 10 |
+
% Propagation
|
| 11 |
+
failure(Serv) :- connected(Serv, Switch), failure(Switch).
|
| 12 |
+
failure(Serv) :- depends(Serv, Parent), failure(Parent).
|
| 13 |
+
|
| 14 |
+
% Probabilistic facts (priors)
|
| 15 |
+
0.1 :: fails(switch-1).
|
| 16 |
+
0.05 :: fails(server-1).
|
| 17 |
+
|
| 18 |
+
% Query
|
| 19 |
+
query(failure(X)).
|