I'm trying to automate a task and I lack the right vocabulary to look up the correct algorithm. It really feels like a common problem that has likely been solved many times before.
All I'm looking for is for someone to point me in the right direction or help me with the right search terms to look up a solution / algorithm. If you happen to know of an actuall library (javascript), then even better.
Made-up scenario
Say I have 3 'buckets', Bucket A
, Bucket B
and Bucket C
. Each of these can hold a certain number of 'Balls'.
Bucket A
: Capacity 10 balls.Bucket B
: Capacity 15 balls.Bucket C
: Capacity 5 balls.
Now, I also have an inventory of balls and each one can only
be put into certain 'buckets'.
One ball can only go in Bucket 2
, The next ball can go into
Bucket 1
OR Bucket 3
, and so on.
Now.. I need to determine the best way to place the balls in order to try to fill up each 'bucket' to it's capacity (or as close as possible).
Real scenario
My real reason for this is to schedule people
(balls) to visit locations
(buckets) for a requested number of hours (capacity of the bucket). However,
due to the following reasons all the libraries/algorithms I've found while searching for "scheduling" so far
do not work in my scenario.
- I do not care about start/end times at all, only
person
->location
- My people (balls) all have a strict list of locations they can visit. Each one is unique.
- Each person is available for an arbitrary number of whole (integer) hours that they can spend at exactly one
location
. Using someone that's available for 8 hours for only 7 of those hours is OK. - Each location (bucket) requests a certain number of hours that I try to fulfill to the best of my ability with any combination of people.
I have ~50 locations and ~100 people. It's not a requirement that I get a perfect solution, but 'pretty close'.
I found schedule.js which looks fantastic, but I've been unable to abuse it to fit my needs.