Distance: Length of the path. Sum of the distance between nodes in the path.
Wind: Wind cost value that is a function of wind speed between nodes. Sum of wind cost per node-node segment.
Total Cost = Distance Cost + (wind_factor) * Wind Cost
wind_factor is a parameter to scale.
Let p0, p1, p2, ..., pn be the waypoints of the global path.
The distance cost is approximately invariant with respect to pathfinding resolution (how far apart each node is). If we double the resolution, the total distance is still the same.
Distance Cost = sum[ dist(pi, pi+1) ] for i = 0:n-1
The wind cost is not invariant with respect to pathfinding resolution. If we double the resolution, there will be about double as many node-node segments. Thus the wind cost will be approximately doubled. Ideally, this should be invariant.
Wind Cost = sum[ Wind_Cost_Function( (Wind_Speed(pi) + Wind_Speed(pi+1)) / 2) ] for i = 0:n-1
Wind_Cost_Function = https://www.desmos.com/calculator/md1byjfsl2
One possible solution is to scale each wind cost segment by the distance of the node-node segment. This way, doubling the resolution results in the wind cost being about the same.
ALSO: Average wind might not be the best thing to do here. What if one is 0 and one is 40 (both bad). Average is 20, which appears good... Could replace Wind_Cost_Function( (Wind_Speed(pi) + Wind_Speed(pi+1)) / 2) with (Wind_Cost_Function(Wind_Speed(pi)) + Wind_Cost_Function(Wind_Speed(pi+1))) / 2
Right now, we have 2 cost components.
Let p0, p1, p2, ..., pn be the waypoints of the global path.
The distance cost is approximately invariant with respect to pathfinding resolution (how far apart each node is). If we double the resolution, the total distance is still the same.
The wind cost is not invariant with respect to pathfinding resolution. If we double the resolution, there will be about double as many node-node segments. Thus the wind cost will be approximately doubled. Ideally, this should be invariant.
One possible solution is to scale each wind cost segment by the distance of the node-node segment. This way, doubling the resolution results in the wind cost being about the same.
ALSO: Average wind might not be the best thing to do here. What if one is 0 and one is 40 (both bad). Average is 20, which appears good... Could replace
Wind_Cost_Function( (Wind_Speed(pi) + Wind_Speed(pi+1)) / 2)
with(Wind_Cost_Function(Wind_Speed(pi)) + Wind_Cost_Function(Wind_Speed(pi+1))) / 2