I am working on a planning algorithm for scheduling tasks. I have a question regarding my implementation

Hi guys,

I am currently interning as a software developer, but I'm the only developer around (it's an animationstudio), so I can't really ask anyone else

I am tasked with programming a software that would enable the management to automate scheduling of projects with set deadlines.

as the title says, I have already found an algorithm that should enable me to do so, but the algorithm requires the knowledge of available resources (read: employees) per time-unit.

I have currently all information regarding the project stored in a DataSet, but looking up data such as "Which employees are available for task X at day Y" takes way too long if I did it for every task, since the number of those can count several tens of thousands and the project length can exceed 2 years.

my current solution is storing the available employees available per time unit in a HashSet, which ends up as an element of an array with maxDuration elements, where maxDuration is the number of time-units (currently days) from project start to finish:

private HashSet<int>[] InitOpenEmployees(int maxDuration, PlanData pData) { HashSet<int>[] res = new HashSet<int>[maxDuration]; int i; // initialize all sets for (i = 0; i < maxDuration; i++) res[i] = new HashSet<int>(); // enter available times foreach (PlanData.EmployeeAvailabilityRow emplAvailability in pData.EmployeeAvailability) for (i = emplAvailability.From; i <= Math.Min(maxDuration, emplAvailability.Until); i++) res[i].Add(emplAvailability.Employee_ID); return res; } 

for each task I iterate through the array and try to find a time window in which they can be processed by intersecting the set of available employees per time unit with a set of employees that are able to work on the current task.

I am currently using one work-day as one time-unit, however the algorithm will probably require me to change that to hours instead of days. this will grow the array to 8 times its size.

and this is why I'm asking you guys if you have a smarter solution, as it seems rather clumsy and memory hungry, albeit far faster than trying to grab the necessary data from the DataSet each time

by Schootingstarr via /r/csharp

Leave a Reply