title: Task assigning algorithm
body: <p>I'm trying to figure out what the most efficient way of assigning tasks to people. Here is what I'm struggling with: </p>
  
  <ul>
  <li>you have X number of people that are all eligible to do work</li>
  <li>each person can do X number of tasks at once</li>
  <li>you have X number of waiting tasks</li>
  <li>each task takes a variable length of time</li>
  </ul>
  
  <p>The goal of the challenge is to evenly distribute the tasks among the people as best as possible. Once a person finishes one of the given tasks, one of the 'queued' tasks will be fed to them. Here's an example scenario.</p>
  
  <p>There's 500 tasks in the queue with 50 people available to 'take' them. Each person can take 2 tasks at once. Once a person finishes a given task they'll be fed another. The tasks that have been waiting the longest get the highest priority.</p>
  
  <p>One way to possibly do it would be to have each of the 50 people that have the capacity to take a task be assigned one based on their task last given time. For example:</p>
  
  <ul>
  <li>task 1 -> person 1</li>
  <li>task 2 -> person 2</li>
  <li>task 3 -> person 3</li>
  </ul>
  
  <p>...</p>
  
  <ul>
  <li>task 4 -> person 1</li>
  <li>task 5 -> person 2</li>
  <li>task 6 -> person 3</li>
  </ul>
  
  <p>Based on the task last assigned to X person, the person with the oldest task last assigned and that's available to take on another task would get it fed to them. I'm unsure if this is the right solution for even task distribution, would love to hear suggestions! Is there a name for this type of algorithm?</p>
  
  <p>Another method could possibly be to assign tasks based on the person currently serving the lowest number of tasks. Although if multiple people are tied to for the lowest number of tasks, the task is assigned to the person who's been available (last task assigned) for the longest period of time.</p>