Wireless Sensor Networks (WSNs) are fundamental technologies enabling cyber-physical systems in real-time environmental monitoring, industrial automation, and healthcare monitoring with spatially-distributed sensors. Due to the limited battery power of sensor nodes and their susceptibility to physical degradation, WSNs are prone to failure and have issues with routing due its resource constraint nature. This paper proposes CWSN-AI v4.2 which is a hybrid machine learning and fuzzy logic fault-tolerant framework that integrates four intelligent subsystems into in a single framework to form a self-healing reliable network architecture. CWSN-AI v4.2 employs Mamdani Fuzzy Inference System (FIS) that uses 11 expert-defined rules to produce a continuous suitability score for each of the cluster heads that will efficiently use energy while creating trust between the cluster heads. A Trust-Based Intrusion Detection System (TBIDS) detects malicious nodes: Blackhole, Selective Forwarding, Energy Drain, and Sybil with an average detection rate of 99.2% across four attack types when evaluated at a trust threshold of 0.50, while maintaining complete end-to-end data integrity. The proposed TBIDS is systematically evaluated relative to five protocols: LEACH, PEGASIS, TEEN, AODV, and SEP, and demonstrates a 12% − 18% improvement in Packet Delivery Rate (PDR) and a 22–31% increase in the network life span compared to each of the alternative systems. The TBIDS presents three main contributions: (i) the development of a hybrid architecture that uses a LightGBM and a Mamdani fuzzy inference system (FIS) for simultaneous (1) fault classification and (2) optimization of the data clusters (i.e., network); (ii) the development of a Dyna-Q self-healing routing protocol that provides healing functionality for any given multi-episode fault; and (iii) the development of a trust-based IDS subsystems that is capable of performing attack-type-aware isolation of network nodes. CWSN-AI v4.2 consists of a lightGBM binary classifier that was trained using a synthetic dataset of 200,000 samples (configurable between 50,000 and 300,000)and yielded 97.4% classification accuracy and 0.9982 AUC-ROC; as a result, it showed superior class performance metrics when comparing it to other supervised machine learning techniques such as Random Forests, Decision Trees, and Gradient Boosting.
Devarla et al. (Sun,) studied this question.