Today's dish is short and sweet: given a number of potential returns associated with certain tasks, and given limited allocable time for multiple people, how can we make sure everyone's time is used to the max for the best global welfare?

# Recipe difficulty

• Statistics: 🔥🔥 - you need some basic understanding of common OR problems such as bin-packing and the 0-1 knapsack problem, but nothing crazy
• Technical: 🔥 - no code ability required.
• Time required: 🕜 - very short blog post today as I only had 30 minutes before knapsacking my way to the movies!

# What it is

The Knapsack problem is one of the most classical NP-hard questions: we have a knapsack (a backpack) with a capacity C, and Y items with each a weight W and a value V. How do we maximize the value without overshooting the backpack's capacity?

$\sum(W) \ s.t. \ \sum(W)\leq C$

# Why is it useful

Moving the problem into a business setting: we have multiple new interns (knapsacks), each with a fixed amount of available hours per day; and we have multiple tasks, each generating a certain revenue but taking up a certain time.

There's a plethora of available algorithms for this, but since I don't have time for this today, let's just use the optimization package Adagio in R.

In just a few lines of code, assuming we have three interns:

install.packages('adagio')

returns <- c(78, 35, 89, 36, 94, 75, 74, 79, 80, 16)
task_time_minutes <- c(18,  9, 43, 20, 59, 61, 70, 75, 76, 30)
available_minutes <- c(100, 150, 350)