Topic: Measuring working time of productionsites
Tibor Topic Opener |
Posted at: 2019-05-19, 16:46
Hi, I would like to improve the measurement of utilization time of productionsites - as used by AI. I found a function ProductionSite::program_end() - that is fine, but I would like to have also something that starts the program itself. Or can we say that the productionsite is always executing some program? So measuring end to end is fine... Top Quote |
GunChleoc |
Posted at: 2019-05-19, 17:29
I am interested in working on the production program code in the tribes. This would also allow us to show the time measurements in the encyclopedia without having to calculate anything manually. Busy indexing nil values Top Quote |
Tibor Topic Opener |
Posted at: 2019-05-19, 19:20
The productionsite now has "crude_statistics_" variable that is used only by AI, now I am just trying to code something and see if it will work reasonably.... Top Quote |
einstein13 |
Posted at: 2019-05-20, 08:34
Do you consider also production time which depends on land (forester, woodcutter, stonemason, farms, vineyard, ...)? I did some experiments long time ago: That is why I wanted to check every building manually and see how many resources it can produce, but it is tones of work. I don't think that it is worth it, but if it worth - there are some methods currently available to help this. einstein13 |
GunChleoc |
Posted at: 2019-05-20, 08:43
I think an average value according to work area size would work just fine. A formula to capture that would be perfect. Busy indexing nil values Top Quote |
Tibor Topic Opener |
Posted at: 2019-05-20, 08:50
The beauty of my approach is that measures actual time. From program end to program end. Usually it matches LUA conf as it should of course... I just want to add that it is still aproximate as it does not keep the history for x minutes, just do some crude average of previous average with current result... But this is indeed used only by AI and is not visible to player Top Quote |
einstein13 |
Posted at: 2019-05-20, 13:50
Can I suggest one small change? As I understand, for given values:
You are trying to calculate averages:
Where:
Right? I have prepared short excel file: https://files.fm/u/85djxzg6 (hopefully you can download) Columns:
I expect that we want to know what is average of last N terms in working building, because the environment can change (borders, stone cut, trees, etc.). Average described above is working well, but it can work even better. Let's change the equation from:
To:
If For example using That change is almost nothing to the code & memory, but the value is much closer to the target one. einstein13 |
Tibor Topic Opener |
Posted at: 2019-05-20, 14:16
@Einstain we dont have fixed mu, but total_duration = 5 * 60 * 1000 seconds curent_result_weight = duration / total_duration previous_average_weight = (total_duration - duration) / total duration. So weight of current result vs previous average depends on duration of just finished program.... If "something" took few seconds it will have lesser impact and so on... Top Quote |
einstein13 |
Posted at: 2019-05-20, 20:18
I guess that it is 560 seconds or 560*1000 miliseconds, but that is minor thing (rather a bit funny to me )
I don't understand everything (total duration is a constant here?), but as I know you, I believe that this formulas are good. So I will have no objections for your work any more! Go for it and merge to make the AI even better! einstein13 |
Tibor Topic Opener |
Posted at: 2019-05-20, 21:31
No it is 5 minutes, but value is arbitrary...
What I dont like (too) about current main statistics, that it covers varying range of time. From 20x skipped to 20x producing, this can be from 1 minute to more then 20 minutes... Top Quote |