# rikonenobais/deep-q-learning-for-mobile-edge-computing architecture

> Architecture diagram of the GitHub repository rikonenobais/deep-q-learning-for-mobile-edge-computing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rikonenobais/deep-q-learning-for-mobile-edge-computing
- Repository: https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing

## Overview

This repository implements a research simulator and Deep-Q-learning workflow for mobile-edge task offloading. A training script creates an Offload environment and per-device DQN agents, runs episodes, and collects reward, cost, delay, and task statistics. The environment models local execution, transmission, fog execution, queues, and delay limits; the agent uses recurrent state and experience replay to select actions and learn. The README identifies train.py as the main entry point; trainPaperParam.py is a parallel experiment script. Excerpts omit some method calls, so internal environment wiring is shown only where directly supported.

Main entry points: [`fog_env.py`](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py) (Offload environment), [`train.py`](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/train.py) (Main training), [`RL_brain.py`](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py) (DQN agent), [`trainPaperParam.py`](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/trainPaperParam.py) (Paper parameters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Training orchestration"]
  node_main_train["Main training<br/>[train.py]"]
  node_paper_train["Paper parameters<br/>[trainPaperParam.py]"]
  node_episode_metrics["Episode metrics<br/>[train.py]"]
end

subgraph group_simulation["Offloading simulation"]
  node_offload_env["Offload environment<br/>[fog_env.py]"]
  node_local_exec["Local execution<br/>[fog_env.py]"]
  node_transmission["Task transmission<br/>[fog_env.py]"]
  node_fog_exec["Fog execution<br/>[fog_env.py]"]
  node_task_queues["Task queues<br/>[fog_env.py]"]
  node_delay_tracking["Delay tracking<br/>[fog_env.py]"]
end

subgraph group_learning["DQN learning"]
  node_dqn_agent["DQN agent<br/>[RL_brain.py]"]
  node_replay_memory[("Replay memory<br/>[RL_brain.py]")]
  node_q_networks["Q networks<br/>[RL_brain.py]"]
end

node_researcher(("Researcher"))
node_tensorflow["TensorFlow"]

node_researcher -->|"starts training"| node_main_train
node_researcher -.->|"starts experiment"| node_paper_train
node_main_train -->|"creates and steps"| node_offload_env
node_paper_train -.->|"creates and steps"| node_offload_env
node_main_train -->|"creates, selects, learns"| node_dqn_agent
node_paper_train -.->|"creates, selects, learns"| node_dqn_agent
node_main_train -->|"collects results"| node_episode_metrics
node_offload_env -->|"processes locally"| node_local_exec
node_offload_env -->|"transmits offloaded tasks"| node_transmission
node_transmission -->|"enqueues for fog"| node_task_queues
node_local_exec -->|"reads local work"| node_task_queues
node_fog_exec -->|"reads fog work"| node_task_queues
node_offload_env -->|"processes at fog"| node_fog_exec
node_offload_env -->|"records delays"| node_delay_tracking
node_dqn_agent -->|"stores transitions"| node_replay_memory
node_dqn_agent -->|"evaluates and trains"| node_q_networks
node_q_networks -->|"runs graph operations"| node_tensorflow

click node_main_train "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/train.py"
click node_paper_train "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/trainPaperParam.py"
click node_episode_metrics "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/train.py"
click node_offload_env "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py"
click node_local_exec "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py"
click node_transmission "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py"
click node_fog_exec "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py"
click node_task_queues "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py"
click node_delay_tracking "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py"
click node_dqn_agent "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py"
click node_replay_memory "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py"
click node_q_networks "https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_train,node_paper_train,node_episode_metrics toneBlue
class node_offload_env,node_local_exec,node_transmission,node_fog_exec,node_task_queues,node_delay_tracking toneAmber
class node_dqn_agent,node_replay_memory,node_q_networks toneMint
class node_researcher,node_tensorflow toneIndigo
```

## Components

### Training orchestration

- [Main training](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/train.py): `train.py`
- [Paper parameters](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/trainPaperParam.py): `trainPaperParam.py`
- [Episode metrics](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/train.py): `train.py`

### Offloading simulation

- [Offload environment](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py): `fog_env.py`
- [Local execution](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py): `fog_env.py`
- [Task transmission](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py): `fog_env.py`
- [Fog execution](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py): `fog_env.py`
- [Task queues](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py): `fog_env.py`
- [Delay tracking](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/fog_env.py): `fog_env.py`

### DQN learning

- [DQN agent](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py): `RL_brain.py`
- [Replay memory](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py): `RL_brain.py`
- [Q networks](https://github.com/rikonenobais/deep-q-learning-for-mobile-edge-computing/blob/main/RL_brain.py): `RL_brain.py`

### Other components

- **Researcher**
- **TensorFlow**

## Connections

- Researcher → Main training: starts training
- Researcher → Paper parameters: starts experiment
- Main training → Offload environment: creates and steps
- Paper parameters → Offload environment: creates and steps
- Main training → DQN agent: creates, selects, learns
- Paper parameters → DQN agent: creates, selects, learns
- Main training → Episode metrics: collects results
- Offload environment → Local execution: processes locally
- Offload environment → Task transmission: transmits offloaded tasks
- Task transmission → Task queues: enqueues for fog
- Local execution → Task queues: reads local work
- Fog execution → Task queues: reads fog work
- Offload environment → Fog execution: processes at fog
- Offload environment → Delay tracking: records delays
- DQN agent → Replay memory: stores transitions
- DQN agent → Q networks: evaluates and trains
- Q networks → TensorFlow: runs graph operations
