Followers 0

Algorithm Rewrite Bug?

0 posts in this topic

I am reading the paper "An enhanced recursive frequency splitting broadcasting algorithm for near video-on-demand services" written by Yu-Wei Chen.

There is something which confused me. Here is the algorithm explained as in the paper. And following is the algorithm I wrote in Python. The thing is my algorithm outputs different integers than it is given in the paper as a table. I highly doubt that there is an error or bug in a scientific paper but I can't seem to find the reason. I wanted to get a second opinion before contacting the author.

import math

c = 2
k = 3

subChannelCount = int(math.floor(math.sqrt(c)))
POOL = []

class SlotSequence:
ChannelNumber = 0
p = 0
q = 0

for i in range(k):
for subChannel in range(subChannelCount):
SS = SlotSequence()
SS.ChannelNumber = i
SS.p = subChannel
SS.q = subChannelCount
POOL.append(SS)

j = c

while(len(POOL) > 0):
minMod = 1000000000
minModIndex = -1
for idx,SS in enumerate(POOL):
if SS.q <= j:
if (j % SS.q) < minMod:
minMod = j % SS.q
minModIndex = idx

SS = POOL.pop(minModIndex)
alpha = int(math.floor(j/SS.q))

for x in range(1,alpha):
splitSS = SlotSequence()
splitSS.ChannelNumber = SS.ChannelNumber
splitSS.p = SS.p+x*SS.q
splitSS.q = alpha*SS.q
POOL.append(splitSS)
j = j + 1

print j-c 
Edited by Eralp
0

Create an account

Register a new account