# tomer1203/generative_ris_optimization architecture

> Architecture diagram of the GitHub repository tomer1203/generative_ris_optimization, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomer1203/generative_ris_optimization
- Repository: https://github.com/tomer1203/generative_ris_optimization

## Overview

##### Project type and purpose
- From the directory layout and README, this is a research‐oriented Python simulation pipeline for “AI‐Aided Annealed Langevin Dynamics for Rapid Optimization of Programmable Channels.”
- It’s neither a full-stack web app nor a standalone service. Rather, it’s a modular data‐science / ML + physics simulation tool that reads channel data, applies a physical fading model, trains or loads neural networks, runs an optimization loop, logs progress, and produces plots.

##### File structure
- Top-level directories:
- Code/ – all Python code, subfolders for models, logs, outputs, plots
- Data/ – raw MATLAB / tensor data used by dataset loader
- PhysFad/ – reference physical‐model data files
- README.md
- Key files in Code/:
- config.py + configuration.yaml – global parameters & switches
- main.py – entry point orchestrating the pipeline
- dataset.py – loads Data/ + PhysFad/ files into PyTorch/Tensors
- physfad_optimal_parameters.txt & PhysFadPy.py – encapsulates the physical fading model
- models.py & Code/Models/*.pt – network definitions & pretrained weights
- ChannelMatrixEvaluation.py / rate_model.py – core routines for rate-or capacity-evaluation
- utils.py – shared utilities
- plot_*.py & plots/ – visualization scripts + their outputs
- logs/ – textual run logs
- outputs/ – numeric results (npy, pdf)
- There are no build/deploy scripts; execution is via “python main.py,” guided by configuration.yaml.

##### README for additional insights
- The README confirms the module breakdown (config, main, physfad, models, dataset, utils, plot_*.py).
- It instructs that all behavior (e.g. choose simulation or training) is controlled by configuration.yaml.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Configuration Layer
    config_py["config.py"]:::support
    configuration_yaml["configuration.yaml"]:::support

    %% Data Layer
    PhysFad_dir["(PhysFad/)"]:::io
    Data_dir["(Data/)"]:::io

    %% Data Ingestion
    dataset_py["dataset.py"]:::code

    %% Physical Model
    physfad_py["PhysFadPy.py"]:::code
    physfad_params["physfad_optimal_parameters.txt"]:::code

    %% ML Models
    models_py["models.py"]:::code
    pretrained_weights["(Models/*.pt)"]:::io

    %% Core Optimization Engine
    main_py["main.py"]:::code
    channel_eval["ChannelMatrixEvaluation.py"]:::code
    rate_model["rate_model.py"]:::code

    %% Utilities & Logging
    utils_py["utils.py"]:::code
    logs_dir["(logs/)"]:::support

    %% Outputs & Visualization
    outputs_dir["(outputs/)"]:::io
    plot_SNR["plot_SNR.py"]:::code
    plot_iteration_graph["plot_iteration_graph.py"]:::code
    plot_time_graph["plot_time_graph.py"]:::code
    plots_dir["(plots/)"]:::io

    %% Flows
    config_py -->|provides params| dataset_py
    config_py -->|provides params| physfad_py
    config_py -->|provides params| models_py
    configuration_yaml -->|drives pipeline| main_py

    dataset_py -->|loads raw data| PhysFad_dir
    dataset_py -->|loads raw data| Data_dir
    dataset_py -->|produces tensors| physfad_py
    dataset_py -->|supplies data| main_py

    physfad_py -->|computes fading| main_py
    physfad_params -->|parameters| physfad_py

    models_py -->|defines/trains networks| main_py
    pretrained_weights -->|weights| main_py

    main_py -->|calls| channel_eval
    main_py -->|calls| rate_model
    main_py -->|logs progress| logs_dir
    main_py -->|writes results| outputs_dir

    outputs_dir -->|inputs| plot_SNR
    outputs_dir -->|inputs| plot_iteration_graph
    outputs_dir -->|inputs| plot_time_graph

    plot_SNR -->|generates| plots_dir
    plot_iteration_graph -->|generates| plots_dir
    plot_time_graph -->|generates| plots_dir

    %% Click Events
    click config_py "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/config.py"
    click configuration_yaml "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/configuration.yaml"
    click PhysFad_dir "https://github.com/tomer1203/generative_ris_optimization/tree/main/PhysFad/"
    click Data_dir "https://github.com/tomer1203/generative_ris_optimization/tree/main/Data/"
    click dataset_py "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/dataset.py"
    click physfad_py "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/PhysFadPy.py"
    click physfad_params "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/Physfad_optimal_parameters.txt"
    click models_py "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/models.py"
    click pretrained_weights "https://github.com/tomer1203/generative_ris_optimization/tree/main/Code/Models/"
    click main_py "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/main.py"
    click channel_eval "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/ChannelMatrixEvaluation.py"
    click rate_model "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/rate_model.py"
    click utils_py "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/utils.py"
    click logs_dir "https://github.com/tomer1203/generative_ris_optimization/tree/main/Code/logs/"
    click outputs_dir "https://github.com/tomer1203/generative_ris_optimization/tree/main/Code/outputs/"
    click plot_SNR "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/plot_SNR.py"
    click plot_iteration_graph "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/plot_iteration_graph.py"
    click plot_time_graph "https://github.com/tomer1203/generative_ris_optimization/blob/main/Code/plot_time_graph.py"
    click plots_dir "https://github.com/tomer1203/generative_ris_optimization/tree/main/Code/plots/"

    %% Styles
    classDef io fill:#a2f5a2,stroke:#333,stroke-width:1px
    classDef code fill:#a2d0f5,stroke:#333,stroke-width:1px
    classDef support fill:#f5caa2,stroke:#333,stroke-width:1px
```
