## 3 Mission and Reliability Driven Fleet Selective Maintenance Planning Two-Stage Method
### Algorithm Design
#### 3.2.2 A Simulated Annealing Algorithm Used to Solve Maintenance Scheduling  
Since the maintenance scheduling of fleet is a sequential process, the efficiency of maintenance tasks can be further improved by reasonable maintenance scheduling. In this section, the SA algorithm is used to further optimize the maintenance schedule to minimize the maintenance time corresponding to the maintenance plan. SA [33] is a local search algorithm that introduces the concept of annealing in solids. This algorithm can reduce the complexity of the algorithm and avoid the shortcoming of the traditional local search algorithm which converges to the local optimal solution quickly by making an annealing schedule of the temperatures and length of times for which the system is to be evolved. In this section, SA is used to calculate the minimum maintenance time of a known maintenance plan, and the most appropriate maintenance strategy is selected according to the maintenance time. The purpose of maintenance scheduling optimization is to minimize the total maintenance time of the fleet through a reasonable scheduling scheme on the basis of an optimized maintenance plan. According to the analysis of known conditions, the input of the problem is a fleet to be repaired and the maintenance time required under the corresponding maintenance level, and the output is the maintenance sequence and the total maintenance time of the fleet. \(T_{i,j}\) represents the time when the \(i\) component completes maintenance on the \(j\) maintenance equipment, and \(t_{i,j}\) represents the time required for the \(i\) component to complete maintenance on the \(j\) maintenance equipment, then  
\[T_{1,1}=t_{1,1} \tag{26}\]  
\[T_{1,1}=T_{1,j-1}+t_{1,j}\quad j=2,3\ldots m \tag{27}\]  
\[T_{1,1}=T_{i,1}+t_{i,1}\quad i=2,3\ldots n \tag{28}\]  
\[T_{i,j}=\max\left(T_{i-1,j},T_{i,j-1}\right)+t_{i,j}\quad i=2,3\ldots n,j=2,3 \ldots m \tag{29}\]  
where \(T_{i,j}\) represents the time when the \(j\) subsystem of the \(i\) equipment completes maintenance, and \(t_{i,j}\) represents the time required for the \(j\) subsystem of the \(i\) equipment to be repaired. If the maintenance schedule is given, the total maintenance time to complete the maintenance according to the schedule can be obtained by the iterative calculation of the above equations. After the input data, a maintenance schedule is randomly generated, and its total maintenance time is calculated. Then, a new schedule is generated by a displacement, and whether it is accepted or not is judged according to the acceptance rule, which changes with the temperature. Eventually the algorithm converges to a solution with a minimized total maintenance time. If \(t_{1}\) represents the total maintenance time of the maintenance schedule generated after the disturbance, \(t_{2}\) represents the total maintenance time of the original maintenance schedule, and \(T\) is the current temperature; then, the acceptance rule can be expressed by Equation (30):  
\[rand(0,1)<e^{-(t_{1}-t_{2})/T} \tag{30}\]  
where \(rand(0,1)\) is a random number between 0 and 1. The operation steps of the maintenance scheduling algorithm are as follows:  
Step 1: Input the calculation data, including the number of equipment n, the number of maintenance processes m and the maintenance time of each maintenance;  
Step 2: Initialize the temperature \(T_{0}\) and the annealing coefficient \(\alpha\) and randomly generate a maintenance schedule that meets the constraints as the initial solution;Step 3: Start the cooling cycle and perform several displacements at each temperature.