| % problog_model.pl |
| % ProbLog program for infrastructure reliability. |
|
|
| % Dynamic facts (will be asserted from Python) |
| :- dynamic component/2, connected/2, depends/2. |
|
|
| % Failure rule for any component |
| failure(C) :- component(C, switch), fails(C). |
| failure(C) :- component(C, server), fails(C). |
| failure(C) :- component(C, service), fails(C). |
|
|
| % Propagation rules |
| failure(Serv) :- connected(Serv, Switch), failure(Switch). |
| failure(Serv) :- depends(Serv, Parent), failure(Parent). |
|
|
| % Prior probabilities (example) |
| 0.1 :: fails(switch-1). |
| 0.05 :: fails(server-1). |
|
|
| % Query |
| query(failure(X)). |