Physical therapy scheduling of inpatients based on improved Genetic Algorithm

In recent years, the physical therapy has become more and more extensive. How to schedule corresponding treatments efficiently in rehabilitation hospitals has attracted the attention of many scholars. A typical physical therapy treatment can be divided into three stages, i.e., the beginning, the treating and the ending. Moreover, only the beginning and the ending stages require a therapist. The treating stage does not. In addition, a physical therapy treatment requires to occupy a bed and an instrument related simultaneously. In order to solve challenging scheduling problems, a genetic algorithm based on Waiting Time Priority Algorithm (WTPA) is designed. Finally, an instance from the rehabilitation department in a hospital is tested. By comparing with the classical simulated annealing algorithm (SA), it verifies the effectiveness and efficiency of the genetic algorithm designed.


Introduction
The physical therapy treatment can generally be used for the elderly and the patients after surgery to quickly restore body function. When patients participate in the physical therapy, several treatments are often required in the same day. Usually, long waiting times will reduce patients' hospital satisfaction. As people's demands for the physical therapy increases, more and more scholars start to study how to improve the operation efficiency of rehabilitation hospitals [1][2][3][4]. The physical therapy requires cooperation of multiple resources, which makes such kind of problems much more complicated.
Many scholars have tried to solve such problems mathematically. Noyan et al. [5] formulated a General Algebraic Modeling System and a mixed integer linear programming model to balance the working time of therapists and the number of acceptable patients in a hospital. Chan et al. [6] designed an intelligence model to fit an accommodated nonlinear association and acquired intelligent grading rules of Emergency department crowding.
Evolutionary algorithms are particularly used due to the efficiency of the solution. Chien et al. [7] developed an evolutionary approach based on genetic algorithm for addressing the physical therapy scheduling problem. In order to reduce patient waiting time, Chien et al. [8] proposed an intelligent approach that integrates Genetic Algorithm and Data Mining approaches to resolve the physical therapy scheduling problems. Nhat-To et al. [9] developed an evolutionary GA that combines 2D chromosomes with simulated annealing algorithm. They applied this GA to improve patient satisfaction and shorten patient waiting time on the multi-objective decision problem.
However, none of the above literatures considers that the therapist can temporarily leave to help other patients. Such operations can improve the efficiency of the hospital. The innovations of this paper are as follows: 1) One physical therapy treatment is divided into three stages, and the therapist only needs to participate at the beginning and at the ending; 2) A genetic algorithm was designed based on the patient's actual queuing scheme.
The rest of this paper is arranged as follows. The second part is the problem description. In the third part, a GA based on WTPA is proposed. The fourth part is a case study and the last part is the summary.

Problem Description
This paper divides the process of a physical therapy into three stages: the beginning, the treating and the ending. The therapist installs and disassembles the instruments at the beginning and at the ending, respectively. Completing a physical therapy requires the collaboration of several resources, i.e., a bed, an instrument and therapists. In addition, the beds and the instruments need be occupied throughout the patient' treatment, and the therapist is required only in the beginning and treating. The day before the treatment, the rehabilitation hospital needs to allot the beds, equipment and therapists for each treatment item. Moreover, it is also necessary to record the start time of each treatment item and the total time of all treatments. The objective of this research is to minimize the total time.
Assumptions are as follows: 1) The process of all treatments will not be interrupted; 2) The patient had no relaxation time between two consecutive treatments; 3) Each bed can only be used for one treatment at a time; 4) Each instrument can only be used for one treatment at a time; 5) Each therapist can only participate in one therapy at a time; 6) There is no priority for the treatment of one patient;

Waiting Time Priority Algorithm (WTPA)
In reality, the patients usually line up at hospitals to be treated. Actually, if the patients knew in advance how long each queue would wait, they would line up in the queue with the shortest waiting time. As shown in the figure 1, the patients line up in random order for beds. If there is only one available bed, the patient directly uses this bed; If there are two or more, the patient chooses one at random. Then, after the bed is selected, if only one instrument is available at the moment, the patient directly uses the instrument; If there are two or more, the patient chooses the instrument that the treatment will last the longest. When all the patients had finished their first treatment, the patient who had finished his last treatment were requeued for the next treatment until all the treatment items were completed. Finally, all resources corresponding to each treatment and the total time of all the treatments were recorded. This paper calls this heuristic algorithm as WTPA.

Genetic Algorithm (GA)
Genetic algorithm (GA) is an algorithm that simulates the natural evolution process of biology to search for the optimal solution. The steps of a classical GA include encoding and initializing the population, evaluating fitness, selection, crossover, and mutation. The GAWTPA designed in this paper is based on WTPA. Due to the queuing order of the patients will affect the total time of all the treatments, the objective of this algorithm is to find the optimal queuing order of patients and calculate the total time. Since the patient numbers are all real numbers that are not repeated, the sorting code is adopted, which is the queuing order of patients entering the hospital. As shown in Figure 2, is a chromosome, the gene on this chromosome represents the patient's number, and the sequencing of the gene represents the patient's queuing order. Initializes chromosome as the parent population.

Evaluating Fitness
The fitness value is the criterion to evaluate the quality of a chromosome. Therefore, this problem is based on WTPA to calculate the objective function value, i.e., the total time of all the treatments. Then, the linear scale transformation method proposed by Goldberg D E was used to transform the objective function value into fitness value.

Selection
This GA adopts elite retained tournament selection method.
Step 1: Select the optimum fitness value of the chromosome in the population and retain it in the next generation; Step 2: Randomly select two chromosomes from the population, compare their fitness value, and select the chromosome with the large fitness value. Repeat step 2 until the number of chromosomes reaches the same size of the population.

Figure 3. Partially mapped crossover method
As shown in figure 3, the partially mapped crossover method is adopted.
Step 1: Randomly select 2 chromosomes , , generate a mapped area at the same location and the mapped area are swapped with each other; Step 2: According to the mapping relationship in the mapped area of , , replace the same genes outside the mapped area of , ; The step 2 is repeated until the same genes are no longer present. After the partially mapped crossover method, the parent chromosome , finally formed two new chromosomes.   The real data of this case is from a rehabilitation hospital in Shenzhen. In addition, Table 1 shows the details of each treatment items, and Table 2 shows the treatment detail of all the patients. This case includes a total of 36 patients and 159 treatments. Meanwhile, the resources of the rehabilitation hospital include 15 beds, 23 instruments, several sets of acupuncture and four therapists.  The GAWTPA was tested by an example using python3.7 on PC with 8GB RAM and Intel Core i5-8265u 1.8Ghz CPU in 64-bit Windows 10. The probability of crossover and mutation of the GA is set as 80%, and the number of iterations is 100. In addition, a classical simulated annealing algorithm (SA) [10] is designed for comparison. These two algorithms run 15 times respectively, the Statistical indicators includes the mean, standard deviation, maximum, minimum and 90% quantile.

Results
According to the results shown in Table 3, both the GAWTPA and the SA can be solved in two hours. Furthermore, the average of GAWTPA is 7.83% lower than the average of SA. Similarly, the 90% quantile of GAWTPA is 7.63% lower than the 90% quantile of SA. What's more, the maximum total time of GAWTPA is 4.05% shorter than the minimum total time of SA, which speaks volumes about the efficiency and effectiveness of GAWTPA as designed. Besides, Figure 5,6 and 7 are Gantt charts of three resources according to the minimum value in the GAWTPA's result, i.e., 283 , from which it can be present that the scheduling of this algorithm is feasible.

Summary
Considering that the therapist does not fully participate in the treatment, this paper innovatively divides the physical therapy into three stages, namely, the beginning, treating and the ending. A physical therapy requires occupying a bed, an instrument and a therapist at a time. In order to solve this complicated problem, this paper proposed the GAWTPA based on a heuristic algorithm WTPA. Then, in the case study, a classical SA is compared, the GAWTPA reduced the average total time of all the treatments by 7.83%. This result shows the efficiency and effectiveness of GAWTPA.