# umar-abdullah-pro/ml-assisted-floorplanning architecture

> Architecture diagram of the GitHub repository umar-abdullah-pro/ml-assisted-floorplanning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/umar-abdullah-pro/ml-assisted-floorplanning
- Repository: https://github.com/umar-abdullah-pro/ml-assisted-floorplanning

## Overview

This is a Streamlit application for fixed-outline VLSI floorplanning, combining sequence-pair placement search, slack-driven block shaping, and a Q-learning step-size controller. The main workflow is: choose or supply a design and outline, search candidate placements, translate each sequence pair into constraint graphs, evaluate and shape the layout, then inspect legality, dimensions, HPWL, and visualizations. Full SDS adds optimality checks and a convex fallback. README capabilities and indexed references establish several subsystem links; unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/app.py) (Streamlit app), [`q_learning/placement_search.py`](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/placement_search.py) (Placement optimizer), [`sds/full_sds.py`](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/full_sds.py) (Full SDS), [`sds/basic_sds.py`](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/basic_sds.py) (Basic SDS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Input and interface"]
  node_app["Streamlit app<br/>[app.py]"]
  node_custom_input["Custom design input<br/>[custom_input.py]"]
  node_mcnc["MCNC benchmarks<br/>[mcnc_benchmarks.py]"]
  node_synthetic["Synthetic benchmarks"]
  node_figure2["Figure 2 example<br/>[figure2_example.py]"]
end

subgraph group_search["Placement search"]
  node_optimizer["Placement optimizer"]
  node_q_controller["Q-learning controller<br/>[q_controller.py]"]
  node_sequence_pair["Sequence-pair conversion<br/>[sequence_pair.py]"]
end

subgraph group_sds["Shaping engine"]
  node_block["Block model<br/>[block.py]"]
  node_constraint_graph["Constraint graphs"]
  node_basic_sds["Basic SDS<br/>[basic_sds.py]"]
  node_full_sds["Full SDS<br/>[full_sds.py]"]
  node_optimality["Optimality checks<br/>[optimality.py]"]
  node_convex["Convex fallback<br/>[convex_solver.py]"]
  node_sds_api["SDS API<br/>[api.py]"]
end

subgraph group_evaluation["Evaluation and results"]
  node_experiment["Mode comparison"]
  node_visualizer["Layout visualizer<br/>[visualizer.py]"]
  node_results["Layout and metrics"]
end

node_user(("Designer"))

node_user -->|"configures"| node_app
node_app -->|"loads design"| node_custom_input
node_app -->|"selects benchmark"| node_mcnc
node_app -->|"selects benchmark"| node_synthetic
node_app -->|"selects example"| node_figure2
node_app -->|"runs comparison"| node_experiment
node_app -->|"starts search"| node_optimizer
node_experiment -->|"runs modes"| node_optimizer
node_optimizer -->|"builds constraints"| node_sequence_pair
node_sequence_pair -->|"creates graphs"| node_constraint_graph
node_optimizer -->|"dispatches shaping"| node_basic_sds
node_optimizer -->|"dispatches shaping"| node_full_sds
node_optimizer -->|"selects step size"| node_q_controller
node_basic_sds -->|"packs and allocates slack"| node_constraint_graph
node_basic_sds -->|"updates dimensions"| node_block
node_full_sds -->|"runs first"| node_basic_sds
node_full_sds -->|"checks conditions"| node_optimality
node_full_sds -->|"solves fallback"| node_convex
node_optimality -->|"analyzes critical paths"| node_constraint_graph
node_convex -->|"constrains solution"| node_constraint_graph
node_convex -->|"reads block bounds"| node_block
node_app -.->|"exposes shaping API"| node_sds_api
node_app -->|"renders layouts"| node_visualizer
node_optimizer -->|"returns metrics"| node_results
node_app -->|"displays results"| node_results
node_visualizer -->|"draws blocks"| node_block

click node_app "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/app.py"
click node_custom_input "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/custom_input.py"
click node_mcnc "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/benchmarks/mcnc_benchmarks.py"
click node_synthetic "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/benchmarks/synthetic_benchmarks.py"
click node_figure2 "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/benchmarks/figure2_example.py"
click node_block "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/block.py"
click node_optimizer "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/placement_search.py"
click node_experiment "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/experiment_runner.py"
click node_q_controller "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/q_controller.py"
click node_sequence_pair "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/sequence_pair.py"
click node_constraint_graph "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/constraint_graph.py"
click node_basic_sds "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/basic_sds.py"
click node_full_sds "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/full_sds.py"
click node_optimality "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/optimality.py"
click node_convex "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/convex_solver.py"
click node_sds_api "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/api.py"
click node_visualizer "https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/visualizer.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_app,node_custom_input,node_mcnc,node_synthetic,node_figure2 toneBlue
class node_optimizer,node_q_controller,node_sequence_pair toneAmber
class node_block,node_constraint_graph,node_basic_sds,node_full_sds,node_optimality,node_convex,node_sds_api toneMint
class node_experiment,node_visualizer,node_results toneRose
class node_user toneIndigo
```

## Components

### Input and interface

- [Streamlit app](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/app.py): `app.py`
- [Custom design input](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/custom_input.py): `sds/custom_input.py`
- [MCNC benchmarks](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/benchmarks/mcnc_benchmarks.py): `benchmarks/mcnc_benchmarks.py`
- [Synthetic benchmarks](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/benchmarks/synthetic_benchmarks.py): `benchmarks/synthetic_benchmarks.py`
- [Figure 2 example](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/benchmarks/figure2_example.py): `benchmarks/figure2_example.py`

### Placement search

- [Placement optimizer](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/placement_search.py): `q_learning/placement_search.py`
- [Q-learning controller](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/q_controller.py): `q_learning/q_controller.py`
- [Sequence-pair conversion](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/sequence_pair.py): `sds/sequence_pair.py`

### Shaping engine

- [Block model](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/block.py): `sds/block.py`
- [Constraint graphs](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/constraint_graph.py): `sds/constraint_graph.py`
- [Basic SDS](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/basic_sds.py): `sds/basic_sds.py`
- [Full SDS](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/full_sds.py): `sds/full_sds.py`
- [Optimality checks](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/optimality.py): `sds/optimality.py`
- [Convex fallback](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/convex_solver.py): `sds/convex_solver.py`
- [SDS API](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/api.py): `sds/api.py`

### Evaluation and results

- [Mode comparison](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/q_learning/experiment_runner.py): `q_learning/experiment_runner.py`
- [Layout visualizer](https://github.com/umar-abdullah-pro/ml-assisted-floorplanning/blob/main/sds/visualizer.py): `sds/visualizer.py`
- **Layout and metrics**

### Other components

- **Designer**

## Connections

- Designer → Streamlit app: configures (evidence: `app.py`)
- Streamlit app → Custom design input: loads design (evidence: `app.py`)
- Streamlit app → MCNC benchmarks: selects benchmark (evidence: `app.py`)
- Streamlit app → Synthetic benchmarks: selects benchmark (evidence: `app.py`)
- Streamlit app → Figure 2 example: selects example (evidence: `app.py`)
- Streamlit app → Mode comparison: runs comparison (evidence: `app.py`)
- Streamlit app → Placement optimizer: starts search (evidence: `app.py`)
- Mode comparison → Placement optimizer: runs modes (evidence: `q_learning/experiment_runner.py`)
- Placement optimizer → Sequence-pair conversion: builds constraints (evidence: `q_learning/placement_search.py`)
- Sequence-pair conversion → Constraint graphs: creates graphs (evidence: `sds/sequence_pair.py`)
- Placement optimizer → Basic SDS: dispatches shaping (evidence: `q_learning/placement_search.py`)
- Placement optimizer → Full SDS: dispatches shaping (evidence: `q_learning/placement_search.py`)
- Placement optimizer → Q-learning controller: selects step size (evidence: `q_learning/placement_search.py`)
- Basic SDS → Constraint graphs: packs and allocates slack (evidence: `sds/basic_sds.py`)
- Basic SDS → Block model: updates dimensions (evidence: `sds/basic_sds.py`)
- Full SDS → Basic SDS: runs first (evidence: `sds/full_sds.py`)
- Full SDS → Optimality checks: checks conditions (evidence: `sds/full_sds.py`)
- Full SDS → Convex fallback: solves fallback (evidence: `sds/full_sds.py`)
- Optimality checks → Constraint graphs: analyzes critical paths (evidence: `sds/optimality.py`)
- Convex fallback → Constraint graphs: constrains solution (evidence: `sds/convex_solver.py`)
- Convex fallback → Block model: reads block bounds (evidence: `sds/convex_solver.py`)
- Streamlit app → SDS API: exposes shaping API
- Streamlit app → Layout visualizer: renders layouts (evidence: `app.py`)
- Placement optimizer → Layout and metrics: returns metrics (evidence: `q_learning/placement_search.py`)
- Streamlit app → Layout and metrics: displays results (evidence: `app.py`)
- Layout visualizer → Block model: draws blocks (evidence: `sds/visualizer.py`)
