An exact dynamic programming approach to segmented isotonic regression