This repository contains the machine learning backend for the SolarCOptimizer project, part of the Google Solution Challenge 2026.
This powerful backend provides an intelligent API to forecast energy supply/demand and generate an economically optimal power dispatch schedule for a hybrid solar and coal power park.
The project tackles the "duck curve" problem, a major challenge in modern power grids. As solar power floods the grid during the day, traditional power plants (like coal) must ramp down. However, as the sun sets, solar power vanishes, and the grid experiences a massive, rapid increase in net demand. This requires traditional plants to ramp up extremely quickly, which is inefficient, costly, and mechanically stressful.
SolarCOptimizer provides a 24-hour advance schedule to manage this transition smoothly and cost-effectively.
- Intelligent Forecasting: Utilizes two
scikit-learnmodels to predict 24-hour solar generation and grid demand with hourly granularity. - Economic Dispatch Optimization: Implements a sophisticated optimization model using Google OR-Tools to create the most cost-effective schedule for the coal plant.
- Constraint-Based Modeling: The optimizer respects real-world physical constraints, including the coal plant's minimum/maximum generation limits and its ramp-up/ramp-down rates.
- Proactive Alerts: The API output includes critical alerts, such as identifying potential energy shortages when demand exceeds the system's physical capacity.
- API-First Design: Built with FastAPI, providing a modern, high-performance, and self-documenting API for easy integration.
- Containerized & Ready for Deployment: Includes a multi-stage
Dockerfilefor building a lightweight, production-ready container.
| Component | Technology |
|---|---|
| Web Framework | FastAPI |
| ML Models | Scikit-learn, XGBoost (XGBRegressor) |
| Optimization | Google OR-Tools |
| Data Handling | Pandas, NumPy |
| Validation | Pydantic |
| Serving | Gunicorn + Uvicorn |
| Container | Docker |
- Python 3.11+
pipandvenv
-
Clone the repository:
git clone https://github.com/<your-github-username>/SolarCOptimizer.git cd SolarCOptimizer
-
Create and activate a virtual environment:
# For macOS/Linux python3 -m venv .venv source .venv/bin/activate # For Windows python -m venv .venv .venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the development server:
uvicorn app.main:app --reload
-
Access the API: The application will be running at
http://127.0.0.1:8000. -
Explore the Interactive Docs: For a full, interactive API documentation (powered by Swagger UI), navigate to: http://127.0.0.1:8000/docs
