Finished optim_sampling_demo code.