forked from quaquel/EMAworkbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_python.py
32 lines (22 loc) · 950 Bytes
/
example_python.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
Created on 20 dec. 2010
This file illustrated the use the EMA classes for a contrived example
It's main purpose has been to test the parallel processing functionality
.. codeauthor:: jhkwakkel <j.h.kwakkel (at) tudelft (dot) nl>
"""
from ema_workbench import Model, RealParameter, ScalarOutcome, ema_logging, perform_experiments
def some_model(x1=None, x2=None, x3=None):
return {"y": x1 * x2 + x3}
if __name__ == "__main__":
ema_logging.LOG_FORMAT = "[%(name)s/%(levelname)s/%(processName)s] %(message)s"
ema_logging.log_to_stderr(ema_logging.INFO)
model = Model("simpleModel", function=some_model) # instantiate the model
# specify uncertainties
model.uncertainties = [
RealParameter("x1", 0.1, 10),
RealParameter("x2", -0.01, 0.01),
RealParameter("x3", -0.01, 0.01),
]
# specify outcomes
model.outcomes = [ScalarOutcome("y")]
results = perform_experiments(model, 100)