Skip to content

Latest commit

 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firefly Solver

An original LP/MILP/QP optimization solver core built from mathematical first principles, GPU-accelerated via CUDA, for SIH 2026 PS 26119.

View the Firefly Landing Page Repository


Architecture

Firefly operates in a decoupled, three-tier architecture with a strict linear solve pipeline:

flowchart LR
    A[Parser] --> B[Presolve]
    B --> C[LP Core]
    C --> D[MILP Engine]
    D --> E[Output]

    classDef stage fill:#1B1D18,stroke:#33362E,color:#E8E6DE
    class A,B,C,D,E stage
Loading
  1. Parser: Reads MPS/LP file format. Validates structure, extracts objective coefficients, constraint matrix (CSR), RHS, and variable bounds.
  2. Presolve: Eliminates redundant rows and fixed variables, tightens bounds, and rescales the constraint matrix before dispatch.
  3. LP Core: GPU-native PDLP (primal–dual first-order) for large-scale continuous relaxations; CPU Simplex fallback for small dense instances.
  4. MILP Engine: Branch-and-bound over the LP core. Integer feasibility enforced per node; best-bound pruning limits the search tree.
  5. Output: Primal solution vector, objective value, status code, iteration count, and wall-clock time returned to API and UI.

Platform Support

GPU acceleration requires Windows or Linux with a compatible NVIDIA GPU. macOS has never supported CUDA (Apple dropped it years ago; Apple Silicon has no NVIDIA hardware at all), so Firefly always runs via the CPU fallback path on macOS — the same path already built and tested with WITH_CUDA=OFF. This is a real hardware limitation, not a bug, and the existing landing page copy ("automatically uses your GPU if available, falls back to CPU otherwise") is already accurate for macOS without needing a separate disclaimer.


Installation

Quick Install (Windows)

To install the standalone CLI , run this in PowerShell:

irm https://bit.ly/install-firefly | iex

Warning

Windows Defender False Positive Firefly is compiled into a single, high-performance executable using PyInstaller. Because it extracts its optimization libraries into a temporary folder at runtime, Windows Defender may occasionally flag it as a false positive (e.g. Wacatac.B!ml). This is a known issue with PyInstaller. If this happens, please click "More Info" -> "Run Anyway", or add firefly.exe to your Defender exclusions.


Build from Source

Core (C++20 & CUDA)

Requires CMake 3.25+ and NVIDIA CUDA Toolkit 12.0+ (target sm_89).

mkdir core/build && cd core/build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release

To run the test suite:

cd core/build
ctest -C Release --output-on-failure

API (Python FastAPI)

A translation layer bridging programmatic requests to the C++ core via pybind11. Requires Python 3.10+.

# Compile and install the core Python bindings
pip install -e core --no-build-isolation

# Install API requirements
pip install -r api/requirements.txt

# Start the FastAPI server
uvicorn api.main:app --host 0.0.0.0 --port 8000

Note on Windows: Ensure CUDA_PATH is set and its bin\x64 directory is accessible for DLL linking.

Web (React & TypeScript)

A telemetry interface engineered with a scientific instrumentation aesthetic (to be packaged as a Tauri desktop app).

cd web
npm install
npm run dev

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

An original, from-scratch optimization solver (LP/MILP, with QP soon) running on CUDA GPUs, built for SIH 2026 (no Gurobi allowed!).

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages