Example
Given a number of different task types that need to be completed over a period of one month:
Type | Number per month
--------------------------
A | 1
B | 5
C | 30
D | 15
E | 20
--------------------------
71
Question:
How do I generate a flat order (1-dimensional array) of types that ensures that
- 71 jobs are completed within one month
- the types are spreaded as equally as possible (ABAB instead of AABB)
Edit:
One Idea that came up in the comments is:
Maybe reducing each stack of types by an amount relative to its size
is better than to use the absolute amount of 1. eg. A:2, B:10 results
in “for each A take 5 B” because B is five times larger than A.
Assume you have an array of task types such as:
You can first sort, and then use the greater number as reference point to build the array of tasks.
Example:
produces: