There are multiple types of appointments, each with their own length. The goal is to find ‘optimal’ placements for a given appointment type on a given day – optimal meaning leaving as little ‘wasted time’ (small gaps) as possible. What is and what isn’t ‘wasted time’ should ideally be evaluated based on the lengths of all appointment types, or less ideally by a self-written evaluation function.
For the given day, there is a given set of bins with varying lengths, and a set of appointments that have already been planned (not necessarily entirely within those bins).
I have been trying to find algorithms suited for this task, and so for the closest I’ve come is bin packing algorithms. From my understanding, though, these algorithms are used to pack a set of objects in as little bins as possible of a given size, usually within a 2D/3D space – while I need to get optimal placements for a single object in a set number of bins of varying sizes, with objects already in them.
Would anybody know an algorithm suited for this job? To lower the execution time I will probably limit the schedule to a grid of 5 minutes.