One of the oldest, general engineering approaches I use is to back up a step, and write out a problem, in words, with what you are trying to do.
So, my idea for you is write out, and diagram if needed, the problem you are trying to solve.
Then, once you have articulated the problem, you can start sequencing this into grasshopper.
Using your example above, start simple. Decide how to solve your original problem, “cost”, get that working, then you can start on the next parameter.
To keep it simple, assuming that each segment of your road has a constant “cost / unit length” then you can multiple your cost/foot, or per meter, by the length of the curve (L, one of the outputs from shortest walk component).