Hey guys, I have another optimization problem that I really need help with.
To simplify things, I'm only going to give 10 dummy data points (instead of my 500+ that I have)
Each data point has 2 values associated with it: The frequency (in days) and duration to complete the task (in minutes).
There is going to be 2 user inputs: Number of slots and available time per slots
You can imagine these 2 user inputs as a graph where the number of slots is the x-axis and available time is the y-axis.
The number of slots corresponds to a year divided into slots.
What I would like to do is to put all my data points into all the available slots and create a job plan, but make sure that the tasks in each slot don't go over the available time.
Here's my approach: For this example, Number of slots = 12, Available time = 120 min [Attached file]
1) Sort the frequency from lowest to largest.
2) Divide 365days by the lowest frequency and round down. (i.e. 365 divided by 90 = 4 [rounded down])
3) Divide the number of slots by the value found in 2) (i.e. 12 slots /4 = 3)
With the number found in 3), I will only focus on that number of slots for a frequency of 90 days
4) Populate each slot by putting only one task per slot and looping it until all tasks are in (i.e. There are 4 tasks with a frequency of 90 days [We'll call it A,B,C,D]. Task A will go in slot 1, Task B will go in slot 2, Task C will go in slot 3, Task D will loop and go back into slot 1. If there isn't enough available time, Task D will check in slot 2)
5)Once all the tasks are in, slots 1,2, and 3 are copied to the other slots. Meaning that slots 1,2,3 = slots 4,5,6 = slots 7,8,9 = slots 10,11,12
Repeat from step 1 with the next frequency (i.e. 180 days)
1) 180 days
2) 365 days / 180 = 2 rounded down
3) 12 slots /2 = 6
I will only focus on the first 6 slots
4) Populate the slots with tasks having 180 days. But this time, there are already other tasks in it. It needs to check from slot 1 to 6 where is the next available slot to fit given the remaining time. (i.e. there are 3 tasks with frequency of 180 days, [we'll call if E,F,G]. Task E will check if there is available time in slot 1. If yes, put it in there, else check the next slot. Loop slots 1 to 6 until all tasks of 180 days frequency are in)
5) Copy slots 1,2,3,4,5,6 to the other slots ==> slots 1,2,3,4,5,6 = slots 7,8,9,10,11,12.
Repeat again with the next frequency.
Sorry if it's difficult to understand by text. The attached file has the final solution included, so if you follow the steps, you should get the same thing.
If you know an easier solution, feel free to share it.
Thank you for your help.
NOTE: I don't need to have the graph drawn. I just want to know in which slot does each task goes into (It can be another column next the the dataset)
Bookmarks