Sampling-based Dynamic Optimization: Theory, Analysis and Applications