Algorithm Rewrite Bug?

Started by
-1 comments, last by Eralp 11 years, 3 months ago

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.

c_ERFSAlgorithm.png


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 

This topic is closed to new replies.

Advertisement