[freeciv-ai] Optimizing AI CM.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
As was shown in Jason's profile, auto_arrange_workers is a big pig.
I do not yet fully understand the nature of the cycle (see below) which is
going on, but it seems to me that there are three main external leads into
aaw function:
1. Spontaneous rearrangements triggered by changed tile/worker
availability (6%)
2. Rearrangements caused by AI government testing (40%)
3. Routine AI rearrangements by ai_manage_city (54%)
We can really cut down on 3. The only reason to call aaw from
ai_manage_city is if the internal city priorities have changed (and they
practically never change now). All other cases are covered by 1. To do
it cleanly, we need to remember city priorities and do a check if they've
changed every time we are tempted to call aaw from ai_manage_city.
Unfortunately a quick hack of a patch I put together doesn't quite achieve
this: the savegames are not identical. One of the possible reasons I can
see is that terrain upgrades do not trigger worker rearrangement.
For this I have the following proposal: citizen rearrangements should
happen only once per turn, right before the harvest and only if the city
tiles have been changed. Citizen rearrangement can be forced by direct
request from the client.
Tiles can be changed by (1) an enemy unit-, (2) improvements+, (3)
other city rearrangement+, (4) cataclisms. Here + refers only to positive
changes to available tiles, - refers to negative changes to worked tiles
(althoug possibly I am overoptimizing here).
This will have the added bonus of killing off spurious rearrangements
caused by an enemy unit just passing through your city tile. BTW, can the
recent complaints that server CM overrides CMA be caused by the fact that
enemy movement causes server CM to react on all cities, managed by CMA or
not?
G.
prior_cache.diff
Description: Text document
- [freeciv-ai] Optimizing AI CM.,
Gregory Berkolaiko <=
|
|