A Functional Optimization Approach to Stochastic Process Sampling