| % problog_model.pl | |
| % Component facts (will be asserted dynamically) | |
| :- dynamic component/2, depends/2, connected/2. | |
| % Failure rules | |
| failure(C) :- component(C, switch), fails(C). | |
| failure(C) :- component(C, server), fails(C). | |
| failure(C) :- component(C, service), fails(C). | |
| % Propagation | |
| failure(Serv) :- connected(Serv, Switch), failure(Switch). | |
| failure(Serv) :- depends(Serv, Parent), failure(Parent). | |
| % Probabilistic facts (priors) | |
| 0.1 :: fails(switch-1). | |
| 0.05 :: fails(server-1). | |
| % Query | |
| query(failure(X)). |