1. Introduction
Beer is one of the oldest and most popular alcoholic beverages worldwide [
1,
2]. Its production has been developed over centuries and has been continually improved by producers [
3,
4,
5,
6]. The popularity of this alcoholic beverage is attributed, among other factors, to the use of only four basic components during its production process: water, hops, malts and yeast. This aspect makes beer production attractive. Recently, beers have experienced an increase in acceptance, creating a more pronounced competitive environment [
7,
8]. Simultaneously, there has been an increase in the diversity of styles and sensory profiles developed by brewmasters to distinguish their products from those of their competitors [
4]. In this context, the simplicity of the primary inputs and the growing competition in the market suggest that competitive advantage and value creation mainly derive from the production process associated with beer brewing [
9,
10]. The ability to improve and optimize any stage of production is a key factor that significantly affects the profitability and ultimate success or failure of a brewery. In this sense, optimizing production processes becomes a fundamental task to ensure the viability and sustained growth of the brewing industry. To achieve this, it is necessary to implement strategies and techniques that improve the efficiency and productivity of operations, minimizing costs and maximizing the quality of the final product. In this way, brewers will be able to meet market demands and remain competitive in an increasingly demanding and dynamic environment [
11].
The quality of raw materials and the production process are crucial elements in determining the final characteristics of beer. During beer fermentation, biochemical changes occur, including the production of esters and higher alcohols [
12,
13,
14]. These compounds are responsible for the characteristic fruity and floral aromas and flavors of beer. Esters are organic compounds formed from the reaction between acids and alcohols during fermentation. Higher alcohols, on the other hand, are compounds produced by yeast during fermentation and are derived from the amino acids present in the malt [
15,
16]. However, during fermentation, diacetyl—a compound that can produce an undesirable buttery flavor in beer—is also produced [
17,
18]. It is important to note that the production of diacetyl can be influenced by several factors, such as the yeast strain used, the fermentation temperature, and the oxygen concentration.
Fermentation is considered a critical stage [
19] because, as a result of the chemical reaction with yeast, the exothermic conversion of sugars into ethanol and carbon dioxide occurs. This fermentation heat is a major factor in beer production, as it influences the quality of the final product. If the fermentation temperature is too high, the yeast may alter its metabolic pathway and produce undesirable flavors in the beer. Conversely, if the fermentation temperature is too low, fermentation may stop prematurely, resulting in beer with a low alcohol content and undesirable flavor [
20,
21]. The careful control of the fermentation temperature is considered essential for producing high-quality beers [
11].
The mathematical models governing fermentative systems are generally considered nonlinear [
22,
23], multivariable, and highly coupled [
24], making optimization a complex challenge in modern engineering [
25]. In efforts to assist the brewing industry in improving both process efficiency and product quality, various temperature profiles have been developed [
26]. Additionally, historical simulations have been utilized to predict the optimal operating conditions for achieving higher yields [
27]. Complex objective functions have been developed to account not only for the final ethanol concentration, but also for flavor-degrading compounds such as diacetyl and ethyl acetate, along with mechanisms to ensure smooth and bounded signals. Various optimization strategies have been proposed to determine the ideal fermentation temperature profile in beer production [
27]. An evolutionary algorithm was employed by Andrés-Toro et al. [
24] to optimize eight fermentation goals, resulting in improved process control, smoother temperature profiles, and reduced fermentation time. However, the implications of refrigerant demand were not fully considered, which impacted process efficiency. An evolutionary algorithm was also used by Carrillo-Ureta et al. [
27] to optimize the temperature profile, achieving a global optimum, though the resulting profile was deemed too variable for practical applications. Similarly, an ant colony algorithm was applied by Xiao et al. [
28], yielding an optimal profile, yet its variability was considered impractical. Although a smoothing procedure was attempted, a completely satisfactory solution for the industry has not yet been achieved. The variability in the profiles obtained in these studies has also affected the biological process and requires a subsequent smoothing stage.
In this work, a novel approach originally developed by our research group [
29,
30,
31,
32,
33] is applied to efficiently parameterize the optimal temperature profile. This technique consists of approximating the optimal control action with an orthonormal polynomial. Then, by a basis change, employing the Fourier series, this polynomial is approximated, allowing a reduction in the number of parameters needed to describe the control action, resulting in a significant reduction in the complexity of the optimization problem. Moreover, continuous and differentiable profiles are obtained, which can be directly applied in real systems without the need for signal smoothing techniques. For the parameter optimization, a hybrid methodology proposed by our research group in a previous work [
33] is employed. The application of this strategy in dynamic optimization problems allows for solutions to be obtained in a very simple and efficient manner compared to conventional techniques, making it a valuable tool for research and development in this field.
2. Materials and Methods
2.1. Fermentation Model
Industrial beer production involves a controlled fermentation process of wort, which is a complex solution of sugars obtained primarily from barley malt. In addition to glucose, the wort contains a variety of other sugars such as maltose, sucrose, and dextrin, which are products of starch hydrolysis during the malt mashing process.
During alcoholic fermentation, carried out by yeasts, these different sugars are metabolized at different rates and with varying efficiencies, contributing to the complexity of the flavor profile of the final beer. However, glucose remains the main carbon source for the production of ethanol and carbon dioxide, according to the following overall chemical reaction [
34]:
The presence of other sugars in the wort not only influences the flavor and aroma of the beer but can also affect its body, foam retention, and other sensory attributes. The brewmaster’s ability to control and optimize the fermentation process is crucial to achieving the desired profile in the final beer.
In this work, a dynamic model of beer production by de Andrés-Toro et al. (1998) [
35] was used. The model incorporates seven state variables, defined in Equations (1)–(7), with their evolution determined by temperature-sensitive production and consumption mechanisms, as outlined in Equations (8)–(12). These state variables correspond to critical chemical species, as detailed in
Table 1 and
Table 2. Yeast cells progress through stages from latency to activity, and eventually to cell death, with fermentation—the conversion of sugars into ethanol—occurring exclusively during the active phase. The model also accounts for two by-products generated alongside the main fermentation process: ethyl acetate in Equation (6) and diacetyl compounds in Equation (7). Diacetyl (2,3-butanedione) is recognized for its intense buttery aroma [
36], whereas ethyl acetate, often serving as an indicator of ester presence, is characterized by an odor reminiscent of nail polish remover. Further elaboration on the model, including the constants for the Arrhenius equation in Equation (13) that defines the temperature dependence of the parameters, can be found in the original publication.
2.2. Optimization Problem Statement
The challenge in dynamic optimization for beer production lies in finding an optimal fermentation temperature profile that is smooth and continuous while maximizing ethanol production and minimizing the formation of diacetyl and ethyl acetate. These goals are defined by the following statement:
where
J is the objective function and
α,
β, and
γ are weighting coefficients that present the relative importance of the terms.
The initial conditions for the dynamic simulation of beer fermentation were directly obtained from [
11] to ensure a strict comparison with the reference. The inoculum Xinc is composed of 50% dead cells, 48% lag-phase cells, and only 2% active cells. Xinc: pitching rate is 4 g/L, S: Sugar concentration 130 g/L.
2.3. Dynamic Optimization Strategy
The proposed strategy for dynamic optimization was originally designed by our research group [
30]. The technique’s hypothesis assumes that the optimal profile of the manipulated variable, still unknown, is a continuous or piecewise continuous function, and can be approximated using a function in the Hilbert space L2 [0;
tf], where
tf is the final time. According to the fundamental definition of space, the optimal control function can be expressed as a linear combination of the base elements. Two bases that are part of this space are:
The Fourier trigonometric basis:
and the orthonormal base:
Therefore, the optimal control action can be approximated with an orthonormal polynomial basis, obtained by Gram–Schmidt orthogonalization of the base
B′ = {1,
t,
t2,
t3, …} and subsequent normalization.
Thus, the approximate control action
Uopt (t) is a linear combination of the polynomial basis
B:
where
c0, c1, …, cn are the coefficients of the polynomial and
n is the order of the polynomial.
Better performance in parameter searches is achieved by having an intermediate stage designed to approximate the orthonormal polynomial with the Fourier series, thus reducing the number of parameters to be optimized. This is because, when the function to be approximated is smooth, satisfactory approximation can be achieved with the first terms of the Fourier series. Details of the proposed strategy can be seen in [
29].
where
d0, rk, qk are the Fourier coefficients. Taking into account that this is an orthogonal basis, as in Equation (15). Then, combining Equation (17) with Equation (18), the polynomial coefficients are computed as follows:
For example, if the polynomial is a constant:
For
l = 1, the following is added:
Note that, for a lineal polynomial, only
a0 and
b1 are needed. For
l = 2, the following is added:
The technique employed stands out for its ability to generate continuous and derivable profiles, crucial in bioprocesses to avoid cellular stress. Additionally, a minimum number of parameters (from 3 to 6) are used for optimization. Once the approximation function has been designed, the remaining step is to apply a parameter optimization strategy to maximize the objective function.
2.4. Parameter Optimization
The parameter optimization methodology employed in this work was originally designed by the research group [
33]. It is a hybrid algorithm that combines the Monte Carlo method with genetic algorithms, in which, initially, a population of individuals is generated using the former. Then, the best individuals are selected, and finally, this selected group of individuals is refined through genetic algorithms.
The Monte Carlo algorithm is a random algorithm that makes random choices to produce a result. This implies that it can yield either higher or lower indices, and so is subject to probability. In this methodology, the probability of finding the optimum is limited. One way to increase this probability is simply by running the algorithm repeatedly (N times) with independent random parameter choices each time. Therefore, to generate the initial population of individuals, firstly, the parameters to be optimized are defined. Then, the number of simulations to be performed (N) is determined, i.e., the size of the initial population. A value is randomly assigned to each parameter, with the advantage that, being Fourier parameters and of decreasing amplitude, these values are approximately bounded within the allowed limits for the control action. For each set of parameters (individual) proposed, the process is simulated, and J is calculated. Finally, the individuals are sorted in decreasing order according to the value of J.
In this way, the initial population of N individuals has been generated, from which the first M, usually M = 50, are selected, corresponding to the generation of “parents” used to start optimization with genetic algorithms.
Genetic algorithms are evolutionary methods used to solve search and optimization problems. Basically, the algorithm works with a population of individuals, each of which represents a feasible solution to the given problem. Each individual is assigned a value or score (selection), related to the goodness of that solution, and through algorithm-specific operations (crossover, mutation), the modified individuals form new generations that allow the evolution of the system in search of the optimal value [
37].
The Fourier parameters are assumed to be real numbers; therefore, a direct value encoding is used. That is, the value of the parameter was directly employed without using binary encoding. Thus, each individual is composed of a set of parameters with their real value, and they are affected by the operations of the algorithm. The methodology for selecting the most capable individuals in each generation is carried out through elitist selection, in which the best individual or some of the best are copied into the new population. For crossover or reproduction, the single-point technique is used, where the two parent chromosomes (parameters) are cut at one point, and genetic information is copied from one parent from the beginning up to the crossover point and the rest is copied from the other parent. For the mutation operation, a position in the chromosome is chosen, and this value is randomly changed. In order to solve the problem, a maximum number of iterations can be set before terminating the algorithm or stop it when no further changes occur in the population (algorithm convergence).
3. Results
The optimization algorithms developed in this study were rigorously evaluated through several simulations. The results were compared with those reported in the existing literature. The optimal temperature profiles obtained in this work were assessed at the optimal final times documented by other authors in the references. Matlab and Simulink were employed, providing a robust platform for the optimization process.
As mentioned earlier, the manipulated variable available for the process under study is temperature, and the optimization objective is to maximize the final concentration of ethanol while minimizing the concentration of undesired species affecting the organoleptic characteristics of beer, such as diacetyl and ethyl acetate. The optimal function of the control variable is approximated using second, third, and fourth-order polynomials. Therefore, three or five parameters were used for the parametrization of the control vector, respectively. Parametric optimization was carried out considering 5000 simulations for Monte Carlo, then an initial population of N = 200 individuals was taken to develop the genetic algorithm procedure. Twenty individuals were allocated for elitist selection, and 40% of the remaining for crossover, 40% for mutation, and 20% for random sets. Eighty generations of genetic algorithms were simulated, reaching convergence in approximately 30 simulations.
3.1. Polynomial Order Selection
Considering that the temperature variation during fermentation should be smooth, low-order polynomials were evaluated. The optimal performance indices obtained using second, third, and fourth-order polynomials were J = 31.443, J = 31.4429, and J = 31.4425 respectively. These three indices resulted from simulating the process for tf = 160 h, demonstrating that it is better to work with a second-order polynomial since it has only three parameters and does not yield significant differences compared to the other evaluated polynomials, which have more parameters to optimize. Therefore, a second-order polynomial was used to simulate all profiles presented throughout this work.
3.2. Optimization and Evaluation of Temperature Profiles
Comparison with Dynamic Simulation of Industrial Fermentation
Comparing the industrial manipulation reported in the literature [
11] to the profiles simulated in this work,
Figure 1 shows a comparison between the optimal temperature profiles and the evolution of diacetyl, ethyl acetate, and ethanol. Both profiles were simulated for a final time (
tf) of 160 h. The corresponding numerical values are detailed in
Table 3. It is noteworthy that the industrial temperature curve (dashed line) exhibits abrupt changes, whereas the obtained profile (solid line) is smooth throughout its trajectory. This finding is significant as it indicates that the entire fermentative, kinetic, and cooling process will not experience inherent stress related to the selected manipulated variable.
The results in
Table 3 present a comparative analysis between the optimized beer fermentation process and the conventional industrial method described by Rodman [
11]. The optimized process demonstrated significant improvements in several key parameters. The diacetyl (DY) concentration was reduced to 0.004 ppm, in contrast to 0.06 ppm in the industrial process. Similarly, ethyl acetate (EA) levels were slightly reduced from 1.16 ppm in the conventional method to 1.14 ppm, indicating an enhancement in the sensory quality of the beer by minimizing undesirable compounds. In addition to reducing by-product formation, the optimized fermentation process achieved a 1.24% increase in ethanol production, reaching 59.74 g/L, compared to 59 g/L in the conventional method.
3.3. Optimization at tf = 113.5 h
The current goal is to compare the results achieved through the optimization technique developed by our research team with those documented in [
11]. The optimal fermentation time of 113.5 h, as published in [
11], is adopted as the endpoint for the optimization approach. This analysis is focused solely on the comparison of outcomes, rather than on the optimization methods themselves. A temperature profile is being established to enhance ethanol production while minimizing the concentrations of diacetyl and ethyl acetate, ensuring that the profile is smooth, continuous, and differentiable.
In the study conducted by Rodman, optimization techniques, including simulated annealing (SA) and exhaustive evaluation (EE), were employed, leading to a profile that exceeded industrial standards by reducing fermentation time while maintaining the concentrations of aromatic substances below perceptible thresholds, as shown in
Table 4. However, the resultant profile was found to be non-differentiable at certain points and lacked the necessary smoothness, making it unsuitable for industrial applications without further modifications. As a result, the fermentation process would inevitably follow a suboptimal trajectory, regardless of any adjustments made to the fermenter’s cooling system. The temperature profile developed in this study is characterized by its smooth, continuous, and differentiable nature. Notably, the need for penalties or additional optimization indices to address non-smoothness was eliminated, as the proposed strategy inherently accounts for this during parameterization.
The approach proposed by Rodman [
11], aligns with the primary objective of this study, as both focus on maximizing ethanol yield while minimizing the production of undesirable by-products. This study demonstrates a 1.43% increase in ethanol production, rising from 59.1 g/L in Rodman’s work to 59.95 g/L. This improvement is significant, particularly as it was achieved while simultaneously reducing the concentrations of diacetyl (DY) from 0.09 ppm to 0.007 ppm and achieving a modest decrease in ethyl acetate (EA), from 1.35 ppm to 1.34 ppm. The comparison of the optimal manipulated profiles can be seen in
Figure 2.
4. Conclusions
This study employs a validated beer fermentation model to predict species concentration evolution throughout the fermentation process. The primary focus is the dynamic optimization of beer fermentation by determining an optimal temperature manipulation profile. This profile was optimized to maximize ethanol production while minimizing undesirable byproducts such as diacetyl (DY) and ethyl acetate (EA). The results were compared with previous studies, highlighting the potential for the practical implementation of this approach.
A novel control action parameterization strategy was employed, yielding smooth, continuous, and differentiable temperature profiles. Notably, optimization required only three Fourier parameters, underscoring the method’s computational efficiency. This approach presents a promising solution for optimal control problems that demand smooth and continuous control trajectories. By adjusting the number of sine and cosine terms in the Fourier series, this methodology can be adapted to a wide range of optimization problems. Furthermore, the proposed method significantly reduces computational processing times compared to conventional techniques, making it particularly advantageous for real-world brewing applications.