Update README.md
This commit is contained in:
parent
c025e87fbb
commit
55f3d7a80d
36
README.md
36
README.md
@ -12,7 +12,41 @@ This repository have two different exercises in erlang:
|
||||
* The probability of making a medication/treatment 2 and staying OK is 62%;
|
||||
* The probability of making a medication/treatment 2 and getting KO is 38%.
|
||||
|
||||

|
||||
```
|
||||
|
||||
-module(engine).
|
||||
-compile([export_all]).
|
||||
|
||||
% Decision Tree
|
||||
%
|
||||
% +----+
|
||||
% +---> OK |
|
||||
% | +----+
|
||||
% |
|
||||
% +----------| +----+
|
||||
% | DO MED 1 +---> KO |
|
||||
% +----------+ +----+ +----+
|
||||
% | +---> OK |
|
||||
% | +---------------| +----+
|
||||
% +---> DO MED 2 +
|
||||
% +---------------| +----+
|
||||
% +---> KO |
|
||||
% +----+
|
||||
% Each edge can be calculated from the table
|
||||
|
||||
|
||||
doAll() ->
|
||||
T = dec_tree:start(),
|
||||
T ! {create_node, 'DO MED1', 0, none},
|
||||
T ! {create_node, 'MED1 OK', 0.980, 'DO MED1'},
|
||||
T ! {create_node, 'MED1 KO', 0.225, 'DO MED1'},
|
||||
T ! {create_node, 'DO MED2', 0.356, 'DO MED1'},
|
||||
T ! {create_node, 'MED 2 OK', 0.62, 'DO MED2'},
|
||||
T ! {create_node, 'MED 2 KO', 0.38, 'DO MED2'},
|
||||
T ! {solve}.
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user