# rzil-1/energy-efficient-rl-sensor-network architecture

> Architecture diagram of the GitHub repository rzil-1/energy-efficient-rl-sensor-network, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rzil-1/energy-efficient-rl-sensor-network
- Repository: https://github.com/rzil-1/energy-efficient-rl-sensor-network

## Overview

##### Project type and purpose
- This is a research-oriented, full-Python reinforcement-learning (RL) application.
- Purpose: implement and evaluate an RL‐based scheduler to maximize the lifetime of a wireless sensor network.

##### File structure
- agents/rl_agent.py: core RL agent implementation (policy, training loop).
- environment/sensor_env.py: custom OpenAI-Gym-style environment simulating sensor network behavior.
- models/ppo_sensor_model.zip: serialized trained policy (PPO algorithm checkpoint).
- data/results/monitor.csv: logged performance metrics over training/evaluation.
- notebooks/: Jupyter experiments (training, evaluation, plotting).
- requirements.txt: framework dependencies (e.g., numpy, torch, gym).

##### README
- Confirms RL scheduling for wireless sensor networks.

##### Detail
– Break “Training Loop” into sub-steps if needed:
1. collect trajectories
2. compute advantages
3. update policy
4. log metrics
5. checkpoint
– Capture any external dependencies (e.g., random seed manager, hyperparameter config file if present).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Compute Components"
        direction TB
        ENV["RL Environment"]:::compute
        AGENT["RL Agent"]:::compute
        subgraph "Training Loop"
            direction TB
            STEP1["Collect Trajectories"]:::compute
            STEP2["Compute Advantages"]:::compute
            STEP3["Update Policy"]:::compute
            STEP4["Log Metrics"]:::compute
            STEP5["Checkpoint Model"]:::compute
        end
    end

    subgraph "Storage"
        direction TB
        DATA["Metrics Storage"]:::storage
        MODEL["Model Storage"]:::storage
    end

    subgraph "Notebooks"
        direction TB
        RUN["Run Agent (Train)"]:::notebook
        TEST["Test Env"]:::notebook
        PLOT["Plot & Analyze"]:::notebook
    end

    subgraph "Project Docs & Dependencies"
        direction TB
        OV["Project Overview & Instructions"]:::note
        REQ["Dependency Specification"]:::note
    end

    AGENT -->|"action"| ENV
    ENV -->|"observation + reward + done"| AGENT

    AGENT -->|"send trajectories"| STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 -->|"write metrics"| DATA
    STEP5 -->|"save checkpoint"| MODEL
    STEP4 --> STEP5

    RUN --> AGENT
    RUN --> ENV
    TEST --> AGENT
    TEST --> ENV

    PLOT --> DATA
    PLOT --> MODEL

    click ENV "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/environment/sensor_env.py"
    click AGENT "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/agents/rl_agent.py"
    click RUN "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/notebooks/run_trained_agent.py"
    click TEST "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/notebooks/test_env.py"
    click PLOT "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/notebooks/plot_rewards.py"
    click DATA "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/data/results/monitor.csv"
    click MODEL "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/models/ppo_sensor_model.zip"
    click REQ "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/requirements.txt"
    click OV "https://github.com/rzil-1/energy-efficient-rl-sensor-network/blob/main/README.md"

    classDef compute fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef storage fill:#DFFFE0,stroke:#228B22,stroke-width:1px
    classDef notebook fill:#FFF5BA,stroke:#DAA520,stroke-width:1px
    classDef note fill:#F0F0F0,stroke:#999,stroke-width:1px,stroke-dasharray:5 5
```
