# Should I describe this set as an equation or for a small set of data, are discrete values appropriate?

Working repl.it of my manual counting solution:

i want to write a function to distribution X number of hours into 7 days with a few rules in place. Currently I have these time chunks allocated i an object that tells me what day to add each next available pair of 15 minute chunks. For example when going from 3 hours to 3.5 hours, my pre-designed / manual object tells me to put the 2 new 15 minute chunks into a specific slot.

With this manual pre-arrangement, there is no algorithm, and if I want to change the pattern of time distribution, I have to manually go in and adjust all the numbers in each day object to get the pattern.

Then in order to determine the distribution, I check for the total time available (say 5 hours), turn it into 15 minute slots (20 slots) then go through each day’s object and count how many slots it has that are 20 or less.

I’m not sure if that makes sense, but it works.

I’d like to see if I can automate this, or create an algorithm or a quadratic equation that will do some thing similar. I can’t really see what the pattern is in this table…it was made by someone else, and Im just manually implementing it by pre-arranging the buckets.

For explanation I’m attaching a screenshot of what I’m trying to do. For given hours (left colum), distrubute the time like in the table here, each of the 7 columns to the right of teh first represnt a day of the week.

Since I can’t see a patter just by looking, I was thinking I could try to create some rules to follow like this:

1. the smallest unit of division is two 15 minute chunks.
2. I want to distribute time so that there is a longest day that is 30-60 min longer than the next largest day
3. I want to preserve 2 days open, until the biggest day has 3 hours
4. I want to weight the distribution so that if you sort the time per day on a bar chart, there is always a negative slope overall, with 1-2 plateaus in the middle
e.g.
for 6 hours: 2hrs, 1hrs ,1hrs, 1hr ,1hr , 0, 0
for 7 hrs: 2 hrs , 1.5 hrs, 1.5hrs , 1hr, 1hr, 0, 0
for 8 hrs: 2.5, 1.5, 1.5, 1.5, 1, 0, 0
for 9 hrs: 3 , 2, 1.5, 1.5, 1, 1, 0

Etc…I could come up with a long list of “rules” to follow.

What I’m really curious about though, is if there is a machine learning or regression analysis I could do that would figure this out for me? And if I wanted to make adjust ments to the distribution based on an expert’s input, could a new regresson equation be calculated?

I hope I’m expressing myself clearly…it’s an interesting thought problem I’ve been trying to solve for years, and tonight I finally just decided to hard code this table in rather than doing it programatically.

Let me know if you have any thoughts.

I have come up with a partial solution to this but would love some input first in case I’m on a wild path.