From 55f3d7a80de749d27b977fd53ee0f71459b20f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= Date: Thu, 9 May 2019 09:10:31 -0700 Subject: [PATCH] Update README.md --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) 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}. + + +```