sd_prim_wcm.py

 1"""
 2Created on Feb 13, 2014
 3
 4This example demonstrates the use of PRIM. The dataset was generated
 5using the world container model
 6
 7(Tavasszy et al 2011; https://dx.doi.org/10.1016/j.jtrangeo.2011.05.005)
 8
 9
10"""
11
12import matplotlib.pyplot as plt
13
14from ema_workbench import ema_logging, load_results
15from ema_workbench.analysis import prim
16
17ema_logging.log_to_stderr(ema_logging.INFO)
18
19default_flow = 2.178849944502783e7
20
21
22def classify(outcomes):
23    ooi = "throughput Rotterdam"
24    outcome = outcomes[ooi]
25    outcome = outcome / default_flow
26
27    classes = outcome < 1
28    return classes
29
30
31fn = r"./data/5000 runs WCM.tar.gz"
32results = load_results(fn)
33
34prim_obj = prim.setup_prim(results, classify, mass_min=0.05, threshold=0.75)
35
36# let's find a first box
37box1 = prim_obj.find_box()
38
39# let's analyze the peeling trajectory
40box1.show_ppt()
41box1.show_tradeoff()
42box1.inspect_tradeoff()
43
44box1.write_ppt_to_stdout()
45
46# based on the peeling trajectory, we pick entry number 44
47box1.select(44)
48
49# show the resulting box
50prim_obj.show_boxes()
51prim_obj.boxes_to_dataframe()
52
53plt.show()