This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import random | |
import simpy | |
def visitor(name, env, coffee_process, coffee_supply, mug_size, waittimes): | |
print("%s arriving at coffee station at %.1f" % (name, env.now)) | |
with coffee_process.request() as req: | |
start = env.now | |
# Request coffee_supply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION weighted_stddev_state(state numeric[], val numeric, weight numeric) RETURNS numeric[3] AS | |
$$ | |
BEGIN | |
IF weight IS NULL OR val IS NULL | |
THEN RETURN state; | |
ELSE RETURN ARRAY[state[1]+weight, state[2]+val*weight, state[3]+val^2*weight]; | |
END IF; | |
END; | |
$$ | |
LANGUAGE plpgsql; |