engine/partitions: add sorting and partitioning by free resources

Still work to do, but taking it one step at a time
No need to initialize this if it's going to be overwritten. Just `var machineIDs []string` will do