DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.86k stars 465 forks source link

Autolabor is assigning labors ineffectively #2868

Open drhead opened 1 year ago

drhead commented 1 year ago

Here's the save and mods folder: https://pixeldrain.com/l/SQshhcvL

I have been having issues with Autolabor assigning engraving in very questionable ways. All of my skilled engravers seem to never be assigned, including a Legendary +1 with no other useful skills other than a single level in Dyer (which, to be fair, she is the only person with any experience on this). Yet Autolabor is assigning engraving to level 0 dwarves. Something isn't right here.

MechanosG commented 1 year ago

Could this be autolabor assigning different jobs to your skilled engravers, then while the engravers are busy, it's assigning said engraving job to the next in line, which happens to be unskilled? I've been having problems myself with autolabor doing this, and I'm thinking about making a suggestion on how to potentially fix it.

As an example of my own situation, I can start a new game, then set autolabor to choose only 2 miners, and choose them from a pool of the top 2 dwarves skilled in mining (autolabor MINE 0 2 2). When there aren't other jobs, this works just fine. But often, I will see the best miner get distracted with another job, such as helping planting or hauling. Then while he's busy, autolabor will assign mining to 2 other dwarves instead. Then when my best miner finishes hauling or whatever, he sees that the mining jobs are already taken, and keeps doing other things. ....which is not ideal. This isn't fixed by assigning a minimum amount of miners either.. as I have seen low skilled dwarves get the permanent position due to the high skilled dwarf being busy at the time.

I'm thinking about suggesting a 5th argument for autolabor, to enable holding out for skilled workers for that individual job. So instead of searching for candidates from dwarves currently without a job (to get it done faster), it instead includes dwarves already working, and if the best skilled option isn't available, then don't assign the job (or still assign them the job and let them decide which to prioritize, or kick them off other jobs if another dwarf is as skilled or better). While this will slow down how fast jobs with this enabled get done.. it should in theory solve the issue with low skilled dwarves taking (and keeping) jobs just because the better candidate is currently busy. Thoughts?

ab9rf commented 1 year ago

At this point I'm reluctant to attempt to modify autolabor's algorithm until Bay12 fixes the underlying labor assignment algorithm in DF. It's not reasonable to attempt to finetune the algorithm for setting the assignments if DF's algorithm for using the results of those assignments to actually assign labors to dwarfs is not working in a predictable way. As a result, I (at least) am going to dedicate any time I put toward this general area to trying to understand what DF is actually doing when it assigns dwarfs to jobs, rather than assuming that it's working "as advertised" when we have ample evidence that it's not.