Simple Scheduling
Wolfram is not the fastest software on the planet, neither the easiest. It’s great for prototyping ideas and the fact that it has everything in one environment is a blessing and a curse.
Scheduling and job shop problems are not straightforward (compared to, say, Google OR Tools) in Wolfram but you can do it with some constructs.
Here is an assignment problem consisting of persons with varying skills assigned to different locations. Think of cleaning staff having to be scheduled to places.
The aims is to minimize the time necessary, taking into account the constraints.
Let’s take a handful of locations, three people and assign the time necessary at each location:
The skills matrix : rows are people, columns are locations (1 means the person has the skill for that location):
Next, we need decision variables which hold whether a person gets assigned to a location: assign[i, j] is 1 if person i is assigned to location j
The set of constraints is a list which gets filled up hereafter:
Each location must be assigned to exactly one person:
This results in a set of linear equations:
Each person can only be assigned to locations for which they have the skill:
This actually simplifies the problem since, on inspection, it reveals that various variables are zero:
Ensure that assignment variables are either 0 or 1 (ie. we have a Boolean variable):
The objective function is to minimize the total workload ( total time):
Written out this is again a linear equation:
The optimization now consists of:
To extract the assignment results from the solution:
To visualize this we need to create a concrete date. Let’s pick one a start the day at 8AM:
Convert the intervals to time spans:
Giving this nice visualization: