Efficient algorithms of pathwise dynamic programming for decision optimization in mining operations