## 3 Methods
### Multi-Stage Stochastic Programming Model for the Aggregate Production Planning  
The multi-stage stochastic programming has the same assumptions as the deterministic model, in addition to the following:  
* The methodology used by [PERSON] et al. [16] was considered, obtaining the best fit probability distribution for each stochastic parameter. * Using best fit distribution test, probability distributions for random variables were found and they are continuous, then, a discretization of distribution probabilities was used and Gaussian quadrature was applied, as explained by [PERSON] et al. [30] with three and four possible realizations of random variables. * First-stage decision variables are the number of workers required for each family of products; after that, in the next stages, the other decision variables are obtained with consideration for the filter process due the stochastic process, in other words, taking into account the nonanticipitave non anticipativity constraints. * The problem has complete recourse. Because the APP is now a stochastic programming model, the notation of some decision variables and parameters changes and some sets are added. The notation now is:  
* Indices: \(T\) is the set of periods with \(t\in T\); \(K\) is the set of family products with \(k\in K\); \(S\) is the set of all scenarios with \(s\in S\); \(N_{s(t)}\) is the bundle of scenarios that are indistinguishable from \(s\) in period \(t\); \(\omega\) is the random space. * Parameters: \(D^{s}_{(t)k}\) is demand for each period, family product and scenario (stochastic parameter); \(C^{p}_{(t)k}\) is production capacity for each period, family product, worker and scenario (stochastic parameter); \(C_{I(k)}\),\(C_{X(k)}\)\(C_{B(k)}\) are the inventory, production and backlog costs per unit, a family of products and period; \(C_{W(k)}\) represents the workers' cost over the planning horizon, i.e., the total amount to be paid for each worker assigned to each family product for the total duration of the APP; \(LS_{k}\) is the level service for every family product; \(P^{s}\) is the probability of occurrence for each scenario with \(\sum_{s=1}^{S}P^{s}=1\); \(n_{s(t)}\) is the node in the scenario tree corresponding to each scenario and period; \(P\left(n_{s(t)}\right)\) is the probability of \(n_{s(t)}\). * Decision variables: \(W^{s}_{k}\) is the number of workers assigned to production for each scenario and product type; \(I^{s}_{(t)k}\), \(X^{s}_{(t)k}\), \(B^{s}_{(t)k}\) are the inventory units, parts produced and backlogs per period, product type and scenario. The stochastic programming model for APP is: \[min\sum_{s=1}^{S}P^{s}\sum_{k=1}^{K}W^{s}_{k}C_{W(k)}+\sum_{s=1}^{S}P^{s}\sum _{t=1}^{T}\sum_{k=1}^{K}I^{s}_{(t)k}(\omega)C_{I(k)}+\sum_{s=1}^{S}P^{s}\sum _{t=1}^{T}\sum_{k=1}^{K}X^{s}_{(t)k}(\omega)C_{x(k)}+\sum_{s=1}^{S}P^{s}\sum _{t=1}^{T}\sum_{k=1}^{K}B^{s}_{(t)k}(\omega)C_{B(k)}\] (7) Equation (7) is the objective function and seeks to minimize all the production costs across all scenarios, the same as the deterministic model, where \(\sum_{s=1}^{S}P^{s}\sum_{k=1}^{K}W^{s}_{k}C_{W(k)}\) is the amount to be paid for all the periods in the horizon plan. \[X^{s}_{(t)k}(\omega)+I^{s}_{(t-1)k}(\omega)=D^{s}_{(t)k}(\omega)+I^{s}_{(t)k} (\omega)+B^{s}_{(t)k}(\omega)-B^{s}_{(t-1)k}(\omega)\ \forall t\in T,k\in K,s\in S\] (8) Equation (8) is the demand-inventory-backlogs balance; this equation determines the number of parts to be produced, the inventory level and the number of backlogs, taking into account the uncertainty of each scenario. \[X^{s}_{(t)k}(\omega)\leq W^{s}_{k}C^{p}_{(t)k}(\omega)\ \forall t\in T,k\in K,s\in S\] (9) Equation (9) is the capacity constraint; as Equation (3) indicates, the maximum number of parts that can be produced for each period, family of products and scenario.