## 4 The Proposed Approach
### Methods and Algorithms
_Update_DD_Model0_  
//[1] if no deadlines exist, update the model to introduce new deadlines  
If InfectionList = \(\varphi\) THEN  
Max_Infection = N\({}_{\text{S}}\).size() + 0.75\"N\({}_{\text{S}}\).size()  
//Randomly infect part of the population; change state from S to E  
For (I = 0... Max_Infection):  
Infected_I = Any N\({}_{\text{S}}\)[i] with N\({}_{\text{S}}\)[i].state = susceptible  
_InfectionList + = Infect (Infected_I_Current_Time)_  
//[2] Check if the earliest deadline is exceeded to update the time  
If (InfectionList.Next.Time > CurrentTime)//if the earliest deadline- T  
_Update_Constraint(0)_  
V **N\({}_{\text{S}}\)[i] \(\in\) N\({}_{\text{S}}\)**:  
the resource is expired, then remove it and reassign it as susceptible  
If N\({}_{\text{S}}\)[i].state = D  
N\({}_{\text{S}}\) = N\({}_{\text{S}}\) - N\({}_{\text{S}}\) [i]  
N\({}_{\text{S}}\).add (Resource(susceptible))  
_Infect(F, CurrentTime)_  
Update Ti, Tr, Tt, Ts, Td //using eqs (1)-(5)  
F.state = E//change the state of the current susceptible resources (I \(\sim\) E)  
InfectionList.add (F, \"I\", Ti)//add constraints to resource F with the state \"infected\" and the deadline \"Ti\"  
If (Tr < Td)//if recovery < death time, then the resource will not expire  
While (Tr < Tr)//while the transmission time has not reached the recovery time  
InfectionList.add(F, \"T\", Tt)//exposure before recovery  
Tr = Tt + (B*CurrentTime)  
InfectionList.add(F, \"R\", Tr)  
InfectionList.add(F, \"S\", Ts)  
Else//if recovery > death, resource will expire (if not collected before T\({}_{\text{S}}\))  
While (Tt < Td)  
InfectionList.add (F, \"T\", Tt)  
Tr = Tt + (B*CurrentTime)  
_InfectionList.add (F, \"D\", Td)_  
_Update_Constraint0_  
//[1] get the earliest resource in the infected state  
Fn = InfectionList.Next()  
InfectionList = InfectionList - Fn  
//[2] Update the selected resource state based on its DD_Model  
If Fn.state = I THEN N\({}_{\text{S}}\)[Fn.Index].state = I//when T\({}_{\text{I}}\) < T\(<\) Tt  
Else If Fn.state = R THEN N\({}_{\text{S}}\)[Fn.Index].state = R//when Tt < T\(<\) Tr  
If Fn.state = S THEN N\({}_{\text{S}}\)[Fn.Index].state = S//when Tr < T\(<\) Ts  
If Fn.state = D THEN N\({}_{\text{S}}\)[Fn.Index].state = D//when T > Td  
[3] If the selected resource is in the transmission state, it will contact its neighbors and change their states to infected while it is in recovery  
If Fn.state = T  
Update R0 using (12)//get the susceptible resources that are near Fn  
NeighborList = get_neighbor(R0, Fn)  
**v _Fj_**: NeighborList:  
Infect(Fj, CurrentTime)_  
Figure 3: ED_Foraging “DD_Model functions”. (**a**) The resource states are validated and updated according to the DD_Model. (**b**) The expected time constraint of each resource is computed and added to the resource event list \(L_{t}\). (**c**) The resource constraint is updated depending on the resource’s current state and expected future events stored in the event list \(L_{t}\). In the beginning, the _Update_DD_Model_ function checks whether there is a deadline at the current time. If no active deadline is found, the model randomly adds deadlines by changing the state of the susceptible resources using the _infect_ function to introduce new deadlines to the task. On the other hand, if there are resources with deadlines, the earliest deadline state is checked. If the deadline is greater than the current time, the resource state is updated to the next state, and hence, the deadline becomes more critical. The state of the earliest resource is updated depending on its current state and the deadline via the _update_constraint_ function. After updating the deadline, the new resource state is validated. If the new state is dead, it means that \(T_{d}\) has been reached and the resource deadline has expired. Thus, it should be removed from the population and reassigned to a new location as a new susceptible resource. In the _infect_ function (Figure 3b), the expected deadlines of the selected resources are computed with respect to the current time using (1)-(5).