## 2 Materials and Methods
### Improvements on the Update Rule  
Intelligence algorithms have been used in the field of optimization [46; 47; 48]. CSA was proposed by [PERSON], which is able to imitate the process of chameleons capturing prey to solve global optimization problems and has higher flexibility and adaptability in dynamic adjustment compared with other heuristic algorithms [49]. Although CSA has been used to solve the problem of scheduling, it has not been applied in the area of beer production. Additionally, CSA has been used by many researchers as a tool for optimization [50; 51; 52]. However, this algorithm may not be able to handle coupling well. As a result, in this paper, CSA was applied as the update rule during the process of iteration.  
CSA will be applied once every 6 iterations to update the optimal solution, instead of applying CSA every update, to ensure that the final optimization result meets the constraints. The process of updating with CSA begins with the chameleon searching for prey and will repeat until the value of maximum iteration, which has been set in advance of CSA being reached. The relevant formula for the update rule is shown below:  
\[z_{t+1}^{ij}=\left\{\begin{aligned} z_{t}^{i,j}+p_{1}\Big{(}P_{t}^{i,j }-G_{t}^{j}\Big{)}r_{2}+p_{2}\Big{(}G_{t}^{j}-y_{t}^{j,j}\Big{)}r_{1},& r_{i}\geq 0.1\\ z_{t}^{ij}+\mu\Big{(}(u^{j}-l^{j})r_{3}+l_{b}^{j}\Big{)}sgn(r_{i}-0.5),& r_{i}<0.1\end{aligned}\right. \tag{11}\]  
Formula (11) represents the process of a chameleon searching for prey. \(z_{t}^{i,j}\) is obtained by the optimal solution in the last iteration of the improved CO at first, and \(z_{t+1}^{i,j}\) represents the current and next position of chameleon i in dimension j. G is the current optimal individual position; P is the best position so far for the _i_th chameleon; \(p_{1}\) and \(p_{2}\) are two parameters that control exploration capabilities; \(r_{1}\), \(r_{2}\), \(r_{3}\), and \(r_{i}\) are all random numbers within [0,1]; u, 1 represent the upper and lower limits of the _j_th dimension, respectively. \(sgn(r_{i}-0.5)\) is 1 or \(-1\), which mainly affects the directions of exploration and development. The calculation method of \(\mu\) is:  
\[\mu=e^{(-\frac{3.5t}{T})^{3}} \tag{12}\]  
In this formula, t is the current iteration number of CSA and T is the maximum iteration number of CSA. The speed at which the tongue of a chameleon lands on its prey is defined as below:  
\[v_{t+1}^{ij}=w\cdot v_{t}^{ij}+c_{1}\Big{(}G_{t}^{j}-z_{t}^{i,j}\Big{)}r_{1} +c_{2}\Big{(}P_{t}^{i,j}-z_{t}^{i,j}\Big{)}r_{2} \tag{13}\]  
In the formula, \(v_{t}^{ij}\) and \(v_{t+1}^{ij}\) represent the current and next velocity of the _i_th chameleon in the _j_th dimension. \(r_{1}\) and \(r_{2}\) are random values within [0,1]. \(c_{1}\) and \(c_{2}\) are equal to 1.75 and \(\rho\) is equal to 1. This value has been used for the purpose of testing the ability of the CSA in Ref. [49]. The update method for w is:  
\[w=\left(1-\frac{t}{T}\right)^{\rho\sqrt{\left(\frac{t}{T}\right)}} \tag{14}\]According to the law of motion, Formula (15) is obtained:  
\[z_{t+1}^{i,j}=z_{t}^{i,j}+\frac{\left(v_{t}^{i,j}\right)^{2}-\left(v_{t-1}^{i,j} \right)^{2}}{2a} \tag{15}\]  
\[a=2590\Big{(}1-e^{-\log{(t)}}\Big{)} \tag{16}\]  
In these formulas, a is the acceleration during the process of the motion of the tongue. \(z_{t+1}^{i,j}\) will be brought into the fitness function, the objective function of the optimization problem, and the corresponding value will be calculated. Then, the value of \(z_{t+1}^{i,j}\) will be transferred to \(z_{t}^{i,j}\) in Formula (16). This process will be repeated continuously until the set maximum iteration number of CSA is reached and a series of values for the fitness function will be obtained. Among these values, the best value will be found and the \(z_{t+1}^{i,j}\), which corresponds to it, is the conclusion of the update rule.