###### Abstract  
The Internet of Things (IoT) faces significant challenges in the requirements of sensitive task latency, reasonable resource allocation and reliability for resource transactions. This paper introduces a novel method for road resource allocation in the IoT context of connected and autonomous electric vehicles (CAEVs). The proposed algorithm leverages the ant colony algorithm (ACA) to effectively allocate and coordinate road resources within groups of CAEVs. By considering the energy consumption and pheromone volatilization, the allocation and coordination process of road resources are optimized. To improve the linear packet loss of RED, we adopt the advanced ACA and CRED in the NS2 platform. The experimental results demonstrate that the proposed method outperforms the RED algorithm in packet loss rate and delay time, significantly enhancing system efficiency and performance. Furthermore, the combination of the CRED algorithm and ant colony algorithm successfully mitigates short-term congestion and identifies optimized paths with minimal delay. ant colony algorithm; CAEVs; resource allocation 20231299713390/electronics21329971390/20  
messages and real-time collaborative control messages have strict delay constraints, while related entertainment applications can tolerate a certain degree of delay. Thousands of vehicles need to exchange information in real time, but the spectrum of resources available for CAEVs IoT communication is very limited, and the high-speed movement of vehicles in CAEVs IoT environments and the heterogeneity of latency requirements of different applications are the main challenges that hinder the rapid development of CAEVs IoT. Therefore, it is necessary to design a reasonable and effective resource allocation strategy for CAEVs IoT environments. To address these issues, swarm intelligent computing has become an effective approach [4]. Swarm intelligent computing involves forming a group of individuals and equipping them with intelligence and behavioural rules, enabling the collective intelligence of the entire group. Through cooperation, communication and competition, individuals in swarm intelligence computing can collaboratively accomplish tasks and achieve swarm optimization and coordination [5]. By employing resource allocation methods based on swarm intelligent computing, vehicles can achieve collaborative resource utilization, leading to enhanced system efficiency and performance. Swarm intelligent computing refers to a class of intelligent algorithms with distributed intelligent behavioural characteristics inspired by the group behaviour of insects, herds of animals, flocks of birds, schools of fish, etc. As an emerging computational technology, intelligent computing has received increasing attention from researchers and has special connections with artificial life, evolutionary strategies, and genetic algorithms, being widely used in research. Swarm intelligent computing provides the basis for finding solutions to complex distributed problems without centralized control or providing a global model. In this paper, we optimized and improved the bionic swarm intelligence algorithm, i.e., ant colony algorithm (ACA), and proposed a resource allocation method for CAEVs IoT. To effectively reduce energy consumption and improve the performance of avionics systems, [PERSON] et al. proposed an energy-aware resource allocation method based on the ACA [6]. Firstly, they established a mathematical model for resource allocation, reflecting the relationship between task requirements and resource energy consumption. Then, the ACA allocates heterogeneous resources to minimize completion time and achieve low-energy consumption. [PERSON] et al. introduced a proportional fair resource allocation problem based on chance constrained programming, which maximizes the average and rate within an adaptive time window and ensures the Jain fairness index (JFI) requirement under the target probability [7].