## 3 Materials and Methods
### Methods
#### 3.2.5 Proposed Hybrid Forecasting Model: Cluster-Based Genetic Algorithm (CBGA)  
Nowadays, demand forecasting methods combining inside of a single use are frequently preferred. For this reason, the proposal of combining demand forecasting methods with certain weighting coefficients is considered in the study. While combining demand forecasting methods on e-commerce, it is taken into account that there may be three different scenarios. These scenarios are:  
1. Creating a separate forecasting optimization model for each product: Because there are too many products, it is a long computational process and needs to be repeated continuously. It can be solved with linear optimization tools. However, high commercial packages may be needed. The optimization of the result it will produce is locally certain. * Creating a common forecasting optimization model covering all products: The result it produces can be found quickly. There is a single combination formula for all products, so it is predicted to perform worse than the first case. * Creating a predictive optimization model for clustered products: It is possible to give both fast and successful results. Since products with similar structures are clustered together, the performance of the joint estimation formula to be established will be quite high compared to the previous models. If we consider demand forecasting as an optimization problem, the objective function of it will be forecast accuracy or error. In the study, accuracy measurements such as the MSE (mean square error) value were used. While optimizing demand forecasting, two different GA solutions are compared. These two solutions are:  
1. Optimizing demand forecasting on a product basis;
2. Optimizing demand forecasting on a cluster basis (CBGA). Demand forecast optimization model by minimizing the MSE:  
\[Minimize\ MSE_{1}+MSE_{2}+\ldots+MSE_{N}=\sum_{i=1}^{N}MSE_{i} \tag{12}\]  
where \(N\) is the selected product count from the \(P\) product cluster for the optimization problem, and \(MSE_{i}\) is the mean squared error for the product \(i\ e\ P\). The MSE is defined by in here with  
\[MSE_{i}=\frac{1}{T}{\sum_{1}}^{T}(A_{it}-F_{it})^{2} \tag{13}\]  
where \(N\) is the product count, \(T\) is the period count, which is based on this problem, \(A_{it}\) is the actual sales volume for product \(i\) at period \(t\), and \(F_{it}\) is the final forecasting sales volume for the same product. For minimizing the optimization problem, some constraints should be given for providing the right solution mathematically:  
\[F_{it}=\frac{\sum_{j=1}^{J}W_{ijt}*F_{jit}}{\sum_{j=1}^{J}W_{ijt}}\geq 0 \tag{14}\]  
where \(j\) is the forecasting method number, \(F_{ijt}\) is the forecasting sales volume for product \(i\) at period \(t\) by using method \(j\), \(W_{ijt}\) is the combined weight of this forecasting, and \(F_{it}\) is the hybrid forecasting sales volume for product \(i\) at period \(t\). When the model is constrained by \(F_{it}\) because it is equal to or higher than zero because of the negative forecasting sales volume is not intended. \[0\leq W_{ijt}\leq 1 \tag{15}\]  
where every method's combined weight must be between 0 and 1. \[F_{ijt}\geq 0 \tag{16}\]  
While the \(F_{ijt}\) forecasting sales volume must be equal to or greater than zero,  
\[T>1 \tag{17}\]  
shows that at least 2 or more forecasting periods must exist for the problem scope. The proposed model in this study, a flow with a structure as in Figure 1, is to find solutions for many products at the same time. As can be seen from here, both descriptive information about the products and information on sales and the competition enable us to cluster the products, and it is thought that the result will be improved by running GA as a result of the clusters obtained. In the scenario proposed in Figure 1, demand forecasting optimization is targeted on a cluster basis for the sales of selected e-commerce products.