# A Gradient-Based Cuckoo Search Algorithm for a Reservoir-Generation Scheduling Problem
## 4 Gradient Cuckoo Search for Reservoir Scheduling
### Gradient-Based Search Strategy
\begin{array}{l}\frac{\partial Q_{i,t}}{\partial t}=\lim\limits_{ \Delta l\to 0}\frac{\Delta Q_{i,t}}{\Delta l}=\frac{1}{\Delta T_{i}}\lim \limits_{\Delta l\to 0}\frac{V_{i}\big{(}Z_{i,t}+\Delta l\big{)}-V_{i} \big{(}Z_{i,t}\big{)}}{\Delta l}=\frac{1}{\Delta T_{i}}\cdot V^{\prime}{}_{i} (Z_{i,t})\\ \frac{\partial H_{i,t}}{\partial t}=\lim\limits_{\Delta l\to 0}\frac{ \Delta/2-Zd_{i}\big{(}Q_{i,t}+\Delta Q_{i,t}\big{)}+Zd_{i}\big{(}Q_{i,t}\big{)} }{\Delta l}=\frac{1}{2}-Zd^{\prime}{}_{i}(Q_{i,t})\cdot\frac{\partial Q_{i,t}} {\partial l}\\ \frac{\partial P_{i,t}}{\partial l}=k_{i}\cdot\Big{(}Q_{i,t}\frac{\partial H_{i, t}}{\partial l}+H_{i,t}\frac{\partial Q_{i,t}}{\partial l}\Big{)}\end{array} \right. \tag{25}\]  
For the reservoir \(i\) at time period \(t+1\) shown in Equation (26), the partial derivative of power output is:  
\[\left\{ \begin{array}{l}\frac{\partial Q_{i+1}}{\partial l}=\lim\limits_{ \Delta l\to 0}\frac{V(Z_{i})-V(Z_{i}+\Delta l)}{\Delta l\Delta l\Delta l_{t+1}}=- \frac{1}{\Delta T_{i+1}}\cdot V^{\prime}(Z_{t})\\ \frac{\partial H_{i+1}}{\partial t}=\frac{1}{2}-\lim\limits_{\Delta l\to 0}\frac{ Zd(Q_{i+1}+\Delta Q_{i,t+1})-Zd(Q_{i+1})}{\Delta l}=\frac{1}{2}-Zd^{\prime} (Q_{i+1})\cdot\frac{\partial Q_{i+1}}{\partial l}\\ \frac{\partial P_{i+1}}{\partial l}=k\cdot\Big{(}Q_{i}\frac{\partial H_{i,t}}{ \partial l}+H_{i}\frac{\partial Q_{i+1}}{\partial l}\Big{)}\end{array} \right. \tag{26}\]For the reservoir downstream at time period \(t\) shown in Equation (27), the partial derivative of power output is:  
\[\left\{ \begin{array}{l}\frac{\partial Q_{ij}}{\partial l}=\frac{\partial Q_{ij} }{\partial l}\\ \frac{\partial H_{ij}}{\partial l}=\frac{\partial L_{i}(Q_{ij})-Zd_{j}(Q_{ij}+ \Delta Q_{ij})}{\Delta l}=-Zd^{\prime}{}_{j}(Q_{j,t})\cdot\frac{\partial Q_{ ij}}{\partial l}\\ \frac{\partial P_{ij}}{\partial l}=k_{j}\cdot\left(Q_{j,t}\frac{\partial H_{ ij}}{\partial l}+H_{j,t}\frac{\partial Q_{ij}}{\partial l}\right)\end{array} \right. \tag{27}\]  
For the reservoir downstream at time period \(t+1\) shown in Equation (28), the partial derivative of power output is:  
\[\left\{ \begin{array}{l}\frac{\partial Q_{ij+1}}{\partial l}=\frac{\partial Q _{j,t+1}}{\partial l}\\ \frac{\partial H_{ij+1}}{\partial l}=-Zd^{\prime}{}_{j}(Q_{j,t+1})\cdot\frac{ \partial Q_{j,t+1}}{\partial l}\\ \frac{\partial P_{ij+1}}{\partial l}=k_{j}\cdot\left(Q_{j,t+1}\frac{\partial H _{j,t+1}}{\partial l}+H_{j,t+1}\frac{\partial Q_{j,t+1}}{\partial l}\right) \end{array} \right. \tag{28}\]  
According to the formulas above, the partial derivative of power generation \(E\) with respect to the gradient \(\Delta l\) is:  
\[\frac{\partial E}{\partial l}=\Delta T_{t}\frac{\partial P_{i,t}}{\partial l}+ \Delta T_{t+1}\frac{\partial P_{i,t+1}}{\partial l}+\sum_{j=i+1}^{N}\left( \Delta T_{t}\frac{\partial P_{j,t}}{\partial l}+\Delta T_{t+1}\frac{\partial P _{j,t+1}}{\partial l}\right) \tag{29}\]  
If \(\frac{\partial E}{\partial l}>0\), adjust the water level by \(\Delta l\), otherwise adjustment is rejected. For the cascade system, the flowchart of the gradient-based search strategy is shown in Figure 2.  
Figure 2: Flowchart of gradient-based search strategy. Implementation of Gradient-Based Cuckoo Search (GCS) for Long-Term Hydropower Generation Scheduling (LHGS)  
According to the description above, the steps to solve long-term scheduling problem using the cuckoo search algorithm with the gradient-based search strategy (GCS) are shown in Figure 3:  
1. Randomly generate feasible initial solutions. 2. Evaluate fitness of the solutions. 3. Generate new solutions by Levy flights. 4. If the new solution is infeasible, adjust it by two-way solution correction strategy. 5. Adjust the new solution by gradient-based search strategy. 6. Update the host nest. 7. Abandon the worst nest. 8. Repeat Steps 3 to 7 until the stop criteria is reached. Figure 3: Flowchart of gradient-based cuckoo search (GCS).