but - you've got it setup so that this is 100% inevitable, and... that just seems dumb.
Sorry to be blunt about it - but this algo just doesn't account for nearly enough - it just grabs a pile of people - of some race that is acceptable to one or more colonization targets - and then has to unload colonists (which takes forever) because by randomly grabbing a population w/o respect for how many ships are needed with that race - you're doomed to do exactly that: get the wrong race, and have to redo it.
And in an unlucky situation, you could then have a pathological case:
10 ships grab all one race
1 goes to target...
9 unload
9 grab all of 2nd race needed...
1 goes to target...
8 have to unload
8 grab all of 3rd race needed...
1 goes to target...
7 have to unload...
etc.
Until you rethink this algo so that you account for who is going where ahead of time, you're totally doomed to repeat this blundergarten.
Here's a current example. There are 2 worlds that call for Ackdarians. But 4 are being loaded (so far). 2 will inevitably have to unload them pointlessly again shortly... and there's just no reason for this other than "cause we say so..."