A scheduling optimization problem with flexible dates (part 2/2)

Python Implementation

We use Pyomo library to solve our optimization problem. For installation, simply type pip install pyomo in the Anaconda Prompt window. 

We also need to download a solver. There are two things to note. First, one of our constraints (all employees start on the same date for each client) is quadratic. Second, our choice variable is binary. Thus, the solver must handle non-linear, mixed-integer problems. The SCIP solver is one of the fastest and free solvers (only for non-commercial use) that meet this requirement. You can download it here

The entire Python code is available on my GitHub site in Jupyter Notebook format: https://github.com/econcarol/ScheduleOptimizer.

Results

The graph below shows the assigned schedule for each employee and there is no conflict of scheduling. The actual code also explicitly checks the constraints one by one.

As we can see, every employee receives at least one assignment, which doesn't have to be true for all cases. Since A and B have the lowest skill scores, they only get one assignment. On the other hand, C and D have the highest skill scores, so they receive the highest number of assignments.

Schedule Gantt Chart

Potential Extensions

We can extend the above solution to a more complicated problem. For example, employees have their position levels (e.g., associates and managers) and each project requires different numbers of associates and managers. Also, some projects are more important than others, given their fees and potential for future contracts. We will need to add position load constraints for the former, and add weights to each client and the objective function for the latter.

Moreover, we can assign workload for each employee, so they don’t get overwhelmed. Hence, there are many possible extensions. But the fundamental algorithms to solve this type of problems are very similar to each other. I hope my solution serves as a starting point for anyone who is trying to solve such problems.