## 6 Model- and Data-Driven Focused Analysis
### Learning over Daily Demand Mixes  
As discussed above, the daily demand depends on the actual customer requirements, where the variation at the day-to-day level can be significant. However, even in such circumstances, in the long term and with sufficient experience, there can be found some characteristic demand patterns and fitting lot-sizing and sequencing rules which are well-applicable to solve the daily production scheduling problems. This is the task our production planners accomplish on a daily basis. The daily demand varies regarding the product--characterized by product type, diameter, and stroke length--and product quantities. It can be represented by a vector, where each cell denotes the required daily amount of a particular product variant. Figure 11 below shows an example of the demand of three consecutive days, which for confidentiality reasons is color-coded (darker colors represent values below the annual average, lighter colors above average). The crux of the problem is to find such days' CO's that are similar to several other daily order sets and together sufficiently represent the annual demand. To solve this, we decided to use machine learning. In this setting, two ways of machine learning could be used: supervised or unsupervised learning. In case of supervised learning, one should label every day, and the orders with different characteristics specific to that day. This approach would not make our problem easier, because we do not know how the planners characterized the days, what features they elaborated, and what labels they attached to the days. Indeed, it is their personal, tacit knowledge. Hence, we decided to focus on the unsupervised (or self-supervised) learning approach. Specifically, the daily orders of the past year's period were grouped into clusters by means of a k-means clustering method [25]. This method partitions a number of data points--in our case, the vectors representing daily demand--into k clusters in such a way that each vector belongs to a cluster, with the nearest mean (cluster centroid) serving as representative of the cluster. Hence, vectors with high similarities belong to the same cluster. In the end of the process, each cluster was represented by a single element--a typical daily demand vector--which was the closest to the geometrical mean (centroid) of the cluster. Distance and the nearest mean were defined by the Euclidean distance. Note that the number of clusters should be given as the input parameter for the algorithm. Based on expert judgment, we made clusters of the same annual demand mix with different k values. The task was to define the minimum number of clusters which could represent the yearly order volume in such a way that their centroids could be used in the detailed simulation studies, and next, by our production planners in their everyday scheduling activity. In our records, we had 235 working days, with 235 vectors of daily customer orders. To find the correct grouping into clusters, we elaborated six experimental scenarios: the k-means clustering was run for 5, 10, 25, 50, 75, and 100 clusters. Figure 12 below shows the aggregated results, as a so-called heatmap. The columns (except the first six) are representing product variants, while rows represent the daily order quantities, which are color-coded (darker colors represent values below the annual average, lighter colors above average). High demands are depicted by high-intensity cells. The first six columns are for  
Figure 11: Experimental setup of detailed analysis. Figure 10: Experimental setup of detailed analysis. showing the results of the six ways of clustering. In Figure 12, daily orders are grouped according to the 25-means clustering. This can be seen in the zoomed-in sub-diagram on the right-hand side of the figure, which present fragments of two clusters. These two clusters have in common that demand for a single product variant, \(p\), dominates all the others, while there are differences due to geometric variations and slight demand for another product variant, \(S\).