Rebalancing the barracks troop queue

SharkyFinn

Approved user
Joined
Apr 25, 2016
Messages
84
After every attack where I need to retrain my troops, I then go into the barracks and move troops around to rebalance each queue. I do this because the game seems to have a problem loading the barracks efficiently, and there will often be more troops cooking in one barracks than there should be. For example, yesterday the retrain option left me with about 5 heavy infantry in one barracks, a helicopter in another barracks, and a helicopter and a single heavy infantry troop in the third. I moved he single heavy infantry to the barracks with the others and saved myself 35 seconds. It's not a lot, but it adds up over the long haul. Sometimes, I'll just need to swap a heavy infantry from one barracks with a ranged infantry in another barracks to end up with a consistent cook time across all my barracks.

Does anyone else do this?
 

kilgore_trout

Approved user
Joined
Aug 30, 2015
Messages
240
Used to be worse, like 15 minutes in one and an hour and 15 in the other 2. I think if you keep your most time consuming troops divisible by 3 it helps.
 

Manifesto

Approved user
Joined
Sep 26, 2016
Messages
1,920
35secs. Good move. :D
As Kilgore said, there was a time where a bug made it much worse. At the moment it's pretty good.
5 troops vs 1 is not too bad in the grand scheme but if you're constantly moving troops to reduce 'minutes', suggest you contact CS in case you have a bug we don't.
 

Hyhyhy

Approved user
Joined
Feb 23, 2016
Messages
59
Solution for Devs: sort all units that need to be retrained from longest train time to shortest. Then assign one by one unit to the barrack that has the shortest time at the moment.
 

Your_Master

Approved user
Joined
Mar 13, 2019
Messages
1
No joke, this bothers me so much I actually use it as an interview screening question. To be fair I'll give some hints and guidance (since the point of the interview isn't to solve a random riddle cleverly), but if you can't come up with a solution better than Dominations' solution in a half hour interview, with only a little help form me to keep time moving, you do not pass the interview. And yes, I do remember when the algorithm was way worse. What's bizarre is the current algorithm is almost as good as Hyhyhy's but that little bit worse such that I can't figure out what was done wrong.

The solution Hyhyhy proposes, a simple greedy algorithm is better than the dominations solution and implementing it well will pass my interview (many candidates do it in in a dozen or so lines of code and a half an hour), but it's not strictly optimal. Consider if you have three units that take 8 seconds, four that take 5. Your algorithm will give:

B1: 8, 5, 5 = 18
B2: 8, 5 = 13
B3: 8, 5 = 13
Max: 18

But if you trade the two 5s from B1 for the 8 from B2 you get a better result:

B1: 8, 8 = 16
B2: 5, 5, 5 = 15
B3: 8, 5 = 13
Max: 16

Frankly I think a brute force algorithm would be viable with just the slightest bit of optimization -- so many people get concerned with the computational complexity but the scale of the problem is small and that's why this is how DVRs determine scheduling. But frankly, if you just kept the current algorithm and just made a dummy pass that says "could I just move 1 unit from one barracks to another and improve the overall time" and "is there any 1:1 trade I could do and get an improved time" that would solve 99% of my frustration.
 

SharkyFinn

Approved user
Joined
Apr 25, 2016
Messages
84
Solution for Devs: sort all units that need to be retrained from longest train time to shortest. Then assign one by one unit to the barrack that has the shortest time at the moment.

Yeah, that's the method I came up with, too.

Solution for Devs: sort all units that need to be retrained from longest train time to shortest. Then assign one by one unit to the barrack that has the shortest time at the moment.

I try to do that, too (consume troops in packs of 3).
 

Blood

Approved user
Joined
Apr 24, 2017
Messages
154
Lol it’s been like that since day one your just noticing now because you lose more troops post rebalance
 

SharkyFinn

Approved user
Joined
Apr 25, 2016
Messages
84
Lol it’s been like that since day one your just noticing now because you lose more troops post rebalance

Lol. You really lost sight of the topic 8 posts in? No one said they just noticed it now, and no one said they're losing more troops post rebalance either. I posted this thread, because I actually enjoy playing this game and I wondered if there were other other people with OCD-like tendencies who get satisfaction from reworking their barracks after every battle. I think you must have been looking for the thread for people who loathe themselves because they're too weak willed to to stop playing a mobile game that they profess to hate.
 

Blood

Approved user
Joined
Apr 24, 2017
Messages
154
This bug that your just now commenting on after four years is nothing new. Figured you were complaining and wanted the ai to do a better job. People are losing more troops post rebalance so it’s not a strange assumption that’s why you just now brought it up. I love myself I am pretty awesome. Again never said I hated the game I hate the horrible decisions that have been made since nexon took over bhg.
 
Top