21.3D surface

3D surface

python 复制代码
"""
@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()
相关推荐
sali-tec2 分钟前
C# 基于halcon的视觉工作流-章62 点云采样
开发语言·图像处理·人工智能·算法·计算机视觉
EAIReport6 分钟前
通过数据分析自动化产品实现AI生成PPT的完整流程
人工智能·数据分析·自动化
swanwei17 分钟前
量子科技对核心产业的颠覆性影响及落地时间表(全文2500字)
大数据·网络·人工智能·程序人生·量子计算
没有bug.的程序员33 分钟前
Java 字节码:看懂 JVM 的“机器语言“
java·jvm·python·spring·微服务
AKAMAI34 分钟前
从 Cloudflare 服务中断,看建立多维度风险应对机制的必要
人工智能·云原生·云计算
道可云43 分钟前
道可云人工智能每日资讯|2025青岛虚拟现实创新大会即将举行
人工智能·vr
酷雷曼VR全景1 小时前
身边的变化丨从“尝鲜”到“刚需”,VR全景让生活“立体化”
人工智能·生活·vr·vr全景·酷雷曼·合作商
m0_650108241 小时前
Flamingo:打破模态壁垒的少样本视觉语言模型
论文阅读·人工智能·视觉语言模型·deepmind·vlm·通用智能·通用小样本适配
gorgeous(๑>؂<๑)1 小时前
【ICLR26匿名投稿】Context-Aware ViT:让目标检测真正“看清上下文”的增强策略
人工智能·目标检测·机器学习·计算机视觉·目标跟踪
AI大模型学徒1 小时前
NLP基础(七)_文本分析与关键词提取
人工智能·自然语言处理