# Birth Allocation and Query Crane Assignment Considering the Uncertain Maintenance Requirements
## 5 Solution Method  
The SWO-DE (Swarm Optimization Differential Evolution) algorithm, based on the combination of swarm intelligence and differential evolution, is a hybrid optimization technique utilizing random search, introduced as an enhancement to traditional DE. SWO-DE integrates the advantages of swarm optimization with the adaptive properties of differential evolution, enhancing search efficiency through collective cooperation and competition among individuals. The algorithm incorporates a selection mechanism, ensuring that individuals in each generation are as competitive or superior to their predecessors, progressively optimizing the population's average performance toward an optimal or satisfactory solution.  
The first step in the SWO-DE algorithm is initializing the population. The range of the independent variable in the objective function is set to include \(N\) solutions, forming the initial population. The population size is denoted by \(N_{p}\) and the dimension of the feasible solution for the population is \(D\). The population of generation \(t\), obtained through continuous evolution, is initialized as \(X_{t}\), where one of the individuals is \(X_{i,t}\). Once the population initialization is complete, the following mutation operation is carried out.  
In this step, three distinct individuals \(X_{r_{1},t},X_{r_{2},t},X_{r_{3},t}\) are randomly selected from the parent population, with the condition that \(r_{1}\
eq r_{2}\
eq r_{3}\). These individuals are used for mutation, where one is selected as the base vector and the other two act as the difference vectors. The new individual after mutation is calculated using the following formula:  
\[V_{i,t+1}=X_{r_{1},t}+F\cdot(X_{r_{2},t}-X_{r_{3},t})\]  
In this equation, \(X_{t}\) represents the population of generation \(t\), and the coefficient \(F\) is the scaling factor, a crucial parameter for controlling the mutation process. The value of typically ranges from 0 to 2, with 0.5 often chosen as a standard value. As \(F\) increases, the differences between individuals in the population of the same generation decrease more slowly, which in turn slows down the convergence rate of the entire algorithm. Conversely, a smaller \(F\) leads to faster convergence. However, a scaling factor that is too small may cause the algorithm to converge prematurely, resulting in suboptimal or one-sided solutions.  
After mutation, the next step is the crossover operation, where each mutated individual \(V_{i,t+1}\) undergoes crossover with the original individual \(X_{i,t}\). The result of this operation, the trial vector \(U_{i,t+1}\), is calculated as follows:  
\[U_{i,t+1}=\left\{\begin{array}{l}V_{i,t+1},if\;rand<CR\;or\;j=j_{rand}\\ X_{i,t},otherwise\end{array}\right.\]  
Here, rand is a random number in the range \([0,\;1]\), and CR represents the crossover rate, which is also a random number within the same interval. Typically, a value of 0.3 is chosen as the optimal crossover rate. The variable \(X_{i,j,t}\) represents the \(j\)-th component of the individual in generation \(t\). The condition \(j=j_{rand}\) ensures that at least one component of each individual in generation \(t+1\) comes from the trial vector.  
A flow chart outlining the DE algorithm is presented in Figure 3. This flowchart illustrates the process of vessel berthing and Quay Crane (QC) assignment in a port. The process begins by inputting initial information about vessels, then determining if all vessels have been allocated to berthing slots. If not, berthing times and positions are calculated, adjusted as necessary, and Quay Cranes are assigned for loading and unloading. The system continuously checks if sufficient QCs are available and updates the schedule accordingly, repeating the process for the next vessel until all assignments are complete.