Latest Posts

Topic: productivity percentage of buildings is wrong

wl-zocker

Joined: 2011-12-30, 16:37
Posts: 495
Ranking
Tribe Member
Location: Germany
Posted at: 2015-09-20, 09:04

The code for this has not been touched in the four revisions. Have you had a closer look at the issue or is it just a "feeling", something you noticed while playing? What happens when you try to reproduce my experiment with the mill?


"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg

Top Quote
king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2015-09-20, 10:58

well, i wouldn't make a post like this if it was just a feeling. I've had the feeling for a long time, i wanted something more before posting.

So, I didn't try with a mill, but I did try with a barbarian brewery. I had two breweries, one active and full of grain, the other i let it work once. result: the inactive brewery got to 5%+ after working, it remained there for 5 working cycles, then it became 5%- for five more working cycles, and then it became 0% after ten working cycles.

Which proves that it won't go to 0 immediately, but it also doesn't work as it should with the array. It should have remained at 5% for 20 working cycles.

I also looked at a woodcutter, it was at 85%, it cut two trees onsecutively and it remained at 85%.

Then there are the mines. They don't go at 5%, ever.

So it doesn't just add or remove a 5%. But still there is something not working properly there.


Top Quote
king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2015-09-22, 09:21

i am doing the same thing, running empty mines, with barbarians now, and they work at 5% on average, unlike the atlanteans ones. so it works differently for barbarians than for atlanteans.

actually, the average over 90 mines is 3%, so even here it gives half the productivity it should.


Top Quote
wl-zocker

Joined: 2011-12-30, 16:37
Posts: 495
Ranking
Tribe Member
Location: Germany
Posted at: 2015-09-22, 10:48

Mines are a bit difficult because they sometimes have two or more mine= statements. Maybe all of them have to be successful for a productivity increase.

EDIT: In your savegame from https://bugs.launchpad.net/widelands/+bug/1498768, the average over the mines is 4%, sometimes 5%. Since I do not know whether these values are rounded or truncated, that seems fine.

Edited: 2015-09-23, 08:47

"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg

Top Quote
king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2015-10-12, 14:51

I decided to make some more testing with it, because I know I am not crazy and am not imagining things. no, really, that pink elephant is really flying out of my window, you have to believe me.

Anyway, I decided to test imperial mills, because they take one product and make one product, so they are easy to work with. I set up a game on ice wars, because it is a big map with flat terrain, without any oopponent. I made ten mills. I mined enough iron and coal to be able to produce schites for a long time. I made a stock of donkeys. Then I stopped all the other grain-consuming buildings, and I gradually added farms. At each added farm, I'd see how the productivity of the mills would stabilize. I set the economy target to 1000 flour, I directed all of them to a single warehouse, when the warehouse got nearly full I destroyed it, and directed all the flour to a nearby warehouse I had prepared. Then i rebuilt the destroied warehouse, ready to take flour when I would destroy the other warehouse. That way, i was able to keep an uninterructed flour production. Farm productivity was always above 90%, and generally above 95%. There had never been any road congestion. I looked the productivity for a goood minute (at 7x speed) to make sure it stabilized.

So here are the data, number of farms to the left, productivity (it had some statistical variability, so I give a window for it) to the right.

  • 6 3-5%
  • 7 4-5%
  • 8 4-6%
  • 9 5-7%
  • 10 6-8%
  • 11 7-9%
  • 12 8-10%
  • 13 8-10%
  • 14 9-12%
  • 15 10-13%
  • 16 11-15%
  • 17 12-15%
  • 18 12-16%
  • 19 13-20%
  • 20 17-21%
  • 21 18-22%
  • 22 20-22%
  • 23 20-24%
  • 24 24-28%
  • 25 23-29%
  • 26 28-32%
  • 30 35-38%
  • 35 50-65%
  • 40 70-90%
  • 42 90-98%
  • 43 100%

With those numbers, it is easy to see that I was right. There should be a linear correlation with the productivity, and indeed there is for some intervals, but the general code is broken. If 43 farms are enough to push the 10 mills to 100% (with very slow accumulation of grain, i checked over half an hour of gametime) Then 22 farms should give a productivity of 50%, and 10 farms around 25%. 30 farms should be around 70%. You can see that the buildings return a wrong productivity value for a productivity below 100%. I don't know where the error in the code is, but this definitely proves it is there. I also have kept the saved game. Shall I open a bug report?

P.S. Since I had 43 farms, I decided to calculate the performance, since the help window always lists performance as "calculation needed". I slowed down the game speed to 1x to minimize human error in keeping track of the time, looked at the stock of flour, and counted 5 minutes with a chronometer. 158 flour were produced in that interval, giving an estimate of one grain every 82 seconds per farm. Seems high, but I have always knows empiire needs tons of farms. It also follows that a fully stocked mill can make one flour every 19 seconds.

Edited: 2015-10-12, 14:53

Top Quote
QCS

Joined: 2009-12-29, 21:47
Posts: 256
Ranking
Tribe Member
Posted at: 2015-10-12, 15:06

Were your farms close enough so farmers reuse plants planted by someone else? That usually increases productivity if done right...

Edit: That said, productivity is reported per building per cycle, not for economy in time measures, so trying to find a correlation between those two will fail, I guess...

Edited: 2015-10-12, 15:15

CMake is evil.

Top Quote
king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2015-10-12, 15:41

QCS wrote:

Were your farms close enough so farmers reuse plants planted by someone else? That usually increases productivity if done right...

To produce one grain, a farmer needs to plant the field, then to cut the field. it does not matter that two different farmers are doing it, it's always one grain per two farmer actions.

Although i noticed that a farm with plenty of free space sometimes will plant many more fields than it can work, and some of those will rot, with the paradox that a farm with much space will actually produce less. I intend to investigate this issue in the next few days. anyway, they were close enough. it's difficult to fit 43 farms without putting them close. to be exact, they were at the corners of a 4x4 grid.

Edit: That said, productivity is reported per building per cycle, not for economy in time measures, so trying to find a correlation between those two will fail, I guess...

I don't understand your point. productivity is by definition how much the building is producing divided by how much it could produce in the most optimal conditions. so if a mill can produce flour every 19 seconds but but it is supplied with grain only every 25 seconds, its productivity should be (19/25)%. there is no difference between "productivity per building per cycle" and "productivity for economy in time measures" (whatever those are supposed to mean), except for some statistical random variation, but i made 10 mills exactly to get an average. they are simply different methods to calculate productivity, and they must give the same result. If they don't give the same result, it means that one method is wrong.

Edited: 2015-10-12, 15:42

Top Quote
wl-zocker

Joined: 2011-12-30, 16:37
Posts: 495
Ranking
Tribe Member
Location: Germany
Posted at: 2015-10-12, 16:52

Did you consider that the mill has an animation of 10s, and a sleep time of 5s? If the mill cannot work, it will try to start work again earlier. This could be the reason for the low productivity with few farms. Remove the animation time and see if the productivity grows linearly with the number of farms.


"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg

Top Quote
king_of_nowhere
Avatar
Topic Opener
Joined: 2014-09-15, 17:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2015-10-12, 18:38

wl-zocker wrote:

Did you consider that the mill has an animation of 10s, and a sleep time of 5s? If the mill cannot work, it will try to start work again earlier. This could be the reason for the low productivity with few farms. Remove the animation time and see if the productivity grows linearly with the number of farms.

Yes, good idea. I tried now. I could nt do it with 10 mills, because without animation time they are so fast the grain does not have time to reach them. but i could do it with one mill and 8 farms, close enough to it that they could keep it supplied. 8 farms should give a productivity of around 90%, since 4.3 farms are needed for one mill and i doubled the mill's speed by removing the animation. with 8 farms, it stabilized at 80%. I stoopped 4 farms, and it stabilized at 30-35%. Not eexactly half the yield, but close enough. From that experiment I draw two conclusions

1) the reason for the wrong productivity is that the program will count the failed attempts much faster than the succesful ones, leading to an overestimation of skipped work.

2) animation time is the main component of this effect, but it is not the only one.

For buildings where the worker has to move around the map (wooodcutters, hunters) this cannot be avoided, but for every other building the animation time could be included in the count of how much time it passes before it fills its string with a "failed work"


Top Quote
wl-zocker

Joined: 2011-12-30, 16:37
Posts: 495
Ranking
Tribe Member
Location: Germany
Posted at: 2015-10-12, 18:57

because without animation time they are so fast the grain does not have time to reach them.

Feel free to change the sleep time.

i doubled the mill's speed by removing the animation

You tripled it. Before: 5s sleep + 10s animation. Now: 5s sleep.

but for every other building the animation time could be included in the count of how much time it passes before it fills its string with a "failed work"

I don't think that this is possible with the current c++ code. However, I think there are plans to switch to lua for the production programs (all conf files, actually), which will give us a bigger flexibility. Could you open a bug report for this issue (you put it nicely in your point 1, but it should be "failed work", not "skipped"), if there is no such already?


"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg

Top Quote