๐ŸŽ“ Semester Research Project ยท IEEE-ready Prototype

Adaptive Green
Complexity Metric

A carbon-aware algorithm selection framework that extends traditional complexity analysis with energy consumption, COโ‚‚ emission estimation, and the novel AGCM score.

The AGCM Formula
AGCM(n, h, r) = O(f(n)) ร— Eunit ร— Hf ร— Rc
n = input size Eunit = energy per operation Hf = hardware factor Rc = regional carbon intensity
TimeO(n log n)
Energy0.24 mJ
Carbon0.12 mg COโ‚‚
AGCM Score0.037

Why Traditional Complexity Isn't Enough

Computer science has long relied on Big-O notation โ€” but it tells us nothing about sustainability.

Traditional Analysis

  • Time Complexity O(f(n))
  • Space Complexity S(f(n))
  • No energy awareness
  • No carbon footprint
  • No hardware context
  • No regional impact
  • No sustainability guidance

AGCM Framework

  • Time Complexity O(f(n))
  • Space Complexity S(f(n))
  • Energy Estimation (mJ)
  • Carbon Emission (mg COโ‚‚)
  • Hardware Efficiency Factor
  • Regional Carbon Intensity
  • Green Recommendation Engine

8 Integrated Modules

Every component is purpose-built for sustainability-aware algorithm analysis.

01

Algorithm Comparison Engine

Run Bubble Sort, Insertion Sort, Merge Sort, Quick Sort, Naive Fibonacci, Memoized Fibonacci, BFS, and DFS side-by-side on identical inputs.

SortingRecursionGraph
02

Runtime Profiler

Measures execution time with microsecond precision, CPU utilization via psutil, and memory footprint using memory_profiler.

timepsutilmemory_profiler
03

Energy Estimation Model

Estimates energy consumption using E = P ร— t. Configurable CPU power (W). Outputs results in millijoules (mJ).

E = Pร—tConfigurable
04

Carbon Emission Calculator

Computes COโ‚‚ using C = E ร— R_c with regional intensity simulation: India (high), USA (medium), EU (low).

IndiaUSAEU
05

AGCM Scoring Engine

Computes the novel Adaptive Green Complexity Metric integrating time complexity, energy, hardware factor, and regional carbon intensity.

AGCM FormulaRanking
06

Green Recommendation Engine

Automatically recommends the greenest algorithm based on AGCM scores. Explains why it's better with percentage improvement data.

SmartActionable
07

Carbon Budget Mode

Define a maximum COโ‚‚ budget (e.g., 5 mg COโ‚‚). The system filters algorithms that exceed the budget and highlights compliant ones.

Budget FilterCompliance
08

Result Visualization

Interactive charts: Time vs Carbon scatter plot, AGCM bar chart, Energy comparison, and Region comparison โ€” powered by Chart.js.

Chart.jsInteractive

What We Analyze

8 algorithms across sorting, recursion, and graph traversal categories.

Sorting

Bubble Sort

O(nยฒ) Worst

Simple comparison-based sort. High carbon footprint on large inputs.

Sorting

Insertion Sort

O(nยฒ) Average

Efficient on nearly-sorted data. Better real-world energy profile than Bubble.

Sorting

Merge Sort

O(n log n) All cases

Divide-and-conquer. Predictable and green for large datasets.

Recommended
Sorting

Quick Sort

O(n log n) Average

Cache-friendly in-place sort. Very low energy profile on average.

Recommended
Recursion

Naive Fibonacci

O(2โฟ) Exponential

Extremely high carbon cost. Demonstrates why optimization matters.

Recursion

Memoized Fibonacci

O(n) Linear

Dynamic programming approach. Massive carbon reduction over naive version.

Recommended
Graph

BFS

O(V+E) Linear

Level-order traversal. Memory-intensive but predictable energy usage.

Graph

DFS

O(V+E) Linear

Depth-first traversal. Lower memory usage than BFS in sparse graphs.

Lower Memory

Regions & Hardware Profiles

Real-world context matters. AGCM accounts for where and on what you run your code.

Regional Carbon Intensity (Rc)

RegionIntensity (gCOโ‚‚/kWh)FactorLevel
๐Ÿ‡ฎ๐Ÿ‡ณ India700 g/kWh0.700 High
๐Ÿ‡บ๐Ÿ‡ธ USA450 g/kWh0.450 Medium
๐Ÿ‡ฉ๐Ÿ‡ช Germany350 g/kWh0.350 Moderate
๐Ÿ‡ช๐Ÿ‡บ EU Avg275 g/kWh0.275 Low
๐Ÿ‡ณ๐Ÿ‡ด Norway28 g/kWh0.028 Very Low

Hardware Efficiency Factor (Hf)

Hardware ProfileTDPHfEfficiency
โšก ARM / Efficient Laptop5โ€“15W0.6 Excellent
๐Ÿ’ป Modern Laptop15โ€“25W0.8 Good
๐Ÿ–ฅ๏ธ Standard Desktop65W1.0 Baseline
๐Ÿ–ฅ๏ธ High-End Desktop125W1.3 High
๐Ÿ–ฅ๏ธ Legacy System150W+1.5 Poor

Project Folder Structure

Clean, modular, and extendable. Every file has a single responsibility.

๐Ÿ“ agcm_project/
๐Ÿ“ algorithms/
__init__.py
sorting.py
fibonacci.py
graph.py
๐Ÿ“ profiler/
__init__.py
runtime_profiler.py
๐Ÿ“ energy/
__init__.py
energy_model.py
๐Ÿ“ carbon/
__init__.py
carbon_calculator.py
regions.py
๐Ÿ“ agcm/
__init__.py
agcm_engine.py
recommender.py
budget_mode.py
๐Ÿ“ visualization/
__init__.py
charts.py
tables.py
๐Ÿ“ config/
settings.py
๐Ÿ“ tests/
test_algorithms.py
test_agcm.py
main.py
app.py (Streamlit)
requirements.txt
README.md

Module Responsibilities

algorithms/

All algorithm implementations. Each file focuses on one category (sorting, recursion, graph).

profiler/

Measures time, CPU, and memory. Returns structured ProfileResult objects.

energy/

Estimates energy consumption using E = P ร— t model.

carbon/

Calculates COโ‚‚ with regional carbon intensity factors.

agcm/

Core AGCM engine, recommendation logic, and carbon budget filtering.

visualization/

Chart generation and tabular results output using matplotlib and pandas.

Installation & Setup

Get AGCM running in 4 simple steps. Compatible with Python 3.8+

1

Clone / Download the Project

bash
git clone https://github.com/yourname/agcm-project.git
cd agcm-project
2

Create Virtual Environment

bash
python -m venv venv
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
3

Install Dependencies

bash
pip install -r requirements.txt
psutilmemory-profilermatplotlib pandasnumpystreamlittabulate
4

Run the System

bash
# CLI mode
python main.py

# Interactive Streamlit app
streamlit run app.py

# With custom parameters
python main.py --size 1000 --region India --hardware standard