Maximizing attained talks per event

Imagine that you decided to attain a tech conference and have purchased an expensive ticket giving you full access to any of the talks you might find interesting. The only problem is that the conference is time-constrained: you can't go back and choose to attain a talk that has already ended. Further, there are multiple rooms, which means that several talks happen during the same time, where you can be only at a single place. You would like to know how you could maximize the number of talks you attained, potenatially the number of ideas you were exposed to and the number of people you could meet.

Here is the sample list of talks you could attain during the conference:

# title of the talk, start time, end time talks = [ ('Confronting the most important task for the day first', '10:00', '10:15'), ('HTML 5.2: What\'s new', '10:00', '11:30'), ('Getting HTML wrong makes your CSS and JS code worse', '10:00', '10:30'), ('CSS preprocessors: why bother', '10:00', '10:30'), ('CSS triggers, reflows and repaints', '10:00', '10:30'), ('CSS grid examples', '10:15', '10:45'), ('CSS flexbox examples', '10:15', '10:45'), ('Clean unused CSS properties', '10:15', '10:45'), ('Code bumps: what they are and how to stay away from them', '10:00', '10:30'), ('Regular expressions showcase', '10:00', '10:30'), ('Added value: when to subtract', '10:00', '10:30'), ('Too many choices make selection hard', '10:00', '10:30'), ('Gestalt theory: why website elements are its users', '10:00', '10:30'), ('Granularity: too big and too small functions', '10:00', '10:30'), ('Most important UML diagrams for the software architect', '10:00', '10:45'), ('Selecting the right features in a sea of noise', '10:00', '10:45'), ('Levels of indirection: flexibility in code, novelty in approaching a problem', '10:15', '10:45'), ('Inputs, outputs and schematics on a big canvas', '10:15', '10:45'), ('Chrome 61: Features to expect', '11:15', '11:40'), ('IoT: How interacting things could change Internet', '10:45', '12:15'), ('CMOS circuits using sensors to obtain environmental data and control devices', '10:45', '12:15'), ('Using RaspberryPi and PiCamera to create a time lapse video', '10:45', '11:15'), ('NodeJS: JavaScript on the server', '11:30', '12:30'), ('Things to learn from the various JavaScript frameworks', '13:30', '14:45'), ('CSS demos can\'t sell', '13:45', '14:15'), ('CSS masks with gradients', '13:45', '14:15'), ('Iconography and affordances', '13:45', '14:15'), ('Typographic principles to use', '14:00', '14:45'), ('Styleguides: when to be consistent and when not', '14:00', '14:45'), ('Accessibility with ARIA', '14:15', '15:00'), ('Responsive web design', '14:30', '15:15'), ('Website optimization', '14:15', '14:45'), ('Function optimization', '14:15', '14:45'), ('Differentiation and integration in Python: edge cases', '14:15', '15:00'), ('Examples of incomprehensive list comprehensions in Python', '14:15', '15:00'), ('Library fragmentation encourages small thinking', '14:15', '15:00'), ('Using PHP to build a simple game', '14:15', '15:00'), ('Using PHP to integrate a shopping cart in a website', '14:15', '15:00'), ('Memory usage instead of CPU time: choosing the right language for the task', '14:15', '15:00'), ('Client-side validation is not enough', '14:15', '15:00'), ('Secure web apps: OWASP recommendations', '14:15', '15:00'), ('Privacy and resisting the temptation to mindlessly track your users', '14:15', '15:00'), ('Lack of SSL encryption will affect your Lighthouse score', '14:15', '15:00'), ('Linking (slow) languages to compiled C++ solutions: the communication costs', '14:30', '15:00'), ('C++ containers: when to use each one', '14:45', '15:15'), ('C++ template programming examples', '14:45', '15:15'), ('C++ representations: collaborations of large number of objects', '14:45', '15:15'), ('First loop like air: implementations of vectorized functions', '14:45', '15:15'), ('Sorting, filtering and reshaping data', '14:45', '15:15'), ('Why diversity in tech is important', '14:30', '15:00'), ('Avoiding distractions at the workplace', '14:30', '14:45'), ('Mathspiration: seeking the patterns of the beautiful', '14:30', '15:00'), ('Math and combinatorics: code as combinatory play', '14:30', '15:00'), ('Matrices and linear algebra: computing at scale', '14:30', '15:00'), ('Kronecker products, tensors and TensorFlow', '14:30', '15:00'), ('Applications of Dijkstra\'s shortest paths', '14:30', '15:00'), ('Using SVG to draw world maps and choropleths', '14:30', '15:00'), ('Using machine learning to improve our choices', '14:30', '15:45'), ('Convolutional neural networks for image classification', '14:30', '15:15'), ('Why usability matters more than you think', '14:30', '15:45'), ('Fast SQL queries: indexes and more', '14:15', '15:00'), ('NoSQL key-value stores', '14:15', '14:45'), ('The biggest bottleneck: gathering the data', '14:45', '15:30'), ('Metadata and connectedness: Beyond your website', '14:30', '15:30'), ('Social networks as a marketing tool', '15:00', '15:30'), ('New programming languages: Should we learn to use them?', '15:15', '16:00'), ('Information architecture and reducing the number of clicks to access content', '15:15', '15:30'), ('Long-term content strategy', '15:15', '15:45'), ('Scientific journals as a source of ideas', '15:15', '15:45'), ('Everything is a demo until the user sees it as a product', '15:15', '15:30'), ('Keywords and search engine rankings', '15:15', '15:45'), ('Single-page apps', '15:15', '16:00'), ('Linux shell scripting', '15:15', '16:00'), ('AJAX and async fetch', '15:15', '16:00'), ('Choosing the right words to present your idea: tone of voice', '15:15', '15:30'), ('Good UI notification examples', '15:15', '15:30'), ('Self-describing design and self-describing code', '15:15', '15:45'), ('Resilient, self-healing systems', '15:30', '16:00'), ('Systems design', '15:45', '16:30'), ('Common mistakes when designing forms', '15:15', '15:30'), ('Don\'t focus on the project to the detriment of your carreer', '15:15', '15:45'), ('Data in the cloud: potential risks', '15:15', '15:30'), ('Code smells: how to recognize them early', '15:30', '16:00'), ('Data structures on paper: thinking without GUIs', '15:30', '16:00'), ('Algorithms to extract image patches', '15:45', '16:15'), ('Snakes and contours in images', '15:45', '16:15'), ('The pitfalls of pair programming', '15:45', '16:15'), ('Graphs: representing all kinds of relationships between things in a flexible way', '15:45', '16:30'), ('The hardware side using the software', '15:45', '16:15'), ('Events in user interactions: perceptions matter', '15:45', '16:00'), ('Developing Android apps', '15:45', '16:45'), ('Finding useful problems to solve', '16:00', '16:30'), ('From idea to funding: finding the right investors', '15:45', '16:15'), ('Fast shipping as a disctinctive advantage', '15:45', '16:15'), ('Does this technology allow the problem to disappear?', '15:30', '16:15'), ('Maintenance of large codebases', '16:30', '17:00'), ('Electron and the new wave of apps', '16:30', '17:00'), ('Web animation: when is it useful', '16:30', '17:00'), ('What\'s new in the latest EcmaScript specification', '16:30', '17:00'), ('Expect that technology won\'t solve all your problems', '16:30', '17:00'), ('Soft skills for team players', '16:30', '17:00') ]

To make a sample choice, you could use code like this:

def time_to_mins(time): hours, mins = time.split(':') return int(hours)*60 + int(mins) def times_intersect(time1mins, time2mins): t1s, t1e = time1mins t2s, t2e = time2mins return t1s <= t2s < t1e or t1s < t2e <= t1e # Sort by duration - shortest talks first shortest_talks = sorted(talks, key=lambda x: time_to_mins(x[2]) - time_to_mins(x[1])) time_start, time_end = 10, 17 time_left = list(range(time_start * 60, time_end * 60)) schedule = [talks[0]] m1 = [schedule[0][1], schedule[0][2]] last_start_time, last_end_time = '', '' for t1 in shortest_talks: if t1 not in schedule: m2 = [t1[1], t1[2]] if len(time_left) != 0 and not times_intersect(m1, m2): time_interval = list(range(time_to_mins(m2[0]), time_to_mins(m2[1]))) time_left1 = [tl for tl in time_left if tl not in time_interval] if len(time_left) != len(time_left1): time_left = time_left1 schedule.append(t1) schedule = sorted(schedule, key=lambda x: time_to_mins(x[2])) for talk, start_time, end_time in schedule: if start_time != last_start_time and end_time != last_end_time: print(' '.join(['-'.join([start_time, end_time]), talk])) last_start_time, last_end_time = start_time, end_time """ 10:00-10:15 Confronting the most important task for the day first 10:15-10:45 CSS grid examples 10:45-11:15 Using RaspberryPi and PiCamera to create a time lapse video 11:15-11:30 Chrome 61: Features to expect 11:30-12:30 NodeJS: JavaScript on the server 13:45-14:15 CSS demos can't sell 14:30-14:45 Avoiding distractions at the workplace 14:45-15:15 C++ containers: when to use each one 15:15-15:30 Information architecture and reducing the number of clicks to access content 15:45-16:00 Events in user interactions: perceptions matter 16:00-16:30 Finding useful problems to solve 16:30-17:00 Maintenance of large codebases """

This gives you a sample list of only twelve non-overlapping talks you could visit between 10:00 and 17:00 in the conference day. In case you don't find the titles interesting, you could swap them for other ones if they happen at exactly the same time. Note that maximizing the number of attained talks here doesn't maximize the time being busy. Since there is a pause between 12:30 and 13:30, you would lose 15mins to wait for the talk starting at 13:45. Similarly, you lose 15mins between 14:15 and 14:30 and once again between 15:30 and 15:45. If you wanted to maximize the time spent being busy, you would need to change the code accordingly.