[Freeciv-Dev] Re: (PR#7249) Auto settlers don't irrigate or mine
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7249 >
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7249 >
>
> I made a patch based on my post above, so I'd better explain what
> exactly my math is.
>
> if:
> b = difference in improvement value
> m = discount per turn, defined in amortize() as (MORT-1)/MORT
> t = time to create improvement
> a = amortized value of one time payment after t
> v = total value
>
> then a = bm^t
>
> however this isn't quite right, since the value is paid every turn
> thereafter, so v = bm^t + bm^(t+1) + bm^(t+2) + ...
>
> we can factor this into v = bm^t ( 1 + m + m^2 + m^3 + ... )
>
> and the sum of the infinite series (1 + m + m^2 + m^3 + ... ) is equal
> to 1 / (1 - m), assuming m<1.
>
> and so the final value of v is a / (1 - m), which is in the patch.
>
> The patch also includes the "if extra == -1, extra = 0" clause.
But...
If the value is judged to be less than the value of maintaining the
settlers, then the settlers are released from autosettler mode.
Presumably the autosettler code is recommending that we disband them or
use them to build a city.
But this is often wrong, and it's because the calculation (even with the
above chance) leaves out one crucial factor: the autosettlers can keep on
improving land.
See, in the above situation the autosettlers have to travel a goodly
distance to get to where they're going, then improve some land. Because
they spend a lot of time traveling the value of the improved land drops.
The above calculation improves the value of the improved land in an
accurate way. But what it doesn't take into account is that once we get
to the new location, we can probably improve lots of land. So the cost of
the travel time is distributed not just over the first improvement but
also over all the others.
This could be modeled by adding on further improvements at a similar rate.
We can assume that the time-to-build and increased value of the land will
be no better than that of the initial improvement. But skipping the
travel time, we can add on further improvements at a similar rate.
b = difference in improvement value
m = discount per turn, defined in amortize() as (MORT-1)/MORT
t = time to create improvement
a = amortized value of one time payment after t
v = total value
A = total ammortized value of improvement
w = time spent actually working (as opposed to travel)
a = bm^t
A = bm^t / (1 - m)
w = A + A(m^w) + A(m^2w) + A(m^3w) + ...
= A(1 + m^w + m^2w + m^3w + ...)
= A / (1 - m^w)
= bm^t / ((1 - m) (1 - m^w))
-jason
- [Freeciv-Dev] Re: (PR#7249) Auto settlers don't irrigate or mine,
Jason Short <=
|
|