I think it would fundamentally be a constraint based programming problem, eg the sudoku solvers, travelling salesman implementations, software that tells eg Amazon warehouses which parcels go in the van first based on both size and the route it’s planned so that the driver never had to dig all the parcels out to get the buried ones.