def __init__(self, N):
        self.N = N
        self.CacheRecency = Disk(N)
        self.CacheFrequecy = priorityqueue(N)
        self.Hist1 = Disk(N)
        self.Hist2 = priorityqueue(N)

        ## Config variables
        self.decayRate = 1
        self.epsilon = 0.05
        self.lamb = 0.05
        self.learning_phase = N / 2
        #         self.error_discount_rate = (0.005)**(1.0/N) ## TODO ADD BACK
        self.error_discount_rate = 1

        ##
        self.learning = True
        self.policy = 0
        self.evictionTime = {}
        self.policyUsed = {}
        self.weightsUsed = {}
        self.freq = {}

        ## TODO add decay_time and decay_factor
        self.decay_time = N
        self.decay_factor = 1

        ## Accounting variables
        self.time = 0

        self.W = np.array([.5, .5], dtype=np.float32)

        self.X = np.array([], dtype=np.int32)
        self.Y1 = np.array([])
        self.Y2 = np.array([])
Beispiel #2
0
    def __init__(self, N, decay=1):
        self.N = N
        self.PQ = priorityqueue(N)

        self.unique = {}
        self.unique_cnt = 0
        self.pollution_dat_x = []
        self.pollution_dat_y = []
        self.time = 0
    def __init__(self, N):
        self.N = N
        self.CacheRecency = Disk(N)
        self.CacheFrequecy = priorityqueue(N)
        
        self.Hist1 = Disk(N)        
        self.Hist2 = priorityqueue(N)        
        
        ## Config variables
        self.decayRate = 1
        self.epsilon = 0.90
        self.lamb = 0.05
        self.learning_phase = N/2
        self.error_discount_rate = (0.005)**(1.0/N)
#         self.error_discount_rate = 1
        
        ## 
        self.learning = True
        self.policy = 0
        self.evictionTime = {}
        self.policyUsed = {}
        self.weightsUsed = {}
        self.freq = {}
        
        ## TODO add decay_time and decay_factor
        self.decay_time = N
        self.decay_factor = 1
        
        ## Accounting variables
        self.time = 0
        self.W = np.zeros((10,2))
        self.W[:,:] = 0.5
        
        self.X = np.array([],dtype=np.int32)
        self.Y1 = np.array([])
        self.Y2 = np.array([])
        
        
        ###
        self.q = Queue.Queue()
        self.sum = 0
        self.NewPages = []
Beispiel #4
0
    def __init__(self, param):

        assert 'cache_size' in param
        self.N = int(param['cache_size'])
        self.PQ = priorityqueue(self.N)

        self.unique = {}
        self.unique_cnt = 0
        self.pollution_dat_x = []
        self.pollution_dat_y = []
        self.time = 0
 def __init__(self, N,decay=1):
     self.N = N
     self.PQ = priorityqueue(N)
     self.time = 0