# Modified Migrating Birds Optimization for Energy-Aware Flexible Job Shop Scheduling Problem
## 3 Modified Migrating Birds Optimization
### The Basic MBO Algorithm  
MBO is a swarm intelligence algorithm which originates from birds' migration behavior when they form a V-shaped formation [29]. In the MBO, each solution corresponds to a bird. In the flock, one bird is viewed as the leader and the others follow in a line on the right and left sides of the leader bird. The MBO algorithm consists of four steps: population initialization, improvement of the leader bird, improvement of the following birds and selection of a new leader bird.  
First, a given number of birds are randomly generated and one bird is selected as the leader bird. In order to improve the leading solution, the MBO generates several neighboring solutions by exploring the leader bird's neighborhood. If the best solution among these neighbors is better than the leading solution, the leading solution is replaced by the best neighbor. Then, for each following bird, it evaluates its own neighboring solutions and a certain number of the best unused neighboring solutions of its previous solution in the line. The best solution will be the new solution if it is better than the current one. This updating process progresses from the leader towards the tail of the left or right lines. Once all solutions in the flock are considered, this updating process will be repeated. After several tours, the leader bird will be moved to one of the tails, and a solution behind it will take up the position of the leading solution. Then, another loop starts. The evolutionary procedure will not stop unless a termination condition is satisfied. The detailed steps of the basic MBO are shown as follows:  
Step 1: Set the parameters of the MBO algorithm, such as the population size _popsize_, the number of neighboring solutions \(k^{\prime}\), the number of shared neighboring solutions \(x\), the number of tours \(G\), the predefined lifespan \(ls\), and the maximum iteration \(K_{\max}\).  
Step 2: Generate the initial population in a random manner.  
Step 3: Set the iteration number \(K\gets 1\), the tour number \(g\gets 1\), the flag numer \(flag\gets 1\).  
Step 4: Randomly generate \(k^{\prime}\) neighboring solutions of the leader bird. Improve the leader solution and fill the shared neighboring sets \(S_{\mathrm{L}}\) and \(S_{\mathrm{R}}\), each of which has \(x\) elements.  
Step 5: For each solution \(\pi_{\mathrm{L}}\) in the left line \(L\), randomly generate \(k^{\prime}-x\) neighboring solutions. \(N_{\mathrm{L}}\) represents the set of the \(k^{\prime}-x\) neighbors. The best solution in \(N_{\mathrm{L}}\cup S_{\mathrm{L}}\) is used to replace the original solution. Empty \(S_{\mathrm{L}}\) and refill it by using \(x\) best unused solutions in \(N_{\mathrm{L}}\cup S_{\mathrm{L}}\).  
Step 6: For each solution \(\pi_{\text{R}}\) in the right line \(R\), randomly generate \(k^{\prime}-x\) neighboring solutions. \(N_{\text{R}}\) represents the set of the \(k^{\prime}-x\) neighbors. The best solution in \(N_{\text{R}}\cup S_{\text{R}}\) is used to replace the original solution. Empty \(S_{\text{R}}\) and refill it by using \(x\) best unused solutions in \(N_{\text{R}}\cup S_{\text{R}}\).  
Step 7: Evaluate the fitness value of each individual and update the current best solution.  
Step 8: Set \(g\gets g+1\). If the number of tours \(G\) is met, go to Step 9; otherwise, go to Step 4.  
Step 9: If \(flag=1\), move the leader to the end of \(L\), and set the first solution of \(L\) as the new leader, and let \(flag=0\); otherwise, move the leader to the end of \(R\), and set the first solution of \(R\) as the new leader, and let \(flag=1\).  
Step 10: Set \(K\gets K+1\) and check the terminate condition. If \(K>K_{\text{max}}\) is not met, then set \(g\gets 1\), and go to Step 4; otherwise, go to Step 11.  
Step 11: End the procedure.