[Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
It can be further reduced to:
cost = (amortized * weight) / (MAX(0, weight - amortized));
except that you are incurring round-off error from amortized results
in cost being 1 less (integer-wise) than with the old formula.
Not knowing how round-off was playing a part in the previous
heuristic, I can't common on which cost is better.
Cheers,
cjr
> > weight = (POLLUTION_WEIGHTING + pplayer->ai.warmth) * 64;
> Not entirely sure. Appears as some kind of combination of rescaling factor and
> yet another heuristic constant to me, but I need Ross' opinion here. I really
> have no idea why it's there, as it appears to me that:
>
> weight = (POLLUTION_WEIGHTING + pplayer->ai.warmth) * 64;
> int amortized = amortize(weight, 100 / pcity->pollution);
> cost = ((amortized * weight) / (MAX(1, weight - amortized))) / 64;
>
> is equivalent to
>
> weight = (POLLUTION_WEIGHTING + pplayer->ai.warmth);
> int amortized = amortize(weight, 100 / pcity->pollution);
> cost = (amortized * weight * 64 * 64) / (MAX(1, (weight * 64) - (amortized
> * 64)) * 64);
>
> which is equivalent to
> ...
> cost = (amortized * weight * 64 * 64) / (MAX(1, (weight - amortized) * 64)
> * 64);
>
> so
>
> cost = (amortized * weight * 64) / (MAX(1, (weight - amortized) * 64));
>
> thus
>
> cost = (amortized * weight) / (MAX(1 / 64, weight - amortized));
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), (continued)
- [Freeciv-Dev] Another Maintainer, Raahul Kumar, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Ross W. Wetmore, 2001/12/21
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Raimar Falke, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Petr Baudis, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Ross W. Wetmore, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Gregory Berkolaiko, 2001/12/22
- Message not available
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Petr Baudis, 2001/12/23
- Message not available
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Petr Baudis, 2001/12/23
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149),
Chris Richards <=
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Petr Baudis, 2001/12/23
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Chris Richards, 2001/12/23
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Petr Baudis, 2001/12/23
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Raahul Kumar, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Ross W. Wetmore, 2001/12/21
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Raahul Kumar, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Petr Baudis, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Raahul Kumar, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Ross W. Wetmore, 2001/12/22
- [Freeciv-Dev] Re: [PATCH] advdomestic.c cleanup (PR#1149), Raahul Kumar, 2001/12/22
|
|