Research Article

Efficient Channel Selection and Routing Algorithm for Multihop, Multichannel Cognitive Radio Networks with Energy Harvesting under Jamming Attacks

Algorithm 2

Multihop channel allocation scheme under attack in the physical layer.
(1) Input:  , , , , , , , .
(2) Output:  Obtain the best choice .
(3) Find , by using Eq. ((7)–(10)).
(4) Find a set of insufficient-energy relays .
(5) Find a set of insufficient-energy routes .
(6) Define a set of sufficient-energy routes as Eq. (22).
(7) Find a set of possible choices , .
(8) Define a set of energy harvesting cases , , .
(9) Define a set of energy harvesting probability cases , , .
(10) for    do
(11) for    do
(12) Initialize remaining energy of relays with the initial energy at the frame time index .
(13) for    do
(14) Update energy of relays.
(15) Calculate expected throughput for frame , as Eq. (13).
(16) Calculate delay time .
(17) Calculate throughput/delay ratio as Eq. (18).
(18) Calculate remaining energy of relays as Eq. (4).
(19) end for
(20) end for
(21) Define the best index , with .
(22) end for
(23) Define the best index , with .