Let's say I have a matrix of values that represent heights with function $f(x,y)$ and I am trying to find the "lowest value path" beween two points. So this would be the reverse of hill climbing, as in optimization, taking gradient and following that etc, but in a way, I guess I need the anti-gradient - not the direction of steepest climb but the non-steepest walk.
I need this for a mapping application, I have elevation values on a grid and I am trying to find a path between those points that require minimum amt of climbing.
I guess I could create a cost function that gives highest values for high elevation + furthest points to destination + non-smoothness of paths, and do optimization on that. I was just wondering if anyone worked with such cost functions before, or there is another calculus trick I have to utilize.
Keywords: flattest route
This is an instance of a "shortest path" problem. Create a directed graph with vertex set equal to your grid points, and with a directed edge from $a$ to $b$ if $a$ and $b$ are adjacent, and give that edge weight $w(a,b)=\min(0,h(b)-h(a))$ where $h(a)$ is the elevation of $a$, and so on. (That is, the vertices are cells in your matrix, where the typical vertex has 4 neighbors: the cell to the North, the one to the South, etc. The edges represent things like "go North from this cell to its neighbor" and the weight is the climb associated with such a move.) Use one of the algorithms described in the link. Warning: some of these algorithms require intricate coding. (This weight function measures only uphill climb, which, as an occasional hiker I know is not necessarily the whole story about weariness of foot.)