## 3 Two-Stage Stochastic Optimization Problem
### Energy Storage Constraint
However, for a stochastic optimization problem, the design variables, which are independent of uncertain parameters, can be determined first (here-and-now), while the operational variables must wait until all random parameters have been realized in order to determine the optimal solution (wait-and-see). In other words, the two types of variables need to be determined at different stages of the optimization process. Therefore, when both the design variables and operational variables need to be optimized simultaneously to minimize the total lifecycle cost of the system, this study adopts a two-stage stochastic programming approach. All design variables, i.e., the capacities of all devices, are classified as first-stage variables; all operational variables are classified as second-stage variables. Combining the MILP problem above, this two-stage stochastic programming problem can be expressed in the following form:  
\[ \begin{array}{ll}&\min\left(\omega_{1}C_{short}+\omega_{2}C_{long}\right) \\ (\text{First-stage}):&=\min\left[\omega_{1}\left(k_{1}C_{f}+k_{2}C_{m}\right)+ \omega_{2}(k_{3}C_{e}+k_{4}C_{l})\right]\\ &=\min\left[\omega_{1}k_{1}C_{f}+\left(\omega_{1}k_{2}C_{m}+\omega_{2}k_{3}C_{ e}+\omega_{2}k_{4}C_{l}\right)\right]\\ &=\min_{d}E[f_{s}(d,\xi)]+f_{d}(d)\\ &\text{s.t.}\quad\psi^{dc}(d)\leq 0\\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad d\in\{0,1\}\\ (\text{Second-stage}):&f_{s}(d,\xi)=\min_{x_{t},y_{t}}f_{s}(d,x_{t},y_{t},\xi) \\ &\text{s.t.}\quad\varphi^{oc}(d,x_{t},y_{t},\xi)=0\\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\psi^{oc}(d,x_{t},y_{t },\xi)\leq 0\\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad x_{t}\in\mathfrak{R}^{n},y_{t}\in\{0,1\}^{n}\end{array}  \tag{28}\]  
The objective function is represented by two parts: \(f_{d}\) is the deterministic part of the objective function, which corresponds to the investment cost \(C_{inv}\) of the selected equipment capacity. The stochastic part is represented by the expectation of \(f_{s}\), which represents the cost related to the uncertain parameters, including the operation and maintenance costs \(C_{OM}\) and the cost of purchasing resources \(C_{tari}\). \(\xi\) represents the uncertain parameters, including wind speed, wind direction, and load size. The comprehensive evaluation metric with multiple time scales primarily refers to the coupling between short-term decisions and long-term planning, where short-term decisions focus on immediate costs, and long-term planning focuses on long-term costs. Short-term decisions emphasize immediate benefits. In the case of the hydrogen hybrid UAV, short-term costs include hydrogen fuel consumption costs and regular maintenance costs. Long-term planning focuses on the sustainability of the system. For the hydrogen hybrid UAV, long-term costs include the initial investment in equipment and the service life of the equipment. The corresponding objective function is constructed using a weighted sum:  
\[\min J=\omega_{1}C_{short}+\omega_{2}C_{long} \tag{29}\]  
where \(J\) is the objective value of the comprehensive optimization; \(C_{short}\) is the short-term cost, including fuel consumption and maintenance costs; \(C_{long}\) is the long-term cost, including equipment investment and the amortized service life; \(\omega_{1}\) and \(\omega_{2}\) are the weight coefficients that balance the relative importance of short-term and long-term objectives. Short-term cost:  
\[C_{short}=k_{1}C_{f}+k_{2}C_{m} \tag{30}\]  
where \(C_{f}\) represents the hydrogen fuel consumption cost, \(C_{m}\) represents the regular maintenance cost, and \(k_{1},k_{2}\) are the weight coefficients. \[C_{f}=P_{f}\cdot Q_{f} \tag{31}\]  
where \(P_{f}\) represents the unit price of hydrogen fuel, in \(\forall/L\), \(Q_{f}\) represents the hydrogen consumption of the fuel cell for a single flight, in liters L, \(Q_{f}=f(I_{FC},t),I_{FC}\) represents the fuel cell operating current, and \(t\) represents the duration of a single flight.