Title: Finite horizon optimization