That sounds amazingly high tech for a kenneling facility. How did you do the optimization - usign an off-the-shelf solver?

I wrote it completely from scratch, basically a custom type of tree search. Admittedly there are naive aspects and opinionated optimizations and magical constants involved in the final code, but in practice it's worked without any problems for 4-5 years, and it's relatively fast for the amount of data it's churning.

[Edit: An example of a magical constant is the weighting of "friends" over a period of time versus "number of moves" required to achieve optimal friendships]

Impressive. Also hilarious that this kennel is probably better optimized than a lot of big logistics companies. ;0)

I think arbitary weightings are unavoidable when optimizing 'soft' (social) problems like kennel allocation or seating plans. The optimal solution is not well defined.

Thanks! It was quite a fun problem to dive into... the company hired animal behaviorists and put a lot of thought into the "soft" issues that it wanted the software to be able to solve, while allowing for flexible decisions from managers and employees, so it was challenging as understanding the domain... and yes I would say animal management is quite a tricky logistical problem that most people never even consider.

In a larger way, though, 90% of this kind of work is pencil and paper, drawing out all possibilities you can think of, and then asking questions like "what if X and Y are friends staying together, and Y and Z and Q are friends, but X and Z are enemies, and Z+Q is showing up on night 4 of X+Y stay, should Y move in with Z if there are 2 nights left? 3? A majority? Ever?" I would get into long, long conference calls where I would ask them all these scenarios and graph them out before I started writing the code. So the code just expresses what they would hopefully wish to do based on their domain knowledge and best practices. And that is the real trick of optimization... making the clients happy ;)