## 4 Model Establishment
### Objective Function  
(1) To achieve the rational allocation of computing power in the CPN for the IoV, it is necessary to consider entities such as vehicles, servers, tasks, and network links. Let the set of servers be \(S\), the set of tasks be \(T\), and the set of network links be \(L\). Let \(Q_{s}\) denote the set of tasks in the computation queue at server \(s\). To minimize task completion time, minimize energy consumption, and maximize resource utilization, the comprehensive optimization objective function is defined as in Equation (1):  
\[\min\quad\alpha\cdot\sum_{j=1}^{m}T_{total}^{j}+\sum_{i=1}^{n}(\beta\cdot E^{ s_{i}}-\gamma\cdot U^{s_{i}}) \tag{1}\]  
where \(\alpha\), \(\beta\), and \(\gamma\) are weights to balance latency, energy consumption, and computational resource utilization. This objective function encapsulates the goals of optimizing the allocation of computing resources in such a way that it balances the efficiency of task completion, the conservation of energy, and the maximization of the use of available resources within the network. (a) The total latency is the total time from when the task data is sent from the vehicle terminal, processed by the edge server, and the result is returned to the vehicle. It includes transmission delay, queuing delay, and processing delay. The transmission delay includes the task upload delay and the task download delay, where the sizes of data uploaded and downloaded are different and the links they traverse also differ. The transmission delay can be calculated using Equation (2):  
\[T_{trans}^{j}=\frac{D_{task}^{t_{j}}}{B_{upload}^{k_{i}t_{j}}}+\frac{D_{result }^{t_{j}}}{B_{download}^{k_{i}t_{j}}}+\frac{L_{upload}^{k_{i}t_{j}}}{v}, \tag{2}\]  
where \(D_{task}\) is the size of the task data and \(B_{upload}\) is the bandwidth of the link from the vehicle \(j\) to the server \(i\). \(D_{result}\) is the size of the task result, and \(B_{download}\) is the bandwidth overheads of downloading the task result from the server to the vehicle. \(L_{upload}\) represents the link length for task uploading, \(L_{download}\) represents the link length for the return of task completion results, and \(v\) is the propagation speed of the signal. The processing delay is the time costs for the edge server to provide computing resources based on the task requirements, denoted as \(P_{processing}\) (unit: ms, milliseconds), defined as follows. \(R_{task}\) is the task's computing resource requirement and \(C_{server}\) is the total computing power of the edge server. The processing delay can be calculated using Equation (3):  
\[P_{processing}^{t_{j}}=\frac{R_{task}^{t_{j}}}{C_{server}^{s_{i}}} \tag{3}\]  
Due to hardware limitations, edge servers have a maximum limit on the number of computing tasks they can handle. Assuming that an edge server receives a task and finds that it has reached the maximum number of tasks, the task will enter a queue, potentially increasing the task's latency. The queuing delay is recorded using system time steps: if a system time step is set to 0.001 s, then queuing delay \(W\) is equivalent to the number of time steps the task spends waiting in the queue. To ensure the reliability of the computing power scheduling model, this paper considers a CPN scenario where servers are fully loaded when modeling the extended task processing time. The total time is then given by Equation (4):  
\[T_{total}^{t_{j}}=T_{trans}^{t_{j}}+P_{processing}^{t_{j}}+W^{t_{j}} \tag{4}\]  
(b) Energy consumption is determined by the power of the edge server during task processing and the time spent on processing the task. The power of the edge server varies between the idle and loaded states; the higher the power, the greater the energy consumption and the higher the costs incurred by the server. This paper uses \(P_{idle}\) to denote the power consumption in the idle state, \(P_{full}\) to denote the power under full loads, and \(\mu^{s}\) to denote the resource utilization rate (ranging from 0 to 1).