Finding path with minimum weight
I'm sure someone will manage to come up with a more efficient idea, but here's a basic one:


Have both sides of the river be nodes in the graph. Define the disk used for these nodes as having 0 cost and 0 radius.
Split each pile into B nodes in the graph, one for each type of disk.
Connect each pair of nodes where the sum of the radius of the 2 disks of these nodes is less than or equal to the distance between the nodes.
Define the cost of an edge as the cost of the disk of the destination node. The cost of the source node will already have been included in the previous step.
Note that this should be dynamically calculated - one can approach an edge from either side, thus it can take on the value of either node, thus could have different costs at different times.
Run Dijkstra's algorithm as per usual from the source side of the river.


One can get a more efficient but more complex algorithm by only having a single node for each pile and storing the radius of the chosen disk at each point.

Note that any disk type A with cost cA and radius rA can be discarded if there exists a disk type B with radius rB >= rA and cost cB &lt;= cA, or, equivalently, if there's a bigger and cheaper disk type, since it would always be more efficient to use that one instead.