Citation: Huang, J.; Sabri, M.M.S.; Ulrikh, D.V.; Ahmad, M.; Alsaffar, K.A.M. Predicting the Compressive Strength of the Cement-Fly Ash–Slag Ternary Concrete Using the Firefly Algorithm (FA) and Random Forest (RF) Hybrid Machine-Learning Method. Materials 2022, 15, 4193. https://doi.org/10.3390/ma15124193 Academic Editor: Dario De Domenico Received: 15 May 2022 Accepted: 8 June 2022 Published: 13 June 2022 Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affil- iations. Copyright: © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). materials Article Predicting the Compressive Strength of the Cement-Fly Ash–Slag Ternary Concrete Using the Firefly Algorithm (FA) and Random Forest (RF) Hybrid Machine-Learning Method Jiandong Huang 1,2, *, Mohanad Muayad Sabri Sabri 2 , Dmitrii Vladimirovich Ulrikh 3 , Mahmood Ahmad 4 and Kifayah Abood Mohammed Alsaffar 5 1 School of Mines, China University of Mining and Technology, Xuzhou 221116, China 2 Peter the Great St. Petersburg Polytechnic University, 195251 St. Petersburg, Russia; mohanad.m.sabri@gmail.com 3 Department of Urban Planning, Engineering Networks and Systems, Institute of Architecture and Construction, South Ural State University, 76, Lenin Prospect, 454080 Chelyabinsk, Russia; ulrikhdv@susu.ru 4 Department of Civil Engineering, University of Engineering and Technology Peshawar (Bannu Campus), Bannu 28100, Pakistan; ahmadm@uetpeshawar.edu.pk 5 University of Mashreq, Baghdad 10023, Iraq; kiffaya_alsaffar@yahoo.com * Correspondence: jiandong.huang@hotmail.com Abstract: Concrete is the most widely used material in construction. It has the characteristics of strong plasticity, good economy, high safety, and good durability. As a kind of structural material, concrete must have sufficient strength to resist various loads. At the same time, due to the brittleness of concrete, compressive strength is the most important mechanical property of concrete. To solve the disadvantages of the low efficiency of the traditional concrete compressive strength prediction methods, this study proposes a firefly algorithm (FA) and random forest (RF) hybrid machine-learning method to predict the compressive strength of concrete. First, a database is built based on the data of published articles. The dataset in the database contains eight input variables (cement, blast furnace slag, fly ash, water, superplasticizer, coarse aggregate, fine aggregate, and age) and one output variable (concrete compressive strength). Then, the correlation of the eight input variables was analyzed, and the results showed that there was no high correlation between the input variables; thus, they could be used as input variables to predict the compressive strength of concrete. Next, this study used the FA algorithm to optimize the hyperparameters of RF to obtain better hyperparameters. Finally, we verified that the FA and RF hybrid machine-learning model proposed in this study can predict the compressive strength of concrete with high accuracy by analyzing the R values and RSME values of the training set and test set and comparing the predicted value and actual value of the training set and test machine. Keywords: hybrid machine-learning method; concrete; compressive strength 1. Introduction Concrete is made up of cementitious material, aggregate, water, admixture, and mineral admixture following a certain proportion by uniform mixing, compaction molding, curing hardening, and becoming a kind of artificial stone [15]. It is one of the most important civil building materials at present [613]. Concrete not only has the characteristics of abundant raw materials, low price, and a simple manufacturing process but also has the characteristics of high compressive strength and good durability [6,1417]. Due to these characteristics, concrete has been widely used in construction, shipbuilding, the machinery industry, and other fields [1821]. However, in the process of concrete preparation, when cement particles contact with water, the clinker minerals on the surface of cement particles will immediately hydrolyze or Materials 2022, 15, 4193. https://doi.org/10.3390/ma15124193 https://www.mdpi.com/journal/materials