engine/partitions: add sorting and partitioning by free resources

Still work to do, but taking it one step at a time
Typically, the happy path terminates at the bottom. I'd expect to see `return []string{ms[j].ID}` here, and `return []string{} in the conditional above (after the condition is switched to `>=`, of course)