当前位置: 首页 > article >正文

21.3D surface

3D surface

"""
@File    : 05-decoding-Major
@Name    : 3d_surface.py
@Author  : lyq
@Date    : 2024/11/16 23:10
@Envi    : PyCharm 
@Description:  files details
"""
import numpy as np
import matplotlib.pyplot as plt

# 设置全局默认字体为Times New Roman
plt.rcParams['font.family'] = 'Times New Roman'


def test_dynamic_performance(alpha, beta, gamma, T, N, scenario_fluctuation=0.2):
    q_n_t = np.random.uniform(1, 5, (N, T))  # Simulated quality levels
    dynamic_fluctuations = np.random.uniform(1 - scenario_fluctuation, 1 + scenario_fluctuation, (N, T))

    QoE = 0
    variances = []
    for t in range(T):
        quality = np.mean(q_n_t[:, t] * dynamic_fluctuations[:, t])  # Add dynamic fluctuation to quality
        delay = np.mean([0.1 * q * (1 + 0.1 * np.sin(10 * gamma)) for q in q_n_t[:, t]])
        variance = np.var(q_n_t[:, t] * dynamic_fluctuations[:, t])
        decoding = np.mean([0.05 * q * (1 + 0.05 * np.cos(7 * gamma)) for q in q_n_t[:, t]])

        variances.append(variance)
        QoE += (quality - alpha * delay - beta * variance - gamma * decoding)

    QoE_normalized = (QoE / (T * 5)) * 10  # Normalize QoE to 0-10 range
    variance_scaled = (np.mean(variances) / (5 ** 2)) * 1  # Scale Variance to target ~1
    return QoE_normalized, variance_scaled


# Generate a grid of alpha, beta, and gamma values for the QoE surface
alpha_range = np.linspace(0.08, 0.12, 10)  # Around fixed alpha = 0.1
beta_range = np.linspace(0.45, 0.55, 10)  # Around fixed beta = 0.5
gamma_range = np.linspace(0.045, 0.055, 10)  # Around target gamma range

# Create meshgrid for alpha, beta, and gamma
alpha_grid, beta_grid, gamma_grid = np.meshgrid(alpha_range, beta_range, gamma_range)

# Compute QoE for each combination of alpha, beta, and gamma
qoe_surface = np.zeros_like(alpha_grid)
T = 100  # Time steps
N = 5  # Number of users
for i in range(alpha_grid.shape[0]):
    for j in range(alpha_grid.shape[1]):
        for k in range(alpha_grid.shape[2]):
            alpha = alpha_grid[i, j, k]
            beta = beta_grid[i, j, k]
            gamma = gamma_grid[i, j, k]
            qoe, _ = test_dynamic_performance(alpha, beta, gamma, T, N)
            qoe_surface[i, j, k] = qoe

# Plot 3D QoE surface for fixed gamma slice
fig = plt.figure(figsize=(12, 8))
ax = fig.add_subplot(111, projection='3d')

# Select a slice of gamma for visualization
gamma_index = len(gamma_range) // 2  # Middle gamma value
qoe_slice = qoe_surface[:, :, gamma_index]

alpha_slice = alpha_grid[:, :, gamma_index]
beta_slice = beta_grid[:, :, gamma_index]

surf = ax.plot_surface(alpha_slice, beta_slice, qoe_slice, cmap='viridis')
ax.set_title(f"3D QoE Surface (Gamma = {gamma_range[gamma_index]:.3f})")
ax.set_xlabel("Alpha (X-axis)")
ax.set_ylabel("Beta (Y-axis)")
ax.set_zlabel("QoE")
fig.colorbar(surf, shrink=0.5, aspect=10, label='QoE')
plt.autoscale(tight=True)
plt.savefig('3D_QoE_Surface.pdf')
plt.show()

在这里插入图片描述


http://www.kler.cn/a/398466.html

相关文章:

  • 从零入门激光SLAM(二十三)——direct_visual_lidar_calibration全型号激光雷达-相机标定包
  • 大数据如何助力干部选拔的公正性
  • 《生成式 AI》课程 第3講 CODE TASK 任务3:自定义任务的机器人
  • python实现十进制转换二进制,tkinter界面
  • 蓝桥杯每日真题 - 第15天
  • 在Node.js中如何使用TypeScript
  • Python 子进程输出重定向以后,部分内容会出现在父进程的控制台屏幕上
  • .NET 一款SYSTEM权限隐藏的计划任务工具
  • vxe-grid table 校验指定行单元格的字段,只校验某个列的字段
  • Leetcode 3356. Zero Array Transformation II
  • uni-app快速入门(六)--rpx尺寸单位与Flex布局
  • 【网络安全面经】OSI七层模型每层都有什么协议
  • 【网络安全】SSL(一):为什么需要 Keyless SSL?
  • 023、ELK 从入门到实践
  • 【AI日记】24.11.17 看 GraphRAG 论文,了解月之暗面
  • 深度学习中常见的学习率调整策略
  • 蓝桥杯c++算法学习【4】之简单数论(阶乘约数、求值、循环小数、等差数列、最大比例:::非常典型的必刷例题!!!)
  • PyCharm2024.2.4安装
  • 【初阶数据结构与算法】链表刷题之链表分割、相交链表、环形链表1、环形链表I、环形链表II
  • Ajax获取PHP端csv转的json数据并js前端排序与分页
  • 华东师范大学数学分析第五版PDF习题答案上册及下册
  • 第二十三章 TCP 客户端 服务器通信 - SSL TLS组件
  • java实现代码沙盒(docker-java)
  • 基于neo4j的体育运动员问答问答系统
  • 遇到 mysql_config not found 错误
  • CSS基础知识05(弹性盒子、布局详解,动画,3D转换,calc)