计算卸载论文阅读01-理论梳理

这篇具有很好参考价值的文章主要介绍了计算卸载论文阅读01-理论梳理。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

标题:When Learning Joins Edge: Real-time Proportional Computation Offloading via Deep Reinforcement Learning

会议:ICPADS 2019

一、梳理

问题:在任务进行卸载时,往往忽略了任务的特定的卸载比例。

模型:针对上述问题,我们提出了一种创新的强化学习(RL)方法来解决比例计算问题。我们考虑了一种常见的卸载场景,该场景具有时变带宽和异构设备,并且设备不断生成应用程序。对于每个应用程序,客户端必须选择本地或远程执行该应用程序,并确定要卸载的比例。我们将该问题制定为一个长期优化问题,然后提出一种基于RL的算法来解决该问题。基本思想是估计可能决策的收益,其中选择收益最大的决策。我们没有采用原来的深度Q网络(DQN),而是通过添加优先级缓冲机制专家缓冲机制,提出了Advanced DQN(ADQN),分别提高了样本的利用率和克服了冷启动问题。

目的:最小化时延和能耗的权值和(优化参数:用户卸载策略卸载的比例)。

算法:ADQN。

二、模型细节与算法

2.1系统模型

计算卸载主要包含: 本地计算和边缘计算

1、本地计算:用户在时隙时的计算时延(计算时延和排队时延)和能耗为

计算卸载论文阅读01-理论梳理

其中表示任务大小,表示本地计算任务的比例

2、边缘计算:包含时延(上下行传输时延+执行时延+排队时延)和能耗
计算卸载论文阅读01-理论梳理

其中表示卸载到边缘服务器的比例,表示每单位计算任务处理后得到的结果大小。

3、总的时延与能耗成本

计算卸载论文阅读01-理论梳理

2.2优化目标

          

                

                

2.3 State、Action和Reward

1、状态空间:

状态空间包含:(数据大小、本地CPU频率,local可用计算资源,上行速率,下行速率,ES可用计算资源)

2、动作空间:

动作空间包含:(用户选择ES的策略,任务卸载比例)

3、奖励:

奖励:

表示本地计算成本,表示部分卸载产生的成本。

2.4代码

计算卸载环境代码:文章来源地址https://www.toymoban.com/news/detail-494264.html

import math
import copy
import numpy as np


class ENV():
    def __init__(self, UEs=3, MECs=7, k=33, lam=0.5):
        self.UEs = UEs
        self.MECs = MECs
        self.k = k

        q = np.full((k, 1), 0.)
        p = np.linspace(0, 1, k).reshape((k, 1))
        # Create Action
        for i in range(MECs - 1):
            a = np.full((k, 1), float(i + 1))
            b = np.linspace(0, 1, k).reshape((k, 1))
            q = np.append(q, a, axis=0)
            p = np.append(p, b, axis=0)  # 231(33 * 7) * 33

        self.actions = np.hstack((q, p))  # 231 * 2
        self.n_actions = len(self.actions)  # 231
        self.n_features = 3 + MECs * 3  # 3 + 7 * 3
        self.discount = 0.01

        # 基本参数
        # 频率
        self.Hz = 1
        self.kHz = 1000 * self.Hz
        self.mHz = 1000 * self.kHz
        self.GHz = 1000 * self.mHz
        self.nor = 10 ** (-7)
        self.nor1 = 10 ** 19

        # 数据大小
        self.bit = 1
        self.B = 8 * self.bit
        self.KB = 1024 * self.B
        self.MB = 1024 * self.KB

        # self.task_cpu_cycle = np.random.randint(2 * 10**9, 3* 10**9)

        self.UE_f = np.random.randint(1.5 * self.GHz * self.nor, 2 * self.GHz * self.nor)  # UE的计算能力
        self.MEC_f = np.random.randint(5 * self.GHz * self.nor, 7 * self.GHz * self.nor)  # MEC的计算能力
        # self.UE_f = 500 * self.mHz     # UE的计算能力
        # self.MEC_f = np.random.randint(5.2 * self.GHz, 24.3 * self.GHz)  # MEC的计算能力
        self.tr_energy = 1  # 传输能耗
        self.r = 40 * math.log2(1 + (16 * 10)) * self.MB * self.nor  # 传输速率
        # self.r = 800 # 传输速率
        self.ew, self.lw = 10 ** (-26), 3 * 10 ** (-26)  # 能耗系数
        # self.ew, self.lw = 0.3, 0.15 # 能耗系数
        self.et, self.lt = 1, 1
        self.local_core_max, self.local_core_min = 1.3 * self.UE_f, 0.7 * self.UE_f
        self.server_core_max, self.server_core_min = 1.3 * self.MEC_f, 0.7 * self.MEC_f
        self.uplink_max, self.uplink_min = 1.3 * self.r, 0.7 * self.r
        self.downlink_max, self.downlink_min = 1.3 * self.r, 0.7 * self.r
        self.lam = lam
        self.e = 1

    def reset(self):
        # 初始化环境,状态空间
        obs = []
        servers_cap = []
        new_cap = True
        for i in range(self.UEs):
            uplink, downlink = [], []
            # np.random.seed(np.random.randint(1, 1000))
            # task_size = np.random.randint(2 * 10**8 * self.nor, 3 * 10**8 * self.nor) #   任务大小
            task_size = np.random.randint(1.5 * self.mHz, 2 * self.mHz)  # 任务大小
            # self.task_size = self.task_size * self.task_cpu_cycle                     # 处理一个任务所需要的cpu频率
            # task_cpu_cycle = np.random.randint(2 * 10**9 * self.nor, 3 * 10**9 * self.nor)
            task_cpu_cycle = np.random.randint(10 ** 3, 10 ** 5)
            local_comp = np.random.randint(0.9 * self.UE_f, 1.1 * self.UE_f)  # UE的计算能力
            for i in range(self.MECs):
                up = np.random.randint(0.9 * self.r, 1.1 * self.r)
                down = np.random.randint(0.9 * self.r, 1.1 * self.r)
                if new_cap:
                    cap = np.random.randint(0.9 * self.MEC_f, 1.1 * self.MEC_f)  # MEC计算能力
                    servers_cap.append(cap)
                uplink.append(up)
                downlink.append(down)
            observation = np.array([task_size, task_cpu_cycle, local_comp])
            observation = np.hstack((observation, servers_cap, uplink, downlink))
            obs.append(observation)
            new_cap = False
        return obs

    def choose_action(self, prob):
        """
        根据概率选择动作
        :param prob:
        :return:
        """
        action_choice = np.linspace(0, 1, self.k)
        actions = []
        for i in range(self.UEs):
            a = np.random.choice(a=(self.MECs * self.k), p=prob[i])
            target_server = int(a / self.k)
            percen = action_choice[a % self.k]
            action = [target_server, percen]
            actions.append(action)
        return actions

    def step(self, observation, actions_prob, is_prob=True, is_compared=True):
        if is_prob:
            actions = self.choose_action(actions_prob)
        else:
            actions = actions_prob
        new_cap = False
        obs_ = []
        rew, local, ran, mec = [], [], [], []
        dpg_times, local_times, ran_times, mec_times = [], [], [], []
        dpg_energys, local_energys, ran_energys, mec_energys = [], [], [], []
        total = []
        a, b, c, d = 0, 0, 0, 0
        for i in range(self.UEs):
            if i == self.UEs - 1:
                new_cap = True
            # 提取信息
            task_size, task_cpu_cycle, local_comp, servers_cap, uplink, downlink = \
                observation[i][0], observation[i][1], observation[i][2], observation[i][3:3+self.MECs], observation[i][3+self.MECs:3+self.MECs*2], observation[i][3+self.MECs*2:3+self.MECs*3]

            action = actions[i]
            target_server, percen = int(action[0]), action[1]

            # 计算奖励
            # 1=======部分卸载==========
            # 卸载及回传数据产生的时延和能耗
            tr_time = (percen * task_size) / uplink[target_server] + self.discount * (percen * task_size) / downlink[
                target_server]
            tr_energy = (self.tr_energy * percen * task_size) / uplink[target_server] + self.discount * (
                        self.tr_energy * percen * task_size) / downlink[target_server]

            # 本地计算时延和能耗
            comp_local_time = task_cpu_cycle * (1 - percen) / (local_comp)
            comp_local_energy = self.lw * task_cpu_cycle * (1 - percen) * local_comp ** 2

            # 边缘计算时延和能耗
            comp_mec_time = (percen * task_cpu_cycle) / servers_cap[target_server]
            comp_mec_energy = self.ew * percen * task_cpu_cycle * servers_cap[target_server] ** 2

            # 最大计算时延
            comp_time = max(comp_local_time, comp_mec_time)
            time_cost = (comp_time + tr_time) * self.et
            # 能耗成本
            energy_cost = (tr_energy + comp_local_energy + comp_mec_energy) * self.e
            # 总成本
            total_cost = self.lam * time_cost + (1 - self.lam) * energy_cost

            # 2、=======完全本地计算==========
            local_only_time = task_cpu_cycle / (local_comp) * self.et
            local_only_energy = self.lw * task_cpu_cycle * local_comp ** 2 * self.e
            # local_only_energy = task_size * local_comp
            local_only = self.lam * local_only_time + (1 - self.lam) * local_only_energy

            # 3、=======完全边缘计算==========
            mec_only_tr_time = task_size / uplink[target_server] + self.discount * task_size / downlink[target_server]
            mec_only_tr_energy = self.tr_energy * task_size / uplink[
                target_server] + self.discount * self.tr_energy * task_size / downlink[target_server]
            # print("mec_only_tr_time:", mec_only_tr_time)
            # print("mec_only_tr_energy:", mec_only_tr_energy)

            mec_only_comp_time = task_cpu_cycle / servers_cap[target_server]
            mec_only_comp_energy = self.ew * task_cpu_cycle * servers_cap[target_server] ** 2
            # mec_only_comp_energy = task_size * servers_cap[target_server]
            # print("mec_only_comp_time:", mec_only_comp_time)
            # print("mec_only_comp_energy:", mec_only_comp_energy)

            mec_only_time_cost = (mec_only_tr_time + mec_only_comp_time) * self.et
            mec_only_energy_cost = (mec_only_tr_energy + mec_only_comp_energy) * self.e

            mec_only = self.lam * mec_only_time_cost + (1 - self.lam) * mec_only_energy_cost

            # 4、=======随机卸载==========
            percen_ran = np.random.uniform()  # 随机卸载比例
            mec_ran = np.random.randint(self.MECs)  # 随机选择一个服务器进行卸载

            random_tr_time = (percen_ran * task_size) / uplink[mec_ran] + (self.discount * percen_ran * task_size) / \
                             downlink[mec_ran]
            random_tr_energy = (self.tr_energy * percen_ran * task_size) / uplink[mec_ran] + self.discount * (
                        self.tr_energy * percen_ran * task_size) / downlink[mec_ran]

            random_comp_local_time = (1 - percen_ran) * task_cpu_cycle / local_comp
            random_comp_local_energy = self.lw * (1 - percen_ran) * task_cpu_cycle * local_comp ** 2
            # random_comp_local_energy = (1 - percen_ran) * task_size * local_comp

            random_comp_mec_time = percen_ran * task_cpu_cycle / servers_cap[mec_ran]
            random_comp_mec_energy = self.ew * percen_ran * task_cpu_cycle * servers_cap[mec_ran] ** 2
            # random_comp_mec_energy = percen_ran * task_size * servers_cap[mec_ran]

            random_comp_time = max(random_comp_local_time, random_comp_mec_time)
            random_time_cost = (random_comp_time + random_tr_time) * self.et
            random_energy_cost = (random_tr_energy + random_comp_local_energy + random_comp_mec_energy) * self.e

            random_total = self.lam * random_time_cost + (1 - self.lam) * random_energy_cost
            random_total_cost2 = random_energy_cost

            reward = -total_cost

            # 得到下一个observation
            x = np.random.uniform()
            y = 0.5
            if x > y:
                local_comp = min(local_comp + np.random.randint(0, 0.2 * self.UE_f), self.local_core_max)
                for j in range(self.MECs):
                    cap = min(servers_cap[j] + np.random.randint(0, 0.3 * self.UE_f), self.server_core_max)
                    # MEC容量保持一致
                    if new_cap:
                        for x in range(self.UEs):
                            observation[x][2 + j] = cap
                    downlink[j] = min(downlink[j] + np.random.randint(0, 0.2 * self.r), self.downlink_max)
                    uplink[j] = min(uplink[j] + np.random.randint(0, 0.2 * self.r), self.uplink_max)
            else:
                local_comp = max(local_comp + np.random.randint(-0.2 * self.UE_f, 0), self.local_core_min)
                for j in range(self.MECs):
                    # MEC容量保持一致
                    if new_cap:
                        cap = max(servers_cap[j] + np.random.randint(0, 0.3 * self.UE_f), self.server_core_max)
                        for x in range(self.UEs):
                            observation[x][2 + j] = cap
                    downlink[j] = max(downlink[j] - np.random.randint(0, 0.2 * self.r), self.downlink_min)
                    uplink[j] = max(uplink[j] - np.random.randint(0, 0.2 * self.r), self.uplink_min)

            task_size = np.random.randint(10, 50)
            task_cpu_cycle = np.random.randint(10 ** 3, 10 ** 5)  # 处理任务所需要的CPU频率
            observation_ = np.array([task_size, task_cpu_cycle, local_comp])
            observation_ = np.hstack((observation_, servers_cap, uplink, downlink))
            obs_.append(observation_)

            rew.append(reward)
            local.append(local_only)
            mec.append(mec_only)
            ran.append(random_total)

            dpg_times.append(time_cost)
            local_times.append(local_only_time)
            mec_times.append(mec_only_time_cost)
            ran_times.append(random_time_cost)

            dpg_energys.append(energy_cost)
            local_energys.append(local_only_energy)
            mec_energys.append(mec_only_energy_cost)
            ran_energys.append(random_energy_cost)

            total.append(total_cost)

        if is_compared:
            return obs_, rew, local, mec, ran, dpg_times, local_times, mec_times, ran_times, dpg_energys, local_energys, mec_energys, ran_energys, total
        else:
            return obs_, rew, dpg_times, dpg_energys

到了这里,关于计算卸载论文阅读01-理论梳理的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【论文阅读】Self-Paced Curriculum Learning

    论文下载 代码 Supplementary Materials bib: Curriculum learning (CL) or self-paced learning (SPL) represents a recently proposed learning regime inspired by the learning process of humans and animals that gradually proceeds from easy to more complex samples in training. The two methods share a similar conceptual learning paradigm, but differ in specific

    2024年02月03日
    浏览(28)
  • 【论文阅读】Deep Graph Contrastive Representation Learning

    作者:Yanqiao Zhu Yichen Xu 文章链接:Deep Graph Contrastive Representation Learning 代码链接:Deep Graph Contrastive Representation Learning 现实世界中,图的标签数量较少,尽管GNNs蓬勃发展,但是训练模型时标签的可用性问题也越来越受到关心。 传统的无监督图表征学习方法,例如DeepWalk和nod

    2024年01月18日
    浏览(42)
  • 【论文阅读笔记】Contrastive Learning with Stronger Augmentations

    基于提供的摘要,该论文的核心焦点是在对比学习领域提出的一个新框架——利用强数据增强的对比学习(Contrastive Learning with Stronger Augmentations,简称CLSA)。以下是对摘要的解析: 问题陈述: 表征学习(representation learning)已在对比学习方法的推动下得到了显著发展。 当前

    2024年02月19日
    浏览(31)
  • 论文阅读--Deep Learning-Based Channel Estimation

    论文信息: Soltani M, Pourahmadi V, Mirzaei A, et al. Deep learning-based channel estimation[J]. IEEE Communications Letters, 2019, 23(4): 652-655. 创新点: 信道时频响应建模为图像,将OFDM的时频特性视做一种2D图像信息。 将导频位置的通道响应视为LR图像,并将估计的通道响应视为HR图像。 利用基于深度

    2024年02月01日
    浏览(32)
  • 【论文阅读】Equivariant Contrastive Learning for Sequential Recommendation

    2023-RecSys https://github.com/Tokkiu/ECL 对比学习(CL)有利于对具有信息性自我监督信号的顺序推荐模型的训练。 现有的解决方案应用一般的顺序数据增强策略来生成正对,并鼓励它们的表示是不变的。 然而,由于用户行为序列的固有属性,一些增强策略,如项目替代,可能会导致

    2024年01月18日
    浏览(31)
  • Learning Sample Relationship for Exposure Correction 论文阅读笔记

    这是中科大发表在CVPR2023的一篇论文,提出了一个module和一个损失项,能够提高现有exposure correction网络的性能。这已经是最近第三次看到这种论文了,前两篇分别是CVPR2022的ENC(和这篇文章是同一个一作作者)和CVPR2023的SKF,都是类似即插即用地提出一些模块来提高现有方法的

    2024年02月07日
    浏览(38)
  • 【论文阅读笔记】 Representation Learning with Contrastive Predictive Coding

    这段文字是论文的摘要,作者讨论了监督学习在许多应用中取得的巨大进展,然而无监督学习并没有得到如此广泛的应用,仍然是人工智能中一个重要且具有挑战性的任务。在这项工作中,作者提出了一种通用的无监督学习方法,用于从高维数据中提取有用的表示,被称为“

    2024年01月25日
    浏览(27)
  • TartanVO: A Generalizable Learning-based VO 论文阅读

    题目 :TartanVO: A Generalizable Learning-based VO 作者 :Wenshan Wang, Yaoyu Hu 来源 :CoRL 时间 :2021 代码地址 :https://github.com/castacks/tartanvo 我们提出了第一个基于学习的视觉里程计(VO)模型,该模型可推广到多个数据集和现实场景,并且在具有挑战性的场景中优于基于几何的方法。

    2024年02月13日
    浏览(30)
  • 【论文阅读】The Deep Learning Compiler: A Comprehensive Survey

    论文来源:Li M , Liu Y , Liu X ,et al.The Deep Learning Compiler: A Comprehensive Survey[J]. 2020.DOI:10.1109/TPDS.2020.3030548. 这是一篇关于深度学习编译器的综述类文章。 什么是深度学习编译器 深度学习(Deep Learning)编译器将深度学习框架描述的模型在各种硬件平台上生成有效的代码实现,其完

    2024年02月15日
    浏览(33)
  • 【论文阅读】Self-supervised Learning: Generative or Contrastive

    研究了在计算机视觉、自然语言处理和图形学习中用于表示的新的自监督学习方法。全面回顾了现有的实证方法,并根据其目的将其归纳为三大类:生成性、对比性和生成性对比(对抗性)。进一步收集了关于自我监督学习的相关理论分析,以对自我监督学习为什么有效提供

    2024年01月18日
    浏览(38)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包