Dynamic programming : a practical introduction