def fcfs(self): self.initial() total_reward = 0 for index, row in self.df.iterrows(): if row['status'] == 'arrive': self.local_first(row) # 执行部署 self.fill_current_load(row) self.fill_edge_width(row) else: # 'leave' self.rele_current_load(row) self.rele_edge_width(row) print('firs-come first-serve: ') st.stastics(self.df, self.vm_locate_idx, self.info, 'fcfs', total_reward)
def res_class(self): self.initial() total_reward = 0 for index, row in self.df.iterrows(): if row['status'] == 'arrive': self.res_class_III(row) self.fill_current_load(row) self.fill_edge_width(row) else: # 'leave' self.rele_current_load(row) self.rele_edge_width(row) print('\n') print('res_class: ') st.stastics(self.df, self.vm_locate_idx, self.info, 'res_class', total_reward)
def curf(self): self.initial() total_reward = 0 for index, row in self.df.iterrows(): if row['status'] == 'arrive': if row['cpu'] > 25 or row['ram'] > 25: self.dc_first(row) # 计算密集优先使用DC else: self.local_first(row) self.fill_current_load(row) self.fill_edge_width(row) else: # 'leave' self.rele_current_load(row) self.rele_edge_width(row) print('\n') print('computing-unintensive request first: ') st.stastics(self.df, self.vm_locate_idx, self.info, 'curf', total_reward)
def hbdf(self): self.initial() total_reward = 0 for index, row in self.df.iterrows(): if row['status'] == 'arrive': if row['bandwidth'] > 20: # 大带宽定义:大于20G self.local_first(row) # 大带宽优先使用local else: self.dc_first(row) self.fill_current_load(row) self.fill_edge_width(row) else: # 'leave' self.rele_current_load(row) self.rele_edge_width(row) print('\n') print('huge bandwidth first: ') st.stastics(self.df, self.vm_locate_idx, self.info, 'hbdf', total_reward)
def dsrf(self): self.initial() total_reward = 0 for index, row in self.df.iterrows(): if row['status'] == 'arrive': if row['delay_sen'] == 1: self.local_first(row) # 延时敏感优先使用local else: self.dc_first(row) self.fill_current_load(row) self.fill_edge_width(row) else: # 'leave' self.rele_current_load(row) self.rele_edge_width(row) print('\n') print('delay-sensitive request first: ') st.stastics(self.df, self.vm_locate_idx, self.info, 'dsrf', total_reward)