To solve the nurse scheduling problem using a genetic algorithm, we created the Python program called 02-solve-nurses.py, which is located at https://github.com/PacktPublishing/Hands-On-Genetic-Algorithms-with-Python/blob/master/Chapter05/02-solve-nurses.py.
Since the solution representation we chose for this problem is a list (or an array) of binary values, we were able to use the same genetic approach we used for several problems we have solved already, such as the 0-1 knapsack problem we described in Chapter 4, Combinatorial Optimization.
The main parts of our solution are described in the following steps:
- Our program starts by creating an instance of the NurseSchedulingProblem class with the desired value ...