Skip to content

Instantly share code, notes, and snippets.

@alexbiehl
Last active December 5, 2017 19:10
Show Gist options
  • Save alexbiehl/1b77ee7483762f5759db108c7097aeeb to your computer and use it in GitHub Desktop.
Save alexbiehl/1b77ee7483762f5759db108c7097aeeb to your computer and use it in GitHub Desktop.
type Policy = State -> State
type Demand = State -> State
type Observation = (Demand, State)
eval :: State -> Policies -> Demands -> [State]
eval = ...
observations :: State -> State -> [Observation]
observations = ...
s0 :: State
s0 = ...
policies :: Policies
policies = ...
simulate :: Demands -> [Observation]
simulate demands =
let
run state demandSample =
let
state_series = eval state policies demandSample
in zipWith observations state_series (tail state_series)
in concat (map (run s0) demands `using` parList rdeepseq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment