def reset(self): mpsched.persist_state(self.fd) time.sleep(1) self.last = mpsched.get_sub_info(self.fd) for i in range(self.k): subs = mpsched.get_sub_info(self.fd) for j in range(len(subs)): self.tp[j].append(subs[j][0] - self.last[j][0]) self.rtt[j].append(subs[j][1] - self.last[j][1]) self.cwnd[j].append(subs[j][2]) self.last = subs time.sleep(self.time) mate = mpsched.get_meta_info(self.fd) self.recv_buff_size = mate[0] self.rr = mate[1] return [self.tp[0] + self.rtt[0] + self.cwnd[0] + [self.recv_buff_size, self.rr], self.tp[1] + self.rtt[1] + self.cwnd[1]+ [self.recv_buff_size, self.rr]]
def step(self, action): A = [self.fd, action[0], action[1]] mpsched.set_seg(A) time.sleep(self.time) state_nxt = mpsched.get_sub_info(self.fd) done = False if len(state_nxt) == 0: done = True return done
def step(self, action): # A = [self.fd, action[0], action[1]] # mpsched.set_seg(A) time.sleep(self.time) state_nxt = mpsched.get_sub_info(self.fd) done = False if len(state_nxt) == 0: done = True self.count = self.count + 1 return self.adjust(state_nxt), self.reward(), self.count, self.recv_buff_size, done
def reset(self): mpsched.persist_state(self.fd) """time.sleep()""" self.last = mpsched.get_sub_info(self.fd) self.rr.append(self.last[0][3]) self.rr.append(self.last[1][3]) self.in_flight.append(self.last[0][4]) self.in_flight.append(self.last[1][4]) for i in range(self.k): subs = mpsched.get_sub_info(self.fd) for j in range(len(subs)): self.tp[j].append(subs[j][0] - self.last[j][0]) self.rtt[j].append(subs[j][1]) self.dRtt[j].append(subs[j][1] - self.last[j][1]) self.cwnd[j].append(subs[j][2]) self.rr[j] = subs[j][3] self.in_flight[j] = subs[j][4] self.last = subs time.sleep(self.time) return [self.tp[0]+self.rtt[0]+self.cwnd[0]+[self.rr[0], self.in_flight[0]], self.tp[1]+self.rtt[1]+self.cwnd[1]+[self.rr[1], self.in_flight[1]]]