A carbon-aware algorithm selection framework that extends traditional complexity analysis with energy consumption, COโ emission estimation, and the novel AGCM score.
Computer science has long relied on Big-O notation โ but it tells us nothing about sustainability.
Every component is purpose-built for sustainability-aware algorithm analysis.
Run Bubble Sort, Insertion Sort, Merge Sort, Quick Sort, Naive Fibonacci, Memoized Fibonacci, BFS, and DFS side-by-side on identical inputs.
Measures execution time with microsecond precision, CPU utilization via psutil, and memory footprint using memory_profiler.
Estimates energy consumption using E = P ร t. Configurable CPU power (W). Outputs results in millijoules (mJ).
Computes COโ using C = E ร R_c with regional intensity simulation: India (high), USA (medium), EU (low).
Computes the novel Adaptive Green Complexity Metric integrating time complexity, energy, hardware factor, and regional carbon intensity.
Automatically recommends the greenest algorithm based on AGCM scores. Explains why it's better with percentage improvement data.
Define a maximum COโ budget (e.g., 5 mg COโ). The system filters algorithms that exceed the budget and highlights compliant ones.
Interactive charts: Time vs Carbon scatter plot, AGCM bar chart, Energy comparison, and Region comparison โ powered by Chart.js.
8 algorithms across sorting, recursion, and graph traversal categories.
Simple comparison-based sort. High carbon footprint on large inputs.
Efficient on nearly-sorted data. Better real-world energy profile than Bubble.
Divide-and-conquer. Predictable and green for large datasets.
Cache-friendly in-place sort. Very low energy profile on average.
Extremely high carbon cost. Demonstrates why optimization matters.
Dynamic programming approach. Massive carbon reduction over naive version.
Level-order traversal. Memory-intensive but predictable energy usage.
Depth-first traversal. Lower memory usage than BFS in sparse graphs.
Real-world context matters. AGCM accounts for where and on what you run your code.
Clean, modular, and extendable. Every file has a single responsibility.
All algorithm implementations. Each file focuses on one category (sorting, recursion, graph).
Measures time, CPU, and memory. Returns structured ProfileResult objects.
Estimates energy consumption using E = P ร t model.
Calculates COโ with regional carbon intensity factors.
Core AGCM engine, recommendation logic, and carbon budget filtering.
Chart generation and tabular results output using matplotlib and pandas.
Get AGCM running in 4 simple steps. Compatible with Python 3.8+
git clone https://github.com/yourname/agcm-project.git
cd agcm-project
python -m venv venv
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate
pip install -r requirements.txt
# CLI mode
python main.py
# Interactive Streamlit app
streamlit run app.py
# With custom parameters
python main.py --size 1000 --region India --hardware standard