Αποστολή με SMS: Dynamic programming and its application to optimal control