You are currently on the new version of our website. Access the old version .
Engineering ProceedingsEngineering Proceedings
  • Proceeding Paper
  • Open Access

7 January 2026

An Optimized ANFIS Model for Predicting Water Hardness and TDS in Ion-Exchange Wastewater Treatment Systems †

,
,
,
,
,
and
1
Department of Automation and Digital Control, Tashkent Institute of Chemical Technology, Tashkent 100000, Uzbekistan
2
Department of Food Engineering Technologies, Karshi State Technical University, Shahrizabs 181307, Uzbekistan
*
Author to whom correspondence should be addressed.
Presented at the 4th International Electronic Conference on Processes, 20–22 October 2025; Available online: https://sciforum.net/event/ECP2025.

Abstract

Industrial wastewater treatment processes often exhibit highly nonlinear, dynamic behavior, making accurate prediction and control difficult when using conventional modeling approaches. This study presents an enhanced Adaptive Neuro-Fuzzy Inference System (ANFIS) framework for modeling the ion-exchange purification process based on 200 experimentally collected data samples obtained from a laboratory-scale treatment system. The initial ANFIS structure was generated using subtractive clustering to automatically derive the rule base, while hybrid learning combining backpropagation and least-squares estimation was applied to train the model. The training results demonstrated stable convergence across 100, 200, and 300 epochs, with progressive improvements in model accuracy. To further enhance performance, several meta-heuristic optimization methods, including Particle Swarm Optimization (PSO), Genetic Algorithm (GA), and the Adam optimizer, were integrated within a Python 3.13-based environment to refine model parameters. Ensemble learning and an extended Boosting++ strategy was subsequently employed to reduce variance, correct residual errors, and strengthen generalization capability. The optimized ANFIS model achieved strong predictive accuracy across both training and unseen test datasets. The performance metrics for the full dataset yielded RMSE (Root Mean Square Error) = 1.3369, MAE (Mean Absolute Error) = 0.9989, and R2 = 0.9313, while correlation analysis showed consistently high R-values for training (0.96745), validation (0.95206), test (0.95754), and overall data (0.96507). The results demonstrate that the combination of subtractive clustering, hybrid learning, meta-heuristic optimization, and ensemble boosting produces a highly reliable soft-computing model capable of effectively capturing the nonlinear dynamics of ion-exchange wastewater treatment. The proposed approach provides a robust foundation for intelligent monitoring and control strategies in industrial purification systems.

1. Introduction

Industrial expansion and increasing chemical consumption in many sectors have intensified the generation of complex wastewater streams containing dissolved salts, hardness ions, and other inorganic contaminants. Efficient purification of such wastewater is essential not only for environmental protection but also for sustainable water resource management, particularly in regions facing water scarcity and high industrial load [1,2]. Ion-exchange resin technologies have emerged as an effective solution for selectively removing hardness-forming ions and reducing total dissolved solids. However, the dynamic and nonlinear nature of ion-exchange processes creates significant challenges for traditional control strategies, which often fail to achieve the required precision under variable operating conditions [3,4].
Modern wastewater treatment systems operate under strong process coupling, stochastic disturbances, and rapidly changing influent characteristics. These conditions make real-time prediction and control a non-trivial task, requiring the integration of advanced modeling approaches capable of learning complex input–output relationships. Soft computing methods, especially hybrid artificial intelligence techniques, have therefore gained considerable attention for improving the adaptability, robustness, and accuracy of water treatment control systems. Among these methods, the Adaptive Neuro-Fuzzy Inference System (ANFIS) stands out due to its unique capability to merge fuzzy logic’s interpretability with neural networks’ learning ability [5,6].
ANFIS models consist of two principal parameter groups: premise parameters that define membership functions and govern the partitioning of the input space, and consequent parameters that form the linear relationships generating the model output. The system’s predictive performance strongly depends on the optimal adjustment of both parameter types. Numerous studies have shown that combining derivative-based approaches such as gradient descent and backpropagation with analytical techniques such as least-squares estimation enhances training stability and convergence [7]. At the same time, heuristic and evolutionary algorithms including genetic algorithms, particle swarm optimization, differential evolution, and other bio-inspired methods have been widely explored to overcome issues such as local minima and sensitivity to initial values [8].
Despite the progress in computational intelligence applications, several gaps remain. Many existing works investigate ANFIS models on synthetic or simplified datasets, whereas real industrial wastewater treatment processes involve complex dynamics and multi-factor interactions. Moreover, limited attention has been given to developing integrated training pipelines where ANFIS is optimized sequentially or jointly using hybrid meta-heuristic strategies, boosting frameworks, or ensemble learning mechanisms [9]. Such approaches offer significant potential to increase prediction accuracy and generalization ability, especially for highly nonlinear processes like ion-exchange purification. Likewise, there is still a need for experimental case studies that combine real laboratory data, physical filtration systems, and intelligent modeling techniques to assess the applicability of AI-driven control solutions in practical water treatment operations [10,11].
In response to these challenges, the present study develops and evaluates an advanced ANFIS-based prediction framework for modeling the behavior of an ion-exchange wastewater treatment system. A laboratory-scale purification setup equipped with multiple ion-exchange columns and a solar-powered control system was used to generate real experimental data [3]. The ANFIS model was trained using subtractive clustering to automatically determine the initial rule base, followed by hybrid learning for premise and consequent parameter optimization. Furthermore, meta-heuristic and ensemble-based optimization strategies were integrated to improve convergence, stability, and predictive accuracy. The study aims to demonstrate how an intelligently optimized ANFIS model can accurately capture the nonlinear dynamics of ion-exchange processes and support the development of high-performance control architectures for industrial wastewater treatment [12].

2. Materials and Methods

2.1. Experimental Setup and Data Acquisition

The laboratory experiments were conducted using a custom-designed ion-exchange purification system constructed to simulate multi-stage industrial water treatment conditions. The system integrates several key components, including upper-mounted feed tanks for gravitational distribution, a mechanical pre-filter for removing suspended particles, and three sequential ion-exchange resin columns responsible for hardness and salt reduction. The setup also incorporates an auxiliary solar-powered electrical module used to operate pumps and ensure stable flow conditions. The combination of mechanical, filtration, and power subsystems provides a controlled environment for generating high-quality experimental data [10].
Figure 1 shows the main filtration frame and associated components. The left-side images depict the photovoltaic power unit, electrical control elements, and the primary inlet filter housing. The right-side image illustrates the full ion-exchange system, including feed reservoirs, filtration housings, and the color-coded tubing network used to prevent cross-mixing and maintain consistent operating conditions during experiments [3].
Figure 1. Laboratory ion-exchange wastewater treatment setup used for data collection.
To ensure a clear understanding of the experimental configuration, the laboratory-scale ion-exchange system was designed as an integrated treatment and data acquisition platform. The feed tank provides controlled influent delivery, while the mechanical pre-filter removes suspended solids to protect the ion-exchange media. The wastewater then passes sequentially through multiple ion-exchange resin columns, where hardness-forming ions and dissolved salts are selectively removed. Throughout the experiments, stable hydraulic conditions were maintained by regulating the inflow rate, and all measurements were recorded under steady-state operating conditions to ensure data consistency. This structured configuration allowed reliable generation of input–output datasets suitable for intelligent model development.
Industrial-type wastewater with varying hardness and mineral content was introduced into the system. By systematically adjusting parameters such as inflow rate, feed composition, and hydraulic loading, a total of 200 experimental observations were collected. Each dataset entry consists of multiple input variables (TDS (Total dissolved solids), hardness, inflow rate) and the corresponding outlet water quality parameter, which served as the target variable for ANFIS model training and optimization [13].

2.2. ANFIS Model Structure and MATLAB-Based Training

An Adaptive Neuro-Fuzzy Inference System (ANFIS) was constructed to learn the relationship between the input parameters and the resulting water quality. The model follows the Sugeno-type fuzzy inference structure, which comprises fuzzy membership functions in the premise layer and linear functions in the consequent layer. For initialization of the rule base, the subtractive clustering technique was employed. This method determines cluster centers in the input space by measuring the density of data points and generates a compact but representative set of fuzzy rules. Consequently, each input variable was automatically assigned optimized membership functions derived from the cluster structure.
After defining the model structure, ANFIS parameters were trained using the hybrid learning algorithm available in MATLABR2025. This algorithm integrates backpropagation for updating the nonlinear premise parameters and least-squares estimation (LSE) for computing the linear consequent parameters. The hybrid approach significantly improves convergence stability by treating the nonlinear and linear components separately. Training was conducted over multiple epochs (100, 200, and 300) to investigate the learning dynamics and obtain a well-generalized model.

2.3. Meta-Heuristic Optimization of ANFIS Parameters

To further improve the predictive capability and robustness of the ANFIS model, several meta-heuristic optimization techniques were integrated. These algorithms operate independently of gradient information and are particularly effective in avoiding local minima, a common challenge in nonlinear modeling [14].
Adam Optimizer. Adam (Adaptive Moment Estimation) updates parameters by calculating adaptive learning rates for each variable based on first and second moments of gradients. Although originally developed for neural networks, Adam is well-suited for fine-tuning ANFIS parameters due to its ability to stabilize learning in noisy error landscapes [15].
Particle Swarm Optimization (PSO). PSO is a population-based algorithm inspired by swarm behaviors in nature. Each particle represents a potential parameter vector, and the swarm collectively moves towards promising regions of the search space based on local and global best experiences. PSO was used to explore wide parameter spaces and determine high-quality initial conditions for the ANFIS [16].
Genetic Algorithm (GA). GA employs biologically inspired operations—selection, crossover, and mutation to evolve parameter sets toward optimal performance. GA was utilized to refine the membership function parameters and rule coefficients, offering improved global optimization capability and enhancing model accuracy [17].
The selection of PSO, GA, and Adam optimizers was based on their complementary optimization properties and proven effectiveness in nonlinear modeling problems. PSO was selected for its efficient global search capability and rapid convergence in continuous parameter spaces. GA was employed due to its strong evolutionary search mechanism, which enhances robustness against local minima through genetic operations. Adam was incorporated as an adaptive gradient-based optimizer capable of fine-tuning parameters with stable and efficient convergence in noisy error landscapes. The combined use of these optimizers enables a balanced optimization strategy that integrates global exploration and local exploitation, making it well-suited for tuning ANFIS parameters in complex wastewater treatment processes.
These meta-heuristic methods were applied sequentially and comparatively to determine the best-performing optimization strategy for the ANFIS architecture.
The overall optimization pipeline was structured in a sequential manner to progressively enhance model performance. First, the ANFIS model was initialized using subtractive clustering and trained through hybrid learning to establish a stable baseline. Next, meta-heuristic optimization methods were applied to refine the premise and consequent parameters, targeting error minimization and improved convergence. Finally, ensemble learning and Boosting++ techniques were employed to aggregate multiple optimized learners and iteratively correct residual errors. This stepwise strategy ensured systematic improvement of prediction accuracy and generalization capability without increasing model complexity excessively.
Following MATLABR2025-based training and meta-heuristic optimization, the ANFIS model was further enhanced using an ensemble-learning approach implemented in Python. While a single ANFIS model may learn nonlinear relationships effectively, ensemble methods improve generalization by combining multiple learners [18].
Ensemble Learning via k-Fold Cross-Validation. A k-fold ensemble strategy was first applied, where the dataset was partitioned into k subsets, and individual ANFIS models were trained on different folds. The outputs were then aggregated to reduce variance and improve stability. This approach mitigates overfitting and allows the model to better capture system variability [19].
Boosting and Boosting++ Methods. To further enhance prediction accuracy, boosting techniques were applied. Standard boosting iteratively trains new models to correct the residual errors of previous ones, progressively refining performance. The Boosting++ extension incorporates recalibrated weighting mechanisms and adaptive error correction, enabling more balanced learning across difficult samples. This approach is especially effective for systems with abrupt nonlinear transitions typical in ion-exchange processes during saturation and regeneration phases [20].
Together, the ensemble and boosting stages produced a final optimized ANFIS model capable of delivering highly accurate predictions across training, validation, and unseen test data.

3. Result and Discussion

The ANFIS model was trained on 200 experimental samples using subtractive clustering to automatically generate the initial rule base, followed by hybrid optimization combining backpropagation and least-squares estimation. As illustrated in Figure 2, the training curve shows a smooth and continuous decrease in error across 100, 200, and 300 epochs, indicating stable convergence and effective parameter adaptation throughout the learning process. Membership functions were automatically assigned for each input variable, enabling the model to progressively refine both premise and consequent parameters.
Figure 2. Training error curve of the ANFIS model using SC + Hybrid learning.
Overall, the ANFIS predictions aligned closely with the actual experimental measurements, successfully capturing both rapid fluctuations and gradual trends in the ion-exchange process. The model also preserved stable regression performance in the lower (~4) and higher (~20) output ranges, demonstrating its capability to learn complex nonlinear system dynamics.
The quantitative metrics obtained for different epoch configurations were
  • 100 epochs: RMSE = 1.5691, MAE = 1.1639, R2 = 0.9054;
  • 200 epochs: RMSE = 1.4974, MAE = 1.0979, R2 = 0.9138;
  • 300 epochs: RMSE = 1.4831, MAE = 1.0920, R2 = 0.9155.
These results indicate that increasing the number of epochs enhanced the model’s generalization ability, with noticeable stabilization at 200 epochs and the highest predictive performance achieved at 300 epochs.
Before interpreting the final predictions, several meta-heuristic optimization techniques PSO, GA, and Adam were implemented in the Python environment to improve the ANFIS model’s parameter tuning and overall stability. These optimizers enhanced the model’s search capability and provided a stronger foundation for the ensemble and Boosting++ methods applied afterward. Figure 3 illustrates the performance of the optimized ANFIS model across all 200 experimental samples. The close alignment between the actual and predicted curves demonstrates that the model effectively captured the nonlinear behavior of the ion-exchange purification process, maintaining stable tracking even in segments with abrupt fluctuations and rapid dynamic changes.
Figure 3. Comparison of actual and predicted outputs for all 200 samples using the optimized ANFIS model.
The overall prediction accuracy achieved by the optimized model was high, with performance metrics of RMSE = 1.3369, MAE = 0.9989, and R2 = 0.9313. These results confirm that the model generalizes well and provides reliable estimates across the full dataset.
Figure 4 illustrates the performance of the ANFIS model on the training subset of the dataset. The predicted outputs closely follow the actual measurements, with the two curves nearly overlapping across all samples. This strong alignment indicates that the model effectively learned the underlying input–output relationships during training and successfully captured the nonlinear dynamics of the ion-exchange purification process.
Figure 4. Comparison of actual and predicted outputs for the ANFIS model on the training dataset.
The performance metrics further confirm the high accuracy achieved on the training data, yielding RMSE = 1.2504, MAE = 0.9316, and R2 = 0.9358. An R2 value above 0.93 demonstrates that the model explains a substantial portion of the variance in the training observations and reflects a well-fitted fuzzy rule structure with optimally tuned membership functions.
Figure 5 shows the evaluation of the ANFIS model on the test dataset, providing insight into its generalization capability on previously unseen samples. The predicted outputs exhibit a strong correspondence with the actual measurements, maintaining close alignment across most data points. Although minor deviations are observed in some regions—primarily where the system exhibits sharp transitions—the overall tracking performance remains stable, indicating that the model successfully extrapolated the nonlinear relationships learned during training.
Figure 5. Comparison of actual and predicted outputs for the ANFIS model on the test dataset.
The quantitative metrics further validate the model’s reliability on the test data, yielding RMSE = 1.6379, MAE = 1.2679, and R2 = 0.9168. An R2 value exceeding 0.91 demonstrates that the model explains a substantial proportion of variance even outside the training set, confirming that the optimized ANFIS structure provides good predictive accuracy and robust generalization.
Figure 6 presents the correlation plots for the training, validation, test, and combined datasets, providing a comprehensive assessment of the model’s predictive consistency. In the training set, the predicted and target values exhibit a very strong linear relationship with a correlation coefficient of R = 0.96745, indicating excellent learning of the underlying system behavior. The validation results also show high stability, achieving R = 0.95206, which confirms that the model generalizes well during the tuning phase.
Figure 6. Correlation plots for training, validation, test, and overall datasets using the optimized ANFIS model.
Similarly, the test dataset representing unseen samples yields a strong correlation of R = 0.95754, demonstrating that the model maintains reliable predictive capability outside the training domain. When all data points are considered collectively, the overall correlation reaches R = 0.96507, further confirming the robustness and consistency of the optimized fuzzy–neural architecture.
These results highlight the effectiveness of the applied optimization strategy. By progressively integrating PSO, GA, Adam, ensemble learning, and Boosting++, the ANFIS model achieved substantial improvements in accuracy and generalization. The final model demonstrates high reliability across all evaluation stages and is well-suited for predicting nonlinear dynamics in ion-exchange purification processes.

4. Conclusions

This study developed a comprehensive ANFIS-based modeling framework to predict the behavior of an ion-exchange wastewater treatment system using experimentally collected laboratory data. Subtractive clustering and hybrid learning enabled efficient initialization and training of the fuzzy-neural structure, while meta-heuristic optimization (PSO, GA, Adam) and Boosting++ techniques further refined the model’s accuracy and robustness. The optimized ANFIS model demonstrated strong predictive performance, successfully tracking both smooth and abrupt variations in the purification process and achieving high correlation across all evaluation datasets. The findings confirm that ANFIS, when enhanced with advanced optimization strategies, is capable of learning complex nonlinear relationships inherent to ion-exchange processes. The resulting model provides a reliable soft-sensor framework for real-time prediction and can serve as a foundation for future intelligent control and automation systems in industrial wastewater treatment. Further research may extend this approach to larger datasets, multi-stage filtration processes, and real-time adaptive control integration.

Author Contributions

Conceptualization, J.E. and Z.T.; methodology, S.R. and J.E.; formal analysis, A.K.; investigation, J.E., S.F. and K.U.; resources, J.E.; data curation, Z.T.; writing—original draft preparation, S.F. and J.E.; writing—review and editing, A.N. and K.U.; visualization, S.R. and A.K.; supervision, A.N. and K.U. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

ANFISAdaptive neuro-fuzzy inference system
PSOParticle swarm optimization
AdamAdaptive moment estimation
GAGenetic algorithm

References

  1. Ahmed, F.E.; Khalil, A.; Hilal, N. Emerging Desalination Technologies: Current Status, Challenges and Future Trends. Desalination 2021, 517, 115183. [Google Scholar] [CrossRef]
  2. Shemer, H.; Wald, S.; Semiat, R. Challenges and Solutions for Global Water Scarcity. Membranes 2023, 13, 612. [Google Scholar] [CrossRef] [PubMed]
  3. Eshbobaev, J.; Norkobilov, A.; Turakulov, Z.; Khamidov, B.; Kodirov, O. Field Trial of Solar-Powered Ion-Exchange Resin for the Industrial Wastewater Treatment Process. Eng. Proc. 2023, 37, 47. [Google Scholar] [CrossRef]
  4. Kansara, N.; Bhati, L.; Narang, M.; Vaishnavi, R. Wastewater Treatment by Ion Exchange Method: A Review of Past and Recent Researches. Crit. Rev. 2016, 12, 143–150. [Google Scholar]
  5. Jain, A.; Bahreini Toussi, I.; Mohammadian, A.; Bonakdari, H.; Sartaj, M. Applications of ANFIS-Type Methods in Simulation of Systems in Marine Environments. Math. Comput. Appl. 2022, 27, 29. [Google Scholar] [CrossRef]
  6. Aldair, A.A.; Obed, A.A.; Halihal, A.F. Design and Implementation of ANFIS-Reference Model Controller Based MPPT Using FPGA for Photovoltaic System. Renew. Sustain. Energy Rev. 2018, 82, 2202–2217. [Google Scholar] [CrossRef]
  7. Orouskhani, M.; Mansouri, M.; Orouskhani, Y.; Teshnehlab, M. A Hybrid Method of Modified Cat Swarm Optimization and Gradient Descent Algorithm for Training Anfis. Int. J. Comput. Intell. Appl. 2013, 12, 1350007. [Google Scholar] [CrossRef]
  8. Moayedi, H.; Raftari, M.; Sharifi, A.; Jusoh, W.A.W.; Rashid, A.S.A. Optimization of ANFIS with GA and PSO Estimating α Ratio in Driven Piles. Eng. Comput. 2020, 36, 227–238. Available online: https://link.springer.com/article/10.1007/s00366-018-00694-w (accessed on 7 December 2025). [CrossRef]
  9. Barak, S.; Sadegh, S.S. Forecasting Energy Consumption Using Ensemble ARIMA–ANFIS Hybrid Algorithm. Int. J. Electr. Power Energy Syst. 2016, 82, 92–104. [Google Scholar] [CrossRef]
  10. Eshbobaev, J.; Norkobilov, A.; Usmanov, K.; Khamidov, B.; Kodirov, O.; Avezov, T. Control of Wastewater Treatment Processes Using a Fuzzy Logic Approach. Eng. Proc. 2024, 67, 39. [Google Scholar] [CrossRef]
  11. Judge, M.A.; Franzitta, V.; Curto, D.; Guercio, A.; Cirrincione, G.; Khattak, H.A. A Comprehensive Review of Artificial Intelligence Approaches for Smart Grid Integration and Optimization. Energy Convers. Manag. X 2024, 24, 100724. [Google Scholar] [CrossRef]
  12. Narges, S.; Ghorban, A.; Hassan, K.; Mohammad, K. Prediction of the Optimal Dosage of Coagulants in Water Treatment Plants through Developing Models Based on Artificial Neural Network Fuzzy Inference System (ANFIS). J. Environ. Health Sci. Eng. 2021, 19, 1543–1553. [Google Scholar] [CrossRef] [PubMed]
  13. Eshbobaev, J.; Khamidov, B.; Fallanza, M. Application of an adaptive neuro-fuzzy inference system to control the wastewater treatment process. Chem. Technol. Control Manag. 2025, 2025, 52–60. [Google Scholar] [CrossRef]
  14. Jithendra, T.; Basha, S.S. Analyzing Groundwater Level with Hybrid ANN and ANFIS Using Metaheuristic Optimization. Earth Sci. Inform. 2023, 16, 3323–3353. [Google Scholar] [CrossRef]
  15. Pasha, A.; Ahmed, S.T.; Painam, R.K.; Mathivanan, S.K.; Karthikeyan, P.; Mallik, S.; Qin, H. Leveraging ANFIS with Adam and PSO Optimizers for Parkinson’s Disease. Heliyon 2024, 10, e30241. [Google Scholar] [CrossRef] [PubMed]
  16. Wang, D.; Tan, D.; Liu, L. Particle Swarm Optimization Algorithm: An Overview. Soft Comput. 2018, 22, 387–408. Available online: https://link.springer.com/article/10.1007/s00500-016-2474-6 (accessed on 7 December 2025). [CrossRef]
  17. Katoch, S.; Chauhan, S.S.; Kumar, V. A Review on Genetic Algorithm: Past, Present, and Future. Multimed. Tools Appl. 2020, 80, 8091–8126. Available online: https://link.springer.com/article/10.1007/s11042-020-10139-6 (accessed on 7 December 2025). [CrossRef] [PubMed]
  18. Mlakić, D.; Nikolovski, S. ANFIS as a Method for Determinating MPPT in the Photovoltaic System Simulated in MATLAB/Simulink. In Proceedings of the 2016 39th International Convention on Information and Communication Technology, Electronics and Microelectronics (MIPRO), Opatija, Croatia, 30 May–3 June 2016; pp. 1082–1086. [Google Scholar]
  19. Dong, X.; Yu, Z.; Cao, W.; Shi, Y.; Ma, Q. A Survey on Ensemble Learning. Front. Comput. Sci. 2020, 14, 241–258. [Google Scholar] [CrossRef]
  20. Ferreira, A.J.; Figueiredo, M.A.T. Boosting Algorithms: A Review of Methods, Theory, and Applications. In Ensemble Machine Learning; Springer: New York, NY, USA, 2012; Available online: https://link.springer.com/chapter/10.1007/978-1-4419-9326-7_2 (accessed on 7 December 2025).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.