Honestly I'm not sure which of these would perform best (since some of them might be overfitted for the datasets is aw), but since they each seem pretty reasonable for performance, I could run all 3 in parallel and just pick the one with the most desired result, and get rid of the one that is logged to the worst performance.
Find the event that starts the earliest in the day, tie breaker goes to the event that has less events occurring in the day (remove from further selection)
Find the event that starts the latest in the day, while still being later than the first event, tie breaker goes to the event that has less events occurring in the day
Recursively find new events that start as early as possible after earliest selected event while still being before our subsequently chosen event (remove it from further selection)
When we can no longer find any events to fill in the middle, return with our new ordering of events
Also there seems to be a pattern of of some events taking up tons of space, let’s just get rid of those prematurely since I just sense they might take up more space than they’re worth
Since there seems to be a pattern of the events being grouped together towards a certain time of the day, perhaps we can take advantage of that, and go from ‘left to right’.
8am = 0, 8:15: = 1 8:30 = 2, etc
create an empty myDiverseSchedule
list
for each event, calculate a ‘grouped average distance away from 0’, (calculate distance from 0 for each event instance, then take the average distance of those event instances)
sort the events in ASC order by grouped average distance from 0 → sortedEventsByAverageDistance
[
{
eventName: "Jester's Court",
groupedAverageDistanceFrom0: 123123123
eventInstances: [
{start: 123123123123, end: 12312332434},
]
},
...
]
sequentially iterating over the sorted list of group averaged events,
pull the start event of this event onto a eventsSelected
list without conflict of any already selected event,
perform this until there is no room left in the day, or we’ve iterated over each event
Find numberOfEventsPossible
(in this case it’s 6)
Partition the day into equal time ranges of numberOfEventsPossible
.
Group every event instance into these timeRanges
based on the start time.
for each grouping
- filter any events already selected for in ‘selected instances list’
- choose the earliest event that doesn’t overlap the previously selected event (for first iteration, don’t compare)
- add this event instance to ‘selected instances list’