Beer Organoleptic Optimisation: Utilising Swarm Intelligence and Evolutionary Computation Methods
BBeer Organoleptic Optimisation:
Utilising Swarm Intelligence and Evolutionary Computation Methods
Mohammad Majid al-Rifaie ∗ Marc Cavazza
University of GreenwichSchool of Computing and Mathematical Sciences { M.AlRifaie, M.Cavazza } @ gre.ac.uk Abstract
Customisation in food properties is a challenging task involving optimisation ofthe production process with the demand to support computational creativity whichis geared towards ensuring the presence of alternatives. This paper addresses thepersonalisation of beer properties in the specific case of craft beers where theproduction process is more flexible. We investigate the problem by using threeswarm intelligence and evolutionary computation techniques that enable brew-ers to map physico-chemical properties to target organoleptic properties to designa specific brew. While there are several tools, using the original mathematicaland chemistry formulas, or machine learning models that deal with the processof determining beer properties based on the pre-determined quantities of ingre-dients, the next step is to investigate an automated quantitative ingredient selec-tion approach. The process is illustrated by a number of experiments designingcraft beers where the results are investigated by “cloning” popular commercialbrands based on their known properties. Algorithms performance is evaluated us-ing accuracy, efficiency, reliability, population-diversity, iteration-based improve-ments and solution diversity. The proposed approach allows for the discovery ofnew recipes, personalisation and alternative high-fidelity reproduction of existingones.
The optimisation of food production processes, besides its real-world significance, is faced with theapparently contradictory challenge of finding solutions to meeting precise characteristics as well asoffering some diversity of solution which reconstruct the diversity of tastes and preferences. Giventhe presence of several viable solutions when optimising food processes, this real-world problemposes itself as a challenging task with an inherently underdetermined characteristic [15, 31]. Inthis work, we propose swarm intelligence and evolutionary computation techniques as the meansto identify high quality and diverse solutions. This paper applies three population-based algorithms– particle swarm optimisation (PSO) [23], dispersive flies optimisation (DFO) [1], and differentialevolution (DE) [35] – for optimising beer recipes based on pre-determined organoleptic properties.The complexity of the brewing process necessitates an often strict adherence to existing recipesand the associated instructions with the aim of reducing mishap chances and to avoid costly guess-works [33]; this is especially the case when the primary goal is the production of a beer with partic-ular organoleptic characteristics.This work enables the use of an automated quantitative ingredients selection , which as of today,constitutes one of the primary experimental aspects of brewing. In this paper, Section 2 presents ∗ Corresponding author. a r X i v : . [ c s . N E ] A p r revious and related work, followed by introducing some key concepts, terminology and formulaswhich determine the fermentation process, from which the fitness value for the optimisation methodsis determined. This is then followed by presenting the three swarm intelligence and evolutionarycomputation methods in Section 3. Subsequently, Section 4 proposes several experiments alongwith the experiment setup and performance measures to evaluate the performance of the optimiserswith real-world input. Section 5 reports on the experiments results and provides discussion onthe algorithms’ performance when optimising three “cloned” beer properties over the performancemeasures, solution vectors diversity, iteration-based improvements and solution clustering. Finally,the paper is concluded by presenting ongoing and future work. The process of beer brewing has attracted various attempts at optimising or automating differentelements of the process. These have however most often considered specific relationships or causalrelationships between ingredients and isolated properties known to play a significant role in con-sumers’ preferences (e.g. foamability). Ermi et al. [17] explore two deep learning architectures tomodel the non-linear relationship between beer in these two domains with the aim of classifying coarse- and fine-grained beer type and predicting ranges for original gravity, final gravity, alcoholby volume, international bitterness units and colour .Another research is conducted for beer foamability [37] where robotics and computer vision tech-niques are combined with non-invasive consumer biometrics to assess quality traits from beer foam-ability. Furthermore, in another study [19], an objective predictive model is developed to investigatethe intensity levels of sensory descriptors in beer using the physical measurements of colour andfoam-related parameters where a robotic pourer, was used to obtain some colour and foam-relatedparameters from a number of different commercial beer samples. It is claimed that this methodcould be useful as a rapid screening procedure to evaluate beer quality at the end of the productionline for industry applications.Using various AI techniques, several other predictive studies are presented concerning fermenta-tion, monitoring and control [26, 36], controlling of beer fermentation process using population-based optimisers [7], predicting beer flavours [39], measurement and information processing in abrewery [11] and predicting aceticacid content in the final beer [40].This work aims at utilising population-based methods in a way that would facilitate the discovery ofvariants or novel recipes for some target properties of the brew. In the brewing process, ingredients are divided in three broad categories: hops, fermentables oryeasts. In addition to weight, several other relevant features are also needed to calculate their impactin the brewing process (e.g. hop’s alpha and beta; fermentable’s yield, colour, moisture and diastaticpower; yeast’s minimum and maximum temperatures, and attenuation). Beer’s taste changes signif-icantly depending on the exact quantities and varieties of ingredients and their timing in the process.The key physio-chemical properties which contribute towards computing the fitness value of the so-lutions are alcohol by volume (ABV), bitterness (IBU) and colour which are used by the optimiserto determine the suitability of each proposed solution. From a food science perspective, the brewingprocess, although in some parts empirical, has been the subject of many descriptions and partial for-malisation which are however sufficient to derive relevant equations. More specifically, a number offormal relationships between ingredients and target organoleptic properties are sufficiently specificto support the generation of fitness functions. Some of the relevant formulas are discussed next.
ABV = f ( OG , FG ) and is defined as [30]:ABV = 131 . × ( OG − FG ) (1)When ABV is above or the following is used which provides a higher level of accuracy [20, 13]:ABV = 76 .
08 ( OG − FG ) FG .
794 (1 . − OG ) (2) Note that ABV is a function of OG and FG (see Section 2.1). ABV: 5.01 % IBU: 40.03 Color: 39.99
Identified properties: Error: 0.0741 User defined properties:
ABV: 5.0 % IBU: 40 Color: 40
No of ingredients: 8
HOPS: Existing Amounts
Chinook 100 gMagnum 40 g Magnum 3 g
FERMENTABLES:
Pale Malt 7 Kg
YEAST:
Safale S-04 11 mLCara-Pils/Dextrine 1 KgWheat Malt 2 KgMunich Mal 3 KgRoasted Barley 0.5 Kg
Amounts to use
Chinook 11 gPale Malt 2.94 KgCara-Pils/Dextrine 0.03 KgWheat Malt 0.30 KgMunich Mal 0.26 KgRoasted Barley 0.25 KgSafale S-04 3 mLNorthern Brewer 100 g Northern Brewer 10 gFuggles 50 g Fuggles 3 gCascade 100 g Cascade 5 gCaramel/Crystal Malt 1 Kg Caramel/Crystal Malt 0.74 KgBiscuit Malt 0.5 Kg Biscuit Malt 0.29 KgChocolate Malt 0.5 Kg Chocolate Malt 0.33 KgPilsner 5 Kg Pilsner 0.40 KgBarley Flaked 0.5 Kg Barley Flaked 0.34 Kg
Figure 1: Schematic view of the brewing process optimisation. The control panel on top-left cornertakes users’ desired values, and the top-right panel shows the corresponding optimal values foundso far based on the ingredients in the inventory. The lines represent each of the in-stock items andthe circles indicate the suggested quantities.
IBU is determined by taking into account the bitterness produced by hops or the hop extracts (fromthe fermentables), thus IBU = f ( (cid:126) hops , (cid:126) fermentables , volume ) . The bitterness produced by hop iscalculated as follows:IBU h = N h (cid:88) i =1 w i α i (1 − exp − . t i )4 . v . × . ( OG − (3)where N h is the number of hops; w represents the weight; v is the volume or batch size; t is time inminutes; and fermentables’ bitterness is defined as:IBU f = N f (cid:88) i =1 g i w i v (4)where N f is the number of fermentables; and g is ‘IBU gal per lb’ which is associated with eachfermentable and is known for each ingredients. The final IBU is the sum of the individual IBUs:IBU = IBU h + IBU f . IBU/GU is often described in the following categories: cloying, slightly malty, balanced, slightlyhoppy, extra hoppy, and very hoppy. IBU/GU = f ( OG , IBU ) :IBU/GU = IBU OG − (5) Colour is mainly determined by malts and hops. The two main protocols to measure colour areStandard Reference Method (SRM) and European Brewing Convention (EBC). Table 1 shows rep-resentative colours. SRM, which is used in this work, was initially adopted in 1950 by the AmericanSociety of Brewing Chemists. The value of SRM is determined by measuring the attenuation oflight of a particular wavelength ( nm) in passing through cm of the beer, expressing the attenu-ation as an absorption and scaling the absorption by a constant ( . for SRM or for EBC, whereEBC = SRM × . ).Stone and Miller [34] proposed malt colour unit (MCU), which is defined as:MCU = N f (cid:88) i =1 c i w i v (6)where c refers to grains’ colour (fermentables’ colour). As shown in the equation above, for morethan one grain type, the MUC is calculated for each and all the values are summed.3 RM EBC Colour
Table 1: Beer colour in SRM and EBC valuesHowever, MUC tends to overestimate the colour value for darker beers (MUC > . ). Thus,Morey [27] derived an equation to deal with SRM up to 50:SRM = 1 . N f (cid:88) i =1 c i w . i v (7)where c refers to grains’ colour (fermentables’ colour).One of the key contributions of this work is the application of a suite of population-based algorithmswhich take an in-stock inventory of existing ingredients and their quantities (see Table 2) along witha desired set of physico-chemical features of a beer, and as output return an optimal set of ingredientlist and their associated quantities which facilitate the production of a target beer with the desiredorganoleptic properties (see Figure 1). The algorithms used in this work are particle swarm optimisation (PSO) [23] as one of the most well-known swarm intelligence algorithms; Differential evolution (DE) [35], a well-known and efficientevolutionary computation method; and a minimalist component-stripped swarm optimiser, disper-sive flies optimisation (DFO) [1], which solely relies on particles’ positions at time t to generate thepositions for time t + 1 (therefore not using additional vectors, such as PSO’s memory and velocity,or DE’s mutant and trial vectors) . The standard versions of these algorithms are used, thereforeallowing performance comparisons between these simple yet powerful optimisers. For each of thesealgorithms the position vector of each member of the population is defined as: (cid:126)x ti = (cid:2) x ti , x ti , ..., x ti,D − (cid:3) , i ∈ { , , , ..., N-1 } (8)where i represents the i th individual, t is the current time step, D is the problem dimensionality, and N is the population size. For continuous problems, x id ∈ R (or a subset of R ).In the first iteration, where t = 0 , the i th member’s d th component is initialised as: x id = U ( x min ,d , x max ,d ) (9) It was demonstrated that despite DFO’s simplicity, it exhibits a competitive performance when comparedwith the standard versions of PSO [23], GA [18] and DE [35] on a set of benchmarks over three performancemeasures of error, efficiency and reliability [1]. It was shown that DFO is more efficient in 85% and more re-liable in 90% of the standard optimisation benchmarks used; furthermore, when there exists a statisticallysignificant difference, DFO converges to better solutions in 71% of problem set. Furthermore, DFO has beenapplied to various problems, including but not limited to medical imaging [2], optimising machine learningalgorithms [5, 6], training deep neural networks for false alarm detection in intensive care units [29], com-puter vision and quantifying symmetrical complexities [4], identifying animation key points from medialnessmaps [8] and analysis of autopoiesis in computational creativity [3].DFO’s source code can be found at https://github.com/mohmaj/DFO : v t +1 id = χ (cid:0) v tid + c r (cid:0) p id − x tid (cid:1) + c r (cid:0) g id − x tid (cid:1)(cid:1) : x t +1 id = v t +1 id + x tid : x t +1 id = f ( v t +1 id , p id , g d , x tid ) DFO : x t +1 id = x ti n d + u ( x tsd − x tid ): x t +1 id = f ( (cid:126)x td ) DE : v t +1 id = x tbest,d + F (cid:0) x tr d − x tr d (cid:1) : u t +1 id = v tid , if r ≤ CR or d = U (0 , x tid , otherwise: x t +1 id = f ( v t +1 id , u t +1 id , (cid:126)x td ) where for PSO, χ is the constriction factor which is set to . [9]; v tid is the velocity of particle i in dimension d at time step t ; c , are the learning factors (also referred to as acceleration constants)for personal best and neighbourhood best respectively; r , are random numbers adding stochasticityto the algorithm and they are drawn from a uniform distribution on the unit interval U (0 , ; p id isthe personal best position of particle (cid:126)x i in dimension d ; and g d is swarm best at dimension d . InDFO, which uses a ring topology, (cid:126)x i n is the position of (cid:126)x i ’s best neighbouring individual, (cid:126)x s is theposition of swarm ’s best individual where s ∈ { , , , ..., N-1 } , u is a random number drawn froma uniform distribution on the unit interval U (0 , ; the diversity of population in DFO is maintainedby a component-wise jump which is triggered when U (0 , < ∆ where ∆ = 0 . . For DE’smutant vector (DE/best/1), v id is d th gene of the i th chromosome’s mutant vector ; u id is d th geneof the i th chromosome’s trial vector; r and r are different from i and are distinct random integersdrawn from the range [0 , N − ; and x tbest,d is the d th gene of the best chromosome at generation t ;and F is a positive control parameter for constricting the difference vectors which is set to . . Thecrossover operation in DE, improves population diversity through exchanging some componentsusing the crossover rate (CR), which is set to . . Elitism is used for DFO and DE, with an elite sizeof one maintaining the best found solution. In this work, if the updated position for a dimension isoutside the boundaries, its value is clamped to the edges. This section presents a set of experiments where physico-chemical properties of three commercialbeers (i.e. Guinness Extra Stout, Kozel Black, Imperial Black IPA) are used along with the in-stockinventory to evaluate the proposed system by “reverse manufacturing” these commercial beers fromtheir target physico-chemical properties. Figure 1 shows the schematic view of the developed systemwith regard to user input vectors and expected vector output. The list of ingredients in this experi-ment is shown in Table 2, and the desired physio-chemical properties for this set of experiments arederived from three existing commercial beers as shown in Table 3.The experiments reported in this section, compare the results of the optimisers over each product.This is then followed by another set of experiments investigating the behaviour of the algorithmsin terms of iteration-based improvements throughout the optimisation process. The solution vectorsdiversity for each of the optimisers over each product is investigated. Additionally, to further evalu-ate the solution vectors diversity, distinct solution clusters are generated by each algorithm and foreach product. Vector (cid:126)v in PSO and DE are different, albeit they carry the same name in the literature. ype Name Amount Table 2: List in-stock inventory
Name ABV IBU SRM Origin
Guinness Extra Stout 5.00 % 40 40 Dublin, IrelandKozel Black 3.80 % 15 24 Prague, CzechImperial Black IPA 11.20 % 150 35 Ellon, Scotland
Table 3: Sample beer characteristics in three products
In order to set up the simulation experiment, a realistic inventory of a home brewer in Table 2along with physio-chemical properties of three existing commercial beers in Table 3 are used as thebenchmark and the analyses are investigated on that basis. In these experiments, the population sizefor each algorithm is set to and termination criterion is set to either reaching , functionevaluations (FEs) or reaching a corresponding error depending on the product being optimised, witherror less than or equal to . , . , . , for Guinness Extra Stout, Kozel Black andImperial Black IPA respectively . There are 50 Monte Carlo simulations for each experiment andthe results are summarised over these independent simulations. In order to measure the presence of any statistically significant differences in the performance of thealgorithms, and for pairwise statistical comparisons, Wilcoxon × non-parametric statistical testis deployed [38]. The performance measures used in this paper are error, efficiency, reliability anddiversity. Error or accuracy is defined by the quality of the best member in terms of its closeness tothe optimum position (i.e. minimisation).E
RROR = f ( (cid:126)x ) = N p (cid:88) i =1 (cid:113) ( f p i ( (cid:126)x ) − p ∗ i ) (10)where (cid:126)x is the list of ingredients and N p = 3 is the number of parameters; p : ABV, p : IBU, p : Colour, where the relevant equations are provided in Section 2.1; p ∗ i represents the desired value These values are the best found values irrespective of the algorithm choice or number of function evalua-tions and are therefore used as the base optima. S u gg e s t e d i n g r e d i e n t s c o m b i n a t i o n s S u gg e s t e d i n g r e d i e n t s c o m b i n a t i o n s S u gg e s t e d i n g r e d i e n t s c o m b i n a t i o n s Figure 2: Ingredients combinations generated by PSO for three products, illustrating recommendedingredients uptake proportion, as well as independent solutions’ diversity for each of the product.provided by the brewers and the termination criterion for each run is dependent on the problem itself.Another measure used is efficiency which is the number of function evaluations before reaching aspecified error, and reliability is the percentage of trials where a specified error is reached.E
FFICIENCY = 1 n n (cid:88) i =1 FEs , (11)R ELIABILITY = n (cid:48) n × (12)where n is the number of trials in the experiment and n (cid:48) is the number of successful trials. Addition-ally, diversity , is used to study the population’s behaviour with regard to exploration and exploita-tion. There are various approaches to measure diversity. The average distance around the populationcentre is shown to be a robust measure in the presence of outliers [28]:D IVERSITY = 1 N N (cid:88) i =1 (cid:118)(cid:117)(cid:117)(cid:116) D (cid:88) d =1 ( x id − ¯ x d ) , (13) ¯ x d = 1 N N (cid:88) i =1 x id (14)where N is the population size, and ¯ x d is the average value of dimension d over all members of thepopulation. For these experiments, the brewer’s efficiency is set to , boil size of L, batchsize of L and boil time is set to minutes. This section reports the results outlined in the experiments section where algorithms’ performancesare contrasted using the performance measures, as well as iteration-based improvements. This isthen followed by investigating the diversity of the solution vectors which are generated by eachoptimiser for each product, as well as studying the distinct solution clusters within each optimiser-product pair. To demonstrate the process, Figure 2 illustrates solution vectors for each of theproducts (i.e. Guinness Extra Stout, Kozel Black and Imperial Black IPA) which are generated byPSO. These vectors visualise various viable ingredients combinations and the uptake of each of the ingredients when reaching the termination point. Algorithms performance are initially compared over each product independently; this is then fol-lowed by summarising the findings over all products. When optimising Guinness Extra Stout, inthe 50 independent trials (Table 4) all three algorithms, in some or all trials, reach the optimum Efficiency, in home-brewing context, indicates how efficient the equipment and processes are in extractingsugars from the malts during the mash stage. SO DFO DEError Best 0.0590 0.0590 0.0590Worst 1.7852 0.0870 0.1062Median 0.0590 0.0590 0.0590Mean 0.1209 0.0595 0.0599StDev 0.2795 0.0040 0.0067Efficiency Best 9900 3000 6766Worst 24800 17200 11940Median 17300 3800 8557Mean 17427.66 4389.80 8678.84StDev 3498.30 2460.46 1184.86Diversity Successful 0.9280 0.8125 0.0745Failed 4.75E-04 2.24E-05 3.36E-15Reliability Reliability 47 (94%) 49 (98%) 49 (98%)
Table 4: Guinness Extra Stout: algorithms performance for reverse brewing of the commercial beer
PSO DFO DEError Best 0.0706 0.0706 0.0706Worst 11.4080 0.0706 8.6517Median 0.0706 0.0706 0.0706Mean 1.3400 0.0706 0.5560StDev 2.5999 0.0000 1.5884Efficiency Best 8200 2900 6368Worst 19400 13300 11741Median 13000 4000 7960Mean 13357.58 4482.00 8348.52StDev 2810.03 1915.00 1202.83Diversity Successful 0.3375 0.6656 0.0183Failed 6.72E-04 – 3.15E-14Reliability Reliability 34 (68%) 50 (100%) 42 (84%)
Table 5: Kozel Black: algorithms performance for reverse brewing of the commercial beererror. In cases where the optimum is not found, PSO returns the highest error followed by DE (seeError → Worst in Table 4). In terms of efficiency (Efficiency → Mean), PSO is shown to be requiringthe largest number of function evaluations in the given problem, followed by DE. In other words,DFO is around twice as efficient as DE, which in turn is approximately twice as efficient as PSO.In terms of Kozel Black, as shown in Table 5, the algorithms exhibit the most varied performancein terms of error and reliability. While DFO reaches the optimum in all trials, PSO returns thehighest error among the algorithms and shows the least reliability of 68%. DFO exhibits efficiencyoutperformance, followed by DE. Considering the successful trials, DFO shows the highest diver-sity, followed by PSO while DE exhibits the least diversity (irrespective of whether the optimum isreached).The algorithms performance in terms of accuracy and reliability is comparable when optimisingImperial Black IPA (see Table 6). In terms of the efficiency, the same trend continues, with DFOmore than twice as efficient as DE, which is three times more efficient than PSO. Furthermore, PSOexhibits the largest FEs differences between successful trials. A potential contributing factor couldbe PSO’s highest population diversity, which is a subject of an ongoing research.8
SO DFO DEError Best 0.0050 0.0050 0.0050Worst 0.0050 0.0050 0.0050Median 0.0050 0.0050 0.0050Mean 0.0050 0.0050 0.0050StDev 0.0000 0.0000 0.0000Efficiency Best 28100 4900 12139Worst 73000 11800 19701Median 49850 6250 16915Mean 51022.00 6410.00 16739.88StDev 10347.91 1110.48 1442.11Diversity Successful 1.3158 0.8767 0.0515Failed – – –Reliability Reliability 50 (100%) 50 (100%) 50 (100%)
Table 6: Imperial Black IPA: algorithms performance for reverse brewing of the commercial beerWhile these observations are representative of the algorithms performance, it is also important toidentify areas with statistically significant differences between the algorithms. Using Wilcoxon test,Table 7b demonstrates that DFO is the most efficient algorithm with a statistically significant differ-ence from the other algorithms, and DE in the second place. This finding confirms the efficiency-related results reported in Tables 4, 5 and 6. In all instances, DFO is, at least, twice as efficient asDE, which in turn is, at least, 1.5 times more efficient than PSO (in Black Kozel, and 3 times moreefficient in Imperial Black IPA).Although the same trend continues for accuracy and reliability (see Tables 7a and 7c), more simi-larities between the algorithms are observed; for instance, there are no statistically significant dif-ferences between the accuracy outcomes when optimising Guinness Extra Stout, or Imperial BlackIPA. Furthermore, in terms of reliability, the algorithms exhibit consistent behaviour when optimis-ing Imperial Black IPA, all reaching the optimum accuracy in all trials.Speculating the reason behind the algorithms’ different performances, further studying the popula-tion diversity over different products could be helpful. For instance, when optimising Kozel Black(Table 5), population diversity in PSO and DE shrink by nearly a factor of and respectively fromthe diversity of successful population in the first product (Table 4), or by a factor of and fromthe third product (Table 6), while DFO maintains its near consistent population diversity. To bet-ter understand the algorithms’ underlying performance, the next section studies the iteration-basedimprovements in each algorithm-product pair. In the experiments conducted here, iterations yielding an improvement over their preceding iterationare logged. Figure 3 illustrates these improvements in the first iterations in independent trialsfor each of the algorithms when optimising the three products. It is shown that while PSO is lessefficient than the other algorithms (as shown in Tables 4, 5 and 6), it continuously improves on itscurrent solution almost in every iteration until it terminates, either by reaching the optimum value, orgetting trapped in a local minima. When optimising Imperial Black IPA, PSO shows iteration-basedimprovements in more than of the first iterations albeit failing in trials when optimisingGuinness Extra Stout. DFO and DE fail in trial each and exhibit a comparable iteration-basedimprovement behaviour for this product . Note that the number of iterations allowed before termination for DE (in case of failing the trials) is lessthan PSO and DFO, as DE calls the fitness function twice in each iteration: one for evaluating the ‘target’ vector( (cid:126)x ), and a second time to evaluate the mutated and crossed-over vector, the ‘trial’ vector ( (cid:126)u ). a) Error PSO – DFO PSO – DE DFO – DEGuinness Extra Stout – – –Kozel Black o – X o – X X – oImperial Black IPA – – – (b) Efficiency
PSO – DFO PSO – DE DFO – DEGuinness Extra Stout o – X o – X X – oKozel Black o – X o – X X – oImperial Black IPA o – X o – X X – o (c) Reliability
PSO – DFO PSO – DE DFO – DEGuinness Extra Stout 0 – 1 0 – 1 1 – 1Kozel Black 0 – 1 0 – 1 1 – 0Imperial Black IPA – – –
Table 7: Summary and statistical analysis. Based on Wilcoxon 1 × reliability measure, 0 – 1 indicates thatthe right algorithm is more reliable.Guinness Extra Stout Kozel Black Imperial Black IPA Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Iterations T r i a l s Figure 3: Improvements over iterations. Top to bottom: PSO, DFO and DE. Each black blockrepresents finding an improvement to the previously found solution. Blank blocks on the left of thered vertical lines indicate failed trials. As illustrated, PSO exhibits the largest number of continuous,iteration-based improvements (albeit gradual). DFO and DE are shown to have less continuousimprovements, with DFO presenting visible instances of escaping local minima for the first andsecond products.The figures show that DFO exhibits a larger number of attempts to escape from potential localminima (where there are no solution improvements for several iterations, followed by repeated im-provements as a result of escaping a potential local minima). This is visually evident in some trialsfor Guinness Extra Stout and Kozel Black. Escaping local minima could be a contributing factor inDFO’s higher reliability (see eq. 12), and therefore more optimal solution vectors which could beanalysed for their diversity.
To evaluate the uniqueness of the already generated solution vectors, distances between each pairof solutions are studied. These values are presented as distance matrices in Figure 4. One of thepractical implications of having ‘distant’ solutions is their potentially radically different ingredient-combinations. In other words, in some extreme cases, some ingredients might be used entirely inone solution vector while remaining untouched in another. Making practically ‘unique’ solutionsavailable to the user allows them to choose based on their priorities or future process plans. To nu-10 a) Guinness Extra Stout
PSO DFO DEMean 3.2620 3.3143 2.9441StDev 1.3330 1.2725 1.0936Min distance 0.5420 0.2506 0.4760Max distance 6.6126 6.8210 6.2258Farthest pair (9,29) (20,47) (31,33) (b) Kozel Black
PSO DFO DEMean 3.1823 3.0192 2.5479StDev 1.1757 1.1734 0.8733Min distance 0.1997 0.0201 0.4158Max distance 5.3978 5.7259 4.7637Farthest pair (28,31) (31,48) (15,20) (c) Imperial Black IPA
PSO DFO DEMean 3.8022 3.9033 3.2707StDev 1.5346 1.5551 1.2979Min distance 0.4379 0.5221 0.5176Max distance 9.1789 8.8227 7.7959Farthest pair (11,36) (15,42) (7,24)
Table 8: Solutions diversitymerically analyse the solution diversity for Guinness Extra Stout, Table 8a shows that DFO presentsthe most distant solutions on average, followed by PSO; this is reaffirmed with the maximum dis-tance found and is visually evident by comparing the upper bound of the colour bars in Figure 4-top,where the farthest pairs can be observed. As for Black Kozel (Table 8b), PSO exceeds in its averagesolutions diversity, followed by DFO, which however generates the two most distant solutions. Interms of the solution diversity for Imperial Black IPA (Table 8c), on the contrary to the previousproduct and along the line of the first, DFO exhibits the largest on-average diversity in its solutions,however PSO produces the farthest two solutions. In all products, DE is shown to be producingsolutions with the least distances.In summary, DFO has generated the most distant solutions in the first two products, and the largestaverage distances in the first and third product. To further visualise the algorithms’ behaviour, thedensity of the solutions distances (see Figure 5) shows that DFO is consistent in producing distantsolutions in all three products. The results in Figures 4 and 5 will be further discussed when solutionclusters are presented.
In order to further limit the distinct classes of solutions based on their propinquity, clustering is ap-plied, and therefore the challenge of selecting ‘unique’ solutions which are farther apart is reduced.This grants further freedom to the user in adhering to their other production priorities. To identifydistinct clusters, K-means [25] is utilised, and to find the best number of clusters for each of thecloned beer, twenty indices [12] (e.g. [10, 24, 22, 21, 14, 32, 16]) are used. The majority rule is thenapplied to find the best number of clusters as shown in Figure 6.As presented in Table 9a, when clustering the first product, Guinness Extra Stout, the most evenlydistributed clusters are created by DFO, however with the least majority, while PSO and DE have ahigher majority at the expense of returning an imbalanced number of solutions in each cluster. Thiscan be explained by observing the density of solution distances for the first product, where somesolution distances are more dense than others (see Figure 5) . When clustering the solutions forBlack Kozel, DFO produces clusters, the maximum number of clusters, and the highest majorityamong the optimisers. This can be explained as the density of the solution distances for this productis the widest for DFO; on the contrary, the narrowest solution distance density for this product11SO DFO DE Solutions1357911131517192123252729313335373941434547 S o l u t i o n s Solutions135791113151719212325272931333537394143454749 S o l u t i o n s Solutions135791113151719212325272931333537394143454749 S o l u t i o n s S o l u t i o n s Solutions135791113151719212325272931333537394143454749 S o l u t i o n s S o l u t i o n s Solutions135791113151719212325272931333537394143454749 S o l u t i o n s Solutions135791113151719212325272931333537394143454749 S o l u t i o n s Solutions135791113151719212325272931333537394143454749 S o l u t i o n s Figure 4: Solution vector distances. Top: Guinness Extra Stout; middle: Kozel Black and bottom:Imperial Black IPA. Observing the heatmaps and the associated colour bars, on average, DFO gen-erates the most varied solutions (on average) for products 1 and 3, and PSO for product 2. Table 8presents the numerical summary of solution distance matrices. Taking each optimiser-product pairindependently, DFO generates the most distant solutions for the first and second products and PSOfor the third. Note the scales in the heatmaps are dependant on the solution distances (see the up-per bounds of the colour bars); also only optimal solution vectors are included in this analysis (seeTables 4, 5, 6).PSO DFO DE D e n s i t y Guinness Extra StoutKozel BlackImperial Black IPA 0 2 4 6 8 10Solution distance0.000.050.100.150.200.25 D e n s i t y Guinness Extra StoutKozel BlackImperial Black IPA 0 2 4 6 8Solution distance0.000.050.100.150.200.250.300.350.40 D e n s i t y Guinness Extra StoutKozel BlackImperial Black IPA
Figure 5: Density of solution distances based on solution distance matrices in Figure 4.belongs to DE which returns two clusters . Although with the highest majority and the most evenlydistribution solutions, the same is applicable for Imperial Black IPA and DE.Further to the uniqueness of individual solutions themselves, at least two distinct ones from eachset of optimising tasks can be selected (one from each cluster). Additionally, distance thresholdsbetween clusters can be analysed by using methods such as hierarchical or agglomerative clusteringapproaches, which is a topic for ongoing research. Note that when there is a tie in the number of clusters, as it is for DE optimising Kozel, it is recommendedto choose the lower number.
C=220.0% C=360.0% C=40.0%C=515.0%C=65.0% C=210.0%C=3 40.0% C=415.0% C=525.0%C=610.0% C=2 35.0% C=340.0% C=40.0% C=55.0%C=620.0%C=215.0%C=345.0% C=410.0% C=520.0%C=610.0% C=210.0%C=3 25.0%C=4 5.0% C=550.0%C=610.0% C=225.0%C=330.0% C=420.0% C=515.0%C=610.0%C=210.0%C=360.0% C=45.0% C=510.0%C=615.0% C=2 30.0%C=315.0% C=430.0% C=520.0%C=65.0% C=2 50.0% C=310.0% C=415.0% C=515.0%C=610.0%
Figure 6: Number of clusters. From top to bottom: PSO, DFO and DE. For each optimiser-productpair, C = { , ..., } represents the number of clusters from to , whose strength proportion isdetermined by taking into account clustering indices. (a) Guinness Extra Stout Cluster 1 Cluster 2 Cluster 3 MajorityPSO 25 (53%) 9 (19%) 13 (28%) 12 (60%)DFO 18 (37%) 15 (31%) 16 (33%) 9 (45%)DE 10 (20%) 12 (24%) 27 (55%) 12 (60%) (b) Kozel Black
Cluster 1 Cluster 2 Cluster 3 Cluster 4 Cluster 5 MajorityPSO 15 (44%) 11 (32%) 8 (24%) – – 8 (40%)DFO 11 (22%) 7 (14%) 10 (20%) 16 (32%) 6 (12%) 10 (50%)DE 13 (31%) 29 (69%) – – – 6 (30%) (c) Imperial Black IPA
Cluster 1 Cluster 2 Cluster 3 MajorityPSO 13 (26%) 19 (38%) 18 (36%) 8 (40%)DFO 25 (50%) 7 (14%) 18 (36%) 6 (30%)DE 24 (48%) 26 (52%) – 10 (50%)
Table 9: Solution clusters
The high experimental costs associated with the beer brewing process is shown to be efficientlyreducible by taking into account the organoleptic characteristics along with the in-stock inventory.In this work, three swarm intelligence and evolutionary computation techniques are presented toautomate the quantitative ingredients selection , which is one of the key experimental aspects ofbrewing, specially in low cost production environments.In terms of the performance measures, DFO is shown to be the most accurate and reliable algorithm,as well as the most efficient optimiser with statistically significant outperformance when compared13o the other algorithms, followed by DE (Table 7). Studying the iteration-based improvement, PSOis shown to present persistent improvement, with DFO exhibiting several cases of escaping localminima, which could be a contributing factor to its higher reliability (Figure 3). Analysing solutionvectors diversity, DFO, on average, has produced the most distant solutions for two of the products,followed by PSO (Table 8). To further analyse the distinctness of the optimisers’ solutions for eachproduct, the optimal number of clusters are derived by the majority rule with clustering indices.The algorithms are shown to be capable of producing diverse set of solutions, with DFO producingsolutions with the same or more clusters in the aforementioned products (Table 9).The presented approach alleviates the challenges of generating new and dynamically changing recipes based on their organoleptic properties. This is an attractive feature for both commercial pro-ducers where varieties and quantities of ingredients are not hard constraints; and, in less equippedsetups, with stronger ingredients-based constraints, allowing the design of high quality beer.As part of ongoing and future work, in addition to investigating other case studies and alternativeinventories, we are exploring the ability of the algorithms to adjust to changes to organoleptic char-acteristics of beers during the optimisation process, therefore, studying the impact of the populationdiversity further. Another topic for future research is the use of multi-objective optimisers and in-vestigating how the reported results can be used to improve their performance in the context of theproblem discussed. Additionally, we are adding the more complex flavour and aroma profiles aswell as foam characteristics, which are dependent, among others, on the fermentables and hops.Furthermore, each hop’s boiling time could be added as an extra dimension which would impact theaforementioned aroma and flavour profiles of the result. Acknowledgement
The authors would like to thank Edmund Oetgen for taking the initial steps of the implementation,and Christian Juri for the real-world trial of the ‘swarm beer system’ in form of the Indian Pale Ale,
FLIPA , with pleasantly memorable results!
References [1] Mohammad Majid al-Rifaie. Dispersive flies optimisation. In M. Paprzycki M. Ganzha, L. Ma-ciaszek, editor,
Proceedings of the 2014 Federated Conference on Computer Science and In-formation Systems , volume 2 of
Annals of Computer Science and Information Systems , pagespages 529–538. IEEE, 2014.[2] Mohammad Majid al-Rifaie and Ahmed Aber. Dispersive flies optimisation and medical imag-ing. In
Recent Advances in Computational Optimization , pages 183–203. Springer, 2016.[3] Mohammad Majid al Rifaie, Fr´ed´eric Fol Leymarie, William Latham, and Mark Bishop.Swarmic autopoiesis and computational creativity.
Connection Science , pages 1–19, 2017.[4] Mohammad Majid al Rifaie, Anna Ursyn, Robert Zimmer, and Mohammad Ali Javaheri Javid.On symmetry, aesthetics and quantifying symmetrical complexity. In
International Conferenceon Evolutionary and Biologically Inspired Music and Art , pages 17–32. Springer, 2017.[5] Haya Alhakbani.
Handling Class Imbalance Using Swarm Intelligence Techniques, HybridData and Algorithmic Level Solutions . PhD thesis, Goldsmiths, University of London, London,United Kingdom, 2018.[6] Haya Abdullah Alhakbani and Mohammad Majid al-Rifaie. Optimising SVM to classify im-balanced data using dispersive flies optimisation. In
Proceedings of the 2017 Federated Confer-ence on Computer Science and Information Systems, FedCSIS 2017, Prague, Czech Republic,September 3-6, 2017. , pages 399–402. IEEE, 2017.[7] B Andres-Toro, JM Giron-Sierra, P Fernandez-Blanco, JA Lopez-Orozco, and E Besada-Portas. Multiobjective optimization and multivariable control of the beer fermentation pro-cess with the use of evolutionary algorithms.
Journal of Zhejiang University-SCIENCE A ,5(4):378–389, 2004.[8] Prashant Aparajeya, Frederic Fol Leymarie, and Mohammad Majid al Rifaie. Swarm-basedidentification of animation key points from 2d-medialness maps. In Anik´o Ek´art, Antonios14iapis, and Mar´ıa Luz Castro Pena, editors,
Computational Intelligence in Music, Sound, Artand Design , pages 69–83, Cham, 2019. Springer International Publishing.[9] D. Bratton and J. Kennedy. Defining a standard for particle swarm optimization. In
Proc of theSwarm Intelligence Symposium , pages 120–127, Honolulu, Hawaii, USA, 2007. IEEE.[10] Tadeusz Cali´nski and Jerzy Harabasz. A dendrite method for cluster analysis.
Communicationsin Statistics-theory and Methods , 3(1):1–27, 1974.[11] Duncan Campbell and Michael Lees. Soft computing, real-time measurement and informationprocessing in a modern brewery. In
Soft computing in measurement and information acquisi-tion , pages 105–120. Springer, 2003.[12] Malika Charrad, Nadia Ghazzali, V´eronique Boiteau, and Azam Niknafs. Nbclust package:finding the relevant number of clusters in a dataset.
J. Stat. Softw , 2012.[13] Ray Daniels.
Designing great beers: The ultimate guide to brewing classic beer styles . BrewersPublications, 1998.[14] David L Davies and Donald W Bouldin. A cluster separation measure.
IEEE transactions onpattern analysis and machine intelligence , (2):224–227, 1979.[15] David L Donoho, Yaakov Tsaig, Iddo Drori, and Jean-Luc Starck. Sparse solution of un-derdetermined systems of linear equations by stagewise orthogonal matching pursuit.
IEEEtransactions on Information Theory , 58(2):1094–1121, 2012.[16] Richard O Duda, Peter E Hart, and David G Stork.
Pattern classification and scene analysis ,volume 3. Wiley New York, 1973.[17] Gracie Ermi, Ellyn Ayton, Nolan Price, and Brian Hutchinson. Deep learning approaches tochemical property prediction from brewing recipes. In , pages 1–7. IEEE, 2018.[18] D. E. Goldberg.
Genetic Algorithms in Search, Optimization and Machine Learning . Addison-Wesley Longman Publishing Co., Inc. Boston, MA, USA, 1989.[19] Claudia Gonzalez Viejo, Sigfredo Fuentes, Damir D Torrico, Kate Howell, and Frank R Dun-shea. Assessment of beer quality based on a robotic pourer, computer vision, and machinelearning algorithms using commercial beers.
Journal of food science , 83(5):1381–1388, 2018.[20] Michael L Hall. Brew by the numbers: add up whats in your beer.
Zymurgy , 1995:54–61,1995.[21] John A Hartigan.
Clustering algorithms . John Wiley & Sons, Inc., 1975.[22] Lawrence J Hubert and Joel R Levin. A general statistical framework for assessing categoricalclustering in free recall.
Psychological bulletin , 83(6):1072, 1976.[23] J. Kennedy and R. C. Eberhart. Particle swarm optimization. In
Proceedings of the IEEEInternational Conference on Neural Networks , volume IV, pages 1942–1948, Piscataway, NJ,1995. IEEE Service Center.[24] Wojtek J Krzanowski and YT Lai. A criterion for determining the number of groups in a dataset using sum-of-squares clustering.
Biometrics , pages 23–34, 1988.[25] James MacQueen et al. Some methods for classification and analysis of multivariate observa-tions. In
Proceedings of the fifth Berkeley symposium on mathematical statistics and probabil-ity , volume 1, pages 281–297. Oakland, CA, USA, 1967.[26] Silvia Mileva and Svetla Vassileva. ANN-based prediction of antioxidant characterizationsduring the brewery fermentation. In
Proc. Int. Sci. Conf. Computer Science , 2008.[27] Daniel Morey. Hop schedule guidelines: Award winning homebrew and classic beer stylerecipes. 2000.[28] Olusegun Olorunda and Andries Petrus Engelbrecht. Measuring exploration/exploitation inparticle swarms using swarm diversity. In
Evolutionary Computation, 2008. CEC 2008.(IEEEWorld Congress on Computational Intelligence). IEEE Congress on , pages 1128–1134. IEEE,2008.[29] Hooman Oroojeni, Mohammad Majid al-Rifaie, and Mihalis A. Nicolaou. Deep neuroevolu-tion: Training deep neural networks for false alarm detection in intensive care units. In
Euro-pean Association for Signal Processing (EUSIPCO) 2018 , pages 1157–1161. IEEE, 2018.1530] Charlie Papazian.
The new complete joy of home brewing , volume 1350. Avon Books, 1991.[31] Donald L Phillips, Richard Inger, Stuart Bearhop, Andrew L Jackson, Jonathan W Moore,Andrew C Parnell, Brice X Semmens, and Eric J Ward. Best practices for use of stable isotopemixing models in food-web studies.
Canadian Journal of Zoology , 92(10):823–835, 2014.[32] Peter J Rousseeuw. Silhouettes: a graphical aid to the interpretation and validation of clusteranalysis.
Journal of computational and applied mathematics , 20:53–65, 1987.[33] Bart Steenackers, Luc De Cooman, and Dirk De Vos. Chemical transformations of characteris-tic hop secondary metabolites in relation to beer properties and the brewing process: a review.
Food Chemistry , 172:742–756, 2015.[34] Irwin Stone and Morrow C Miller. The standardization of methods for the determination ofcolor in beer. In
Proceedings. Annual meeting-American Society of Brewing Chemists
Biotechnology & Biotechnological Equipment , 24(3):1936–1939, 2010.[37] Claudia Gonzalez Viejo, Sigfredo Fuentes, Kate Howell, Damir Torrico, and Frank R Dunshea.Robotics and computer vision techniques combined with non-invasive consumer biometrics toassess quality traits from beer foamability using machine learning: A potential for artificialintelligence applications.
Food control , 92:72–79, 2018.[38] Frank Wilcoxon, SK Katti, and Roberta A Wilcox. Critical values and probability levels forthe wilcoxon rank sum test and the wilcoxon signed rank test.
Selected tables in mathematicalstatistics , 1:171–259, 1970.[39] CI Wilson and L Threapleton. Application of artificial intelligence for predicting beer flavoursfrom chemical analysis. In
Proceedings of the 29th European Brewery Convention Congress,Dublin, Ireland , pages 17–22, 2003.[40] Yanqing Zhang, Shiru Jia, and Wujiu Zhang. Predicting acetic acid content in the finalbeer using neural networks and support vector machine.