Dynamic Optimal Asset Allocation With Optimal Stopping