Approximate Inference for Stochastic Planning in Factored Spaces