Dynamic programming forward approach