numtri: typical dynamic programming