## 3 Problem Formulation  
The solar cell can be modelled by using the single diode model, double diode or multi-diode models. The objective function is defined from Equations (1) and (3), several research papers use different functions, for example, [48; 49; 50; 59; 68; 69] use the root mean square error (RMSE), [47] use the sum of squared error (SSE). In [55; 58] the individual absolute error (IAE) is used and [79] use the mean absolute errors (MAE). However, the objective function was used to minimize the vertical distance between the experimental points and the theoretical curve. In this paper, we use separate fitting for different regions in the current-voltage characteristics (Figure 2), because the current error is more important for small voltages due to the strongly varying slope of the curve, while the voltage error is more important for large voltages approaching an open circuit.  
During the optimization process, each \(i\)-th solution is defined by a vector \(X_{i}\), where \(X\) is a candidate set of parameters defined as follows:  
* for a single diode: \(X=x_{1}=\Big{[}I_{ph}\,I_{SD}\,a\,R_{S}\,R_{P}\Big{]}\);
* for a double diode: \(X=x_{2}=\Big{[}I_{ph}\,I_{SD1}\,I_{SD2}\,a_{1}\,a_{2}\,R_{S}\,R_{P}\Big{]}\);
* for a flexible solar cell: \(X=x_{3}=\Big{[}I_{ph}\,d_{i}\,\mu\,\tau\,V_{bi}\,R_{s}\,I_{0}\,a\,R_{sh}\Big{]}\).  
The objective functions must be minimized with respect to the limits of parameters \(x_{1}\), \(x_{2}\) and \(x_{3}\). The Equations (1) and (3) is rewritten in the following homogeneous equations.  
For a single and double diode:  
\[F_{1/2}(V,I)=I-I_{ph}+I_{SD1}\bigg{[}\exp\bigg{(}\frac{V+IR_{s}}{a_{1}V_{T}} \bigg{)}-1\bigg{]}+SI_{SD2}\bigg{[}\exp\bigg{(}\frac{V+IR_{s}}{a_{2}V_{T}} \bigg{)}-1\bigg{]}+\frac{V+IR_{s}}{R_{P}} \tag{5}\]  
For flexible hydrogenated amorphous silicon, a-Si:H:  
\[G(V,I,x_{3})=I-I_{ph}\Bigg{(}1-\frac{d_{i}^{2}}{(\mu\tau)_{eff}[V_{bi}-(V+IR_{ s})]}\Bigg{)}+I_{s}\bigg{[}\exp\bigg{(}\frac{(V+IR_{s})}{aV_{T}}\bigg{)}-1 \bigg{]}+\frac{V+IR_{s}}{R_{P}} \tag{6}\]The cost function of current error \(\varepsilon_{1}\) near the short circuit (zone 1) is:  
\[\varepsilon_{1}=\sqrt{\frac{1}{m_{1}}\sum_{Zone1}\big{(}I_{i}(V_{i},I_{i},x)-I_{ PV_{-\exp-i}}\big{)}^{2}} \tag{7}\]  
The cost function of voltage error \(\varepsilon_{2}\) is the horizontal distance between the experimental point and calculated curve; it is defined near the open circuit (zone 2) as:  
\[\varepsilon_{2}=\sqrt{\frac{1}{m_{2}}\sum_{Zone2}\big{(}V_{i}(V_{i},I_{i},x)-V _{PV_{-\exp-i}}\big{)}^{2}} \tag{8}\]  
Where \(m\) is the number of experimental data, \(V_{i}\) and \(I_{i}\) are the \(i\)-th simulated and experimental current and voltage value, respectively. The overall objective function, i.e., the global error \(\varepsilon\) in the two zones, is the sum of current and voltage errors and is defined as:  
\[f(X)=\varepsilon=\varepsilon_{1}+\varepsilon_{2} \tag{9}\]  
The objective function constraints for each model are presented in the following equations. For a single and double diode:  
\[\begin{array}{l}\min\varepsilon_{SD}\\ \text{subject to}\end{array}\left\{\begin{array}{l}0\leq I_{ph}\leq 1\\ 0\leq I_{SD}\leq 1\times 10^{-7}\\ 1\leq a\leq 2\\ 0\leq R_{S}\leq 0.5\\ 0\leq R_{P}\leq 100\end{array}\right.\qquad\text{subject to}\left\{\begin{array}{l} 0\leq I_{ph}\leq 1\\ 0\leq I_{SD1}\leq 1\times 10^{-7}\\ 0\leq I_{SD2}\leq 1\times 10^{-7}\\ 1\leq a_{1}\leq 2\\ 1\leq a_{2}\leq 2\\ 0\leq R_{S}\leq 0.5\\ 0\leq R_{P}\leq 100\end{array}\right.\end{array}\]  
While, for flexible hydrogenated amorphous silicon, a-Si:H:  
Figure 2: The characteristic current-voltage division in two zones.  
\[\begin{array}{l}\min_{F}\\ \text{subject to}\left\{\begin{array}{l}0\leq I_{ph}\leq 0.8\text{A}\\ 0\leq d_{i}\leq 4\text{ nm}\\ 0\leq\mu\tau\leq 5\times 10^{-5}\text{ cm}^{2}/\text{V}\\ 0\leq V_{bi}\leq 1\,\text{V}\\ 0\leq I_{S}\leq 4\times 10^{-18}\text{A}\\ 1\leq a\leq 1\\ 0\leq R_{S}\leq 0.5\,\Omega\\ 0\leq R_{P}\leq 20\,\Omega\end{array}\right.\end{array}\]