A dynamic programming toolkit.