-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample1.py
27 lines (20 loc) · 1.05 KB
/
example1.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
# appropriate imports
from columbus.simulator import FINESSE,STD,SKEWNESS,Simulator
from columbus.datatypes import Scalar, Normal, Skewed
# initiate simulator
sim = Simulator(int(1e4), 2e6) # simulator parameter specifies how fine grained the simulation will be, 1e4 is a reasonable value. 2e6 is the max memory consumption in [kb]
sim.start()
# usage of a normal distribution
chancePassengerBuysIceCream = Normal(sim, 0.05, 0.04)
# usage of a skewed distribution
numberOfPassingPeoplePerHour = Skewed(sim, 300, SKEWNESS.SMALL, 'right')
# usage of a scalar
numberOfHoursSelling = Scalar(sim, 8)
iceCreamsSoldPerHour = chancePassengerBuysIceCream.mul(numberOfPassingPeoplePerHour)
iceCreamsSoldPerHour = iceCreamsSoldPerHour.floor(0)
iceCreamsSoldTotal = iceCreamsSoldPerHour.mul(numberOfHoursSelling)
# plot the result
sim.plot(iceCreamsSoldTotal,'Number of sold icecreams','a label')
# end of simulation
sim.stop()
sim.report()