I am designing some software for transportation companies (air, ground, water, etc). In these industries, you have rest rules where you need to get a certain amount of rest in between activities.
So lets say trucker/pilot/sailor has an activity to go from A to B that takes 4 hours, then has a 30 min break than wants to go C to D that takes 3 hours. Then he/she needs 10 hours of rest before starting another activity.
Now I want to figure out when the next activity can be scheduled. Of course in the very simple example above, I could just take the time that D ended, and add 10 hours, then look for an activity at that point. However, there are more variables in play so I need a broader solution where I can incorporate the other elements. For instance, the trucker has to have 34 hours off in a rolling 168 hour window... so I would be checking for that as well.
My initial thinking was put all the activity in to an array, where each key/value in the array is a minute. Then go through the array to check to make sure all the rules are complied with. However, this will be a huge array and very inefficient.
I appreciate any thoughts!!