## 3 Materials and Methods
### Step 4--Aggregate Planning Modeling and Solution  
The model developed to solve the Aggregate Production Planning (APP) consists of a linear programming model. The model equation was elaborated involving two dimensions, labor and financial. The first case involves hiring and subcontracting personnel. As for production, to carry out aggregate planning, it is necessary to collect the data presented in Section 3.1. It is necessary to define its horizon to prepare the planning model, denoted in this equation by H. For aggregate production planning problems, the horizon usually varies from three to fifteen months (\(3\leq\text{H}\leq 15\)). Thus, the H can be changed according to the problem. In this study, H is equal to 12 months since the idea is to develop an annual production plan. After defining the horizon, it is necessary to determine the main variables and parameters that describe the problem. At this stage, the new reduced electric energy cost and power demand are allocated as variables and have their restrictions. With the literature support, it was possible to define those that will be used in the mathematical equation of the proposed model according to the nomenclature table presented in the Nomenclature list. To obtain the cost of electricity, consider the electricity taxes (TE) in R$/kWh and an energy performance indicator (I) [29] that measures the relationship between energy consumption electricity by the amount produced (kWh/kg). This represents the average value from January monthly indicators 2014 to December 2018. Thus, the cost of electricity (R$) is obtained by: \(C_{t}^{ee}=I\times TE\). As this study focuses on integrating this power demand to reduce costs, the power demand cost in the period was considered a parameter, and the contracted power demand was considered a decision variable. In this way, from such definitions, it is possible to build the cost minimization function (Equation (4)) [30]:\[Min\sum_{t=1}^{T}(C_{t}^{u}\cdot U_{t}+C_{t}^{ac}\cdot U_{t}+C_{t}^{e}\cdot U_{t}+C_ {t}^{e}\cdot U_{t}^{e}+C_{t}^{m}\cdot T_{t}+C_{t}^{c}\cdot T_{t}^{c}+C_{t}^{D} \cdot\ T_{t}^{D}+C_{t}^{He}\cdot H_{t}^{e}+C_{t}^{S}\cdot U_{t}^{S}+C_{t}^{f} \cdot U_{t}^{f}\cdot+C_{t}^{de}\cdot D_{t}^{e}) \tag{4}\]  
This function has the following restrictions, based on the nomenclature presented in the \"Nomenclature list\", such as the conservation of workforce, the limitation of production in the period, the limits of overtime, the limit of stock, the limits of backorders, the power limitation, and non-negativity constraints. In the first constraint (Equation (5)), the number of workers in the current period (\(T_{t}\)) must be equal to the number of workers in the previous period (\(T_{t-1}\)) added to the hirings in the current period (\(T_{t}^{c}\)) and subtracted from layoffs in the current period (\(T_{t}^{D}\)), being [30]:  
\[T_{t}=T_{t-1}+T_{t}^{c}-T_{t}^{D}\ \text{para}\ 1\ \leq\ t\ \leq\ H \tag{5}\]  
The second constraint (Equation (6)) is characterized by the limitation of production in period \(t\), in which the produced capacity cannot exceed the available capacity. This is internally defined based on available labor hours, regular or extra. Thus, it is determined by the amount that the company can produce in normal hours per month (\(H_{t}^{N}\)) and in overtime (\(H_{t}^{H}\)) [30]:  
\[Ca_{t}=H_{t}^{N}+H_{t}^{H}\ \text{para}\ 1\ \leq\ t\ \leq\ H \tag{6}\]  
In the third constraint (Equation (7)), there is a limit for overtime (established by the company itself); that is, if it is not desired that overtime production exceeds 25% of production capacity in each period (\(H_{t}\)), the constraint appears to be [30]:  
\[H_{t}\leq\ 0.25\ \text{to}\ 1\ \leq\ t\ \leq\ H \tag{7}\]  
This variable is balanced at the end of each period in the stock restriction. The net demand is obtained from the sum of the demand \(D_{t}\) and the number of units missing \(U_{f-1}\) from the previous period.