distributeRemaining backwards
-
- Junior Kadett
- Beiträge: 7
- phpbb forum styles
- Registriert: Freitag 10. Februar 2017, 18:10
distributeRemaining backwards
A comment in SystemManager says that distributeRemaining is supposed to assign leftover workers to the building types with the highest fractional assignments. The code I see sorts, but does not reverse the list, or process the list backwards. I think this is responsible for a tiny part of the apparent unpredictability of labor assignments.
Re: distributeRemaining backwards
calc sorts and reverses before returning. It sorts based on count.
Right before this, calc calls distributeRemaining, which sorts on fPart, but does not reverse before adding one worker to each category (until it runs out of idle workers).
Right before this, calc calls distributeRemaining, which sorts on fPart, but does not reverse before adding one worker to each category (until it runs out of idle workers).
Re: distributeRemaining backwards
Ah, I missed that. Yes that should be iterated in reverse. It probably won't make a huge difference, but yes that's the correct way.jmichael hat geschrieben:calc sorts and reverses before returning. It sorts based on count.
Right before this, calc calls distributeRemaining, which sorts on fPart, but does not reverse before adding one worker to each category (until it runs out of idle workers).