# amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi architecture

> Architecture diagram of the GitHub repository amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi
- Repository: https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi

## Overview

#### Purpose and execution entry points
This repository is a Python simulation/optimization codebase for communication, computation, caching, offloading, beamforming, and RIS resource allocation. It contains a baseline implementation at the repository root and an SCA-FP variant under `SCA-FP/`.

Primary run entry points are:
- Baseline experiment driver: `main.py`
- SCA/fractional-programming experiment driver: `SCA-FP/main.py`
- Result regeneration/plotting drivers: `replot.py`, `SCA-FP/replot.py`
- Specialized diagnostic and regime studies: `SCA-FP/diagnose_ao.py`, `SCA-FP/find_regime.py`, `SCA-FP/worst_case_sweep.py`

#### Shared system model and metrics
The physical/network model is separated from optimization stages:
- Channel generation and propagation inputs: `channels.py`, `SCA-FP/channels.py`
- Communication-rate evaluation: `rate.py`, `SCA-FP/rate.py`
- End-to-end latency evaluation: `latency.py`, `SCA-FP/latency.py`
- Central simulation parameters and scenario dimensions: `config.py`, `SCA-FP/config.py`

These modules form the numerical boundary between scenario definition/model evaluation and decision optimization. Optimizers consume channel/state data and produce allocations whose feasibility and objective values are evaluated through rate and latency calculations.

#### Alternating-optimization orchestration
The top-level solver coordinates coupled decision blocks using alternating optimization (AO):
- Baseline coordinator: `ao_solver.py`
- SCA-FP coordinator: `SCA-FP/ao_solver.py`
- Baseline executable workflow: `main.py`
- SCA-FP executable workflow: `SCA-FP/main.py`

Control flow is expected to initialize a scenario, iteratively optimize one block while holding others fixed, recompute rate/latency/objective metrics, test convergence, and serialize figure-oriented outputs. The SCA-FP branch adds successive-convex-approximation/fractional-programming treatment around this same block-decomposed structure.

#### Optimization subproblems
Five subproblem modules define the architecture’s principal decision boundaries:
- Beamforming: `sp1_beamforming.py`, `SCA-FP/sp1_beamforming.py`
- Caching: `sp2_caching.py`, `SCA-FP/sp2_caching.py`
- Task offloading: `sp3_offloading.py`, `SCA-FP/sp3_offloading.py`
- Joint communication/computation allocation: `sp4_commcomp.py`, `SCA-FP/sp4_commcomp.py`
- RIS configuration: `sp5_ris.py`, `SCA-FP/sp5_ris.py`

The AO solver is the owner of cross-subproblem state and iteration order; individual `sp*` modules should remain responsible for their local optimization formulation and returned decision variables.

#### Experiment, analysis, and result boundary
Experiments write precomputed CSV and JSON datasets rather than serving results through an application API. Baseline artifacts are in `baseline_result/`, including `baseline_result/fig2_convergence.json` and parameter sweeps such as `baseline_result/fig3_vs_N.csv`.

The SCA-FP workflow stores analogous studies in `SCA-FP/scafp_result/`, with alternate seed-count and fix variants in `SCA-FP/scafp_result_20seeds/`, `SCA-FP/scafp_result_1000seeds/`, and `SCA-FP/scafp_result_1000seeds_hrbfix/`. This establishes file-based output as the boundary between optimization runs and visualization.

#### Visualization and runtime/infrastructure
Plot production is isolated in `plots.py` and `SCA-FP/plots.py`; replot scripts consume persisted experiment outputs without necessarily rerunning optimization. The repository is a local Python numerical research workflow with no indicated web service, database, cloud infrastructure, or external API integration. Its material runtime dependencies are implied numerical/optimization and plotting libraries, but dependency manifests are not present in the supplied tree.

Main entry points: [`ao_solver.py`](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/ao_solver.py) (AO coordinator), [`SCA-FP/ao_solver.py`](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/ao_solver.py) (SCA-FP AO coordinator), [`main.py`](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/main.py) (Experiment driver), [`SCA-FP/main.py`](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/main.py) (Experiment driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_baseline["Baseline workflow"]
  node_base_main["Experiment driver<br/>Python entry point<br/>[main.py]"]
  node_base_model["System model<br/>scenario and metrics"]
  node_base_ao{{"AO coordinator<br/>iterative solver<br/>[ao_solver.py]"}}
  node_base_beam["Beamforming<br/>optimization block<br/>[sp1_beamforming.py]"]
  node_base_cache["Caching<br/>optimization block<br/>[sp2_caching.py]"]
  node_base_offload["Task offloading<br/>optimization block<br/>[sp3_offloading.py]"]
  node_base_commcomp["Comm/compute allocation<br/>optimization block<br/>[sp4_commcomp.py]"]
  node_base_ris["RIS configuration<br/>optimization block<br/>[sp5_ris.py]"]
  node_base_plots["Plot production<br/>visualization<br/>[plots.py]"]
end

subgraph group_scafp["SCA-FP workflow"]
  node_scafp_main["Experiment driver<br/>Python entry point<br/>[main.py]"]
  node_scafp_model["System model<br/>scenario and metrics"]
  node_scafp_ao{{"SCA-FP AO coordinator<br/>iterative solver<br/>[ao_solver.py]"}}
  node_scafp_beam["Beamforming<br/>optimization block<br/>[sp1_beamforming.py]"]
  node_scafp_cache["Caching<br/>optimization block<br/>[sp2_caching.py]"]
  node_scafp_offload["Task offloading<br/>optimization block<br/>[sp3_offloading.py]"]
  node_scafp_commcomp["Comm/compute allocation<br/>optimization block<br/>[sp4_commcomp.py]"]
  node_scafp_ris["RIS configuration<br/>optimization block<br/>[sp5_ris.py]"]
  node_scafp_plots["Plot production<br/>visualization<br/>[plots.py]"]
end

subgraph group_results["Persisted results"]
  node_baseline_results[("Baseline datasets<br/>CSV and JSON outputs")]
  node_scafp_results[("SCA-FP datasets<br/>CSV and JSON outputs")]
end

node_base_main -->|"runs"| node_base_ao
node_base_model -->|"scenario and metrics"| node_base_ao
node_base_ao -->|"optimizes"| node_base_beam
node_base_ao -->|"optimizes"| node_base_cache
node_base_ao -->|"optimizes"| node_base_offload
node_base_ao -->|"optimizes"| node_base_commcomp
node_base_ao -->|"optimizes"| node_base_ris
node_base_ao -->|"serializes"| node_baseline_results
node_baseline_results -->|"replot input"| node_base_plots
node_scafp_main -->|"runs"| node_scafp_ao
node_scafp_model -->|"scenario and metrics"| node_scafp_ao
node_scafp_ao -->|"optimizes"| node_scafp_beam
node_scafp_ao -->|"optimizes"| node_scafp_cache
node_scafp_ao -->|"optimizes"| node_scafp_offload
node_scafp_ao -->|"optimizes"| node_scafp_commcomp
node_scafp_ao -->|"optimizes"| node_scafp_ris
node_scafp_ao -->|"serializes"| node_scafp_results
node_scafp_results -->|"replot input"| node_scafp_plots

click node_base_main "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/main.py"
click node_base_ao "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/ao_solver.py"
click node_base_beam "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp1_beamforming.py"
click node_base_cache "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp2_caching.py"
click node_base_offload "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp3_offloading.py"
click node_base_commcomp "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp4_commcomp.py"
click node_base_ris "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp5_ris.py"
click node_base_plots "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/plots.py"
click node_scafp_main "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/main.py"
click node_scafp_ao "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/ao_solver.py"
click node_scafp_beam "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp1_beamforming.py"
click node_scafp_cache "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp2_caching.py"
click node_scafp_offload "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp3_offloading.py"
click node_scafp_commcomp "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp4_commcomp.py"
click node_scafp_ris "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp5_ris.py"
click node_scafp_plots "https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/plots.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_base_main,node_base_model,node_base_ao,node_base_beam,node_base_cache,node_base_offload,node_base_commcomp,node_base_ris,node_base_plots toneBlue
class node_scafp_main,node_scafp_model,node_scafp_ao,node_scafp_beam,node_scafp_cache,node_scafp_offload,node_scafp_commcomp,node_scafp_ris,node_scafp_plots toneAmber
class node_baseline_results,node_scafp_results toneMint
```

## Components

### Baseline workflow

- [Experiment driver](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/main.py): Python entry point · `main.py`
- **System model**: scenario and metrics · Configuration, channels, rate, and latency evaluation.
- [AO coordinator](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/ao_solver.py): iterative solver · Owns coupled state, block order, convergence, and objective evaluation. · `ao_solver.py`
- [Beamforming](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp1_beamforming.py): optimization block · `sp1_beamforming.py`
- [Caching](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp2_caching.py): optimization block · `sp2_caching.py`
- [Task offloading](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp3_offloading.py): optimization block · `sp3_offloading.py`
- [Comm/compute allocation](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp4_commcomp.py): optimization block · `sp4_commcomp.py`
- [RIS configuration](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/sp5_ris.py): optimization block · `sp5_ris.py`
- [Plot production](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/plots.py): visualization · `plots.py`

### SCA-FP workflow

Successive-convex-approximation and fractional-programming variant.

- [Experiment driver](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/main.py): Python entry point · `SCA-FP/main.py`
- **System model**: scenario and metrics · Configuration, channels, rate, and latency evaluation.
- [SCA-FP AO coordinator](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/ao_solver.py): iterative solver · Coordinates block updates with SCA and fractional-programming treatment. · `SCA-FP/ao_solver.py`
- [Beamforming](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp1_beamforming.py): optimization block · `SCA-FP/sp1_beamforming.py`
- [Caching](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp2_caching.py): optimization block · `SCA-FP/sp2_caching.py`
- [Task offloading](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp3_offloading.py): optimization block · `SCA-FP/sp3_offloading.py`
- [Comm/compute allocation](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp4_commcomp.py): optimization block · `SCA-FP/sp4_commcomp.py`
- [RIS configuration](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/sp5_ris.py): optimization block · `SCA-FP/sp5_ris.py`
- [Plot production](https://github.com/amuthavanmoorthi/iot-ris-bs-ao-with-imperfect-csi/blob/main/SCA-FP/plots.py): visualization · `SCA-FP/plots.py`

### Persisted results

File-based boundary between experiments and visualization.

- **Baseline datasets**: CSV and JSON outputs · Figure-oriented convergence and parameter-sweep data.
- **SCA-FP datasets**: CSV and JSON outputs · Includes standard, seed-count, and fixed-variant studies.

## Connections

- Experiment driver → AO coordinator: runs
- System model → AO coordinator: scenario and metrics
- AO coordinator → Beamforming: optimizes
- AO coordinator → Caching: optimizes
- AO coordinator → Task offloading: optimizes
- AO coordinator → Comm/compute allocation: optimizes
- AO coordinator → RIS configuration: optimizes
- AO coordinator → Baseline datasets: serializes
- Baseline datasets → Plot production: replot input
- Experiment driver → SCA-FP AO coordinator: runs
- System model → SCA-FP AO coordinator: scenario and metrics
- SCA-FP AO coordinator → Beamforming: optimizes
- SCA-FP AO coordinator → Caching: optimizes
- SCA-FP AO coordinator → Task offloading: optimizes
- SCA-FP AO coordinator → Comm/compute allocation: optimizes
- SCA-FP AO coordinator → RIS configuration: optimizes
- SCA-FP AO coordinator → SCA-FP datasets: serializes
- SCA-FP datasets → Plot production: replot input
