I think I can account for clustered opportunities in a fairly precise way. I'm utilizing game "areas" which are defined by the game engine and correspond to continents or subcontinental regions (islands are in their own area). I make a simplifying assumption that travel time between opportunities in an area is 4 turns (w = 4) and then look ahead to four (o = 4) additional opportunities in this area adding their time discounted values. There is little extra processing overhead because the values were gotten in the initial target analyses anyway. This system does not account for nearby opportunities that happen to span two areas.
Here's the value calculation
from post #89, but now I'm calling it v':
v' = [b + r^(t - 1) * (i + p - r * (i + b))] / [r^(-g) - r^t]
Let's consider this with no travel time (g = 0), which I call v":
v" = [b + r^(t - 1) * (i + p - r * (i + b))] / [1 - r^t]
I'll break this further into numerator and denominator, so that I don't have to recalculate the whole equation for v' and v":
numerator = b + r^(t - 1) * (i + p - r * (i + b))
denominator = 1 - r^t
v' = numerator / (denominator + r^(-g) - 1)
v" = numerator / denominator
Numerator, denominator, v' and v" are going to be calculated for many potential target sites. These calculations can be super-optimized by pre-calculating r powers and holding them in an array (r[0] = 1, r[1] = r, r[2] = r^2, etc; r^(-2) is just 1/r[2]), so the calculations here are really trivial.
We want to add time-discounted value for the 2nd, 3rd, 4th and 5th best opportunities in the same area (o = 4 additional opportunities). Actually we already know which target the GP is going to first
if they are going to a particular area. It is the target in the area with the highest v'. Considering subsequent opportunities in that area, we don't want to use v' because g will likely be much less (once we are there). So we use v" and apply an ad hoc travel time (w = 4) between opportunities in the area. (It's too expensive to run additional pathing to get actual travel times between potential targets.) Our 2nd, 3rd, 4th and 5th best opportunities are just the 4 best targets in the area sorted by v" (excluding our initial target with the best v').
w = 4 -->estimated travel turns between opportunities within an area
g2 = g + t + w -->total turns before we get to opportunity #2 (where g and t are for the initial target)
g3 = g2 + t2 + w -->total turns before we get to opportunity #3
g4 = g3 + t3 + w -->total turns before we get to opportunity #4
g5 = g4 + t4 + w -->total turns before we get to opportunity #5
v2', v3', v4' and v5' are time-discounted versions of v2", v3", v4", v5" using g2, g3, g4, g5 (calculated as above). We only need to calculate this once for each area, so we get a time-discounted value for each area:
a = v2' + v3' + v4' + v5'
You can think of a as the marginal value for getting the GP to that area based on what it can do
after its first action is done. There is limited value in looking further than v5', since g6 would be at least 5 * (8 + 4) = 60. Then our final marginal value for each potential target is:
v = v' + a
Remember that a is an area boost, so it is going to be the same for all targets in an area. It could push us toward a really good area, but we still go to the best target in the area considering the individual target v' (which considers both v" and travel time to the individual target, g). With the heavy time-discounting on a, it is unlikely to push us off the continent we are currently on if there are any reasonable nearby opportunities. But it will certainly affect choice between two distant areas.
Keep in mind that v" (together with numerator and denominator above) is calculated for many potential targets anyway, so we are not adding much overhead. The major overhead in all of this is running a path out from the GP's current location to each potential target for g. But even that might be sped up by 2x or more using a mild heuristic for A* pathfinding.
Here's the pseudocode for the whole analysis: