Spaces:
Runtime error
Runtime error
Create problog_model.pl
Browse files- problog_model.pl +7 -5
problog_model.pl
CHANGED
|
@@ -1,17 +1,19 @@
|
|
| 1 |
% problog_model.pl
|
| 2 |
-
%
|
| 3 |
-
:- dynamic component/2, depends/2, connected/2.
|
| 4 |
|
| 5 |
-
%
|
|
|
|
|
|
|
|
|
|
| 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 |
-
%
|
| 15 |
0.1 :: fails(switch-1).
|
| 16 |
0.05 :: fails(server-1).
|
| 17 |
|
|
|
|
| 1 |
% problog_model.pl
|
| 2 |
+
% ProbLog program for infrastructure reliability.
|
|
|
|
| 3 |
|
| 4 |
+
% Dynamic facts (will be asserted from Python)
|
| 5 |
+
:- dynamic component/2, connected/2, depends/2.
|
| 6 |
+
|
| 7 |
+
% Failure rule for any component
|
| 8 |
failure(C) :- component(C, switch), fails(C).
|
| 9 |
failure(C) :- component(C, server), fails(C).
|
| 10 |
failure(C) :- component(C, service), fails(C).
|
| 11 |
|
| 12 |
+
% Propagation rules
|
| 13 |
failure(Serv) :- connected(Serv, Switch), failure(Switch).
|
| 14 |
failure(Serv) :- depends(Serv, Parent), failure(Parent).
|
| 15 |
|
| 16 |
+
% Prior probabilities (example)
|
| 17 |
0.1 :: fails(switch-1).
|
| 18 |
0.05 :: fails(server-1).
|
| 19 |
|