diff --git a/README.md b/README.md index 426cabf..30ef716 100644 --- a/README.md +++ b/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%. -![alt text](https://i.postimg.cc/5207cpvs/Captura-de-ecr-2019-04-09-s-13-06-01.png) +``` + +-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}. + + +```