C2|Q> is a modular quantum software development framework that automates the full pipeline from classical problem specifications to quantum circuit generation and execution.
This repository accompanies the article:
"C2|Q>: A Robust Framework for Bridging Classical and Quantum Software Development" Submitted to ACM Transactions on Software Engineering and Methodology (TOSEM), 2025. Preprint available on arXiv: https://arxiv.org/abs/2510.02854
- Features
- Architecture
- Modular Reuse
- Getting Started
- Running Tests
- Reproducibility
- Contributing
- License
- Contact
- Submit standard Python code describing a problem.
- Automatically parse, the problem into Quantum-Compatible Formats (QCFs).
- Select suitable quantum algorithms (e.g., QAOA, VQE, Grover).
- Recommend appropriate quantum devices across platforms (e.g., IBM, IonQ, Rigetti).
- Transpile and execute on hardware or simulators.
Refer to src/assets/workflow_editted-1.png for detailed component diagrams and workflow explanations.
For modular reuse, individual components of C2|Q> can be accessed independently:
-
Encoder Module
- Parser (
parser.py) - QCF translation logic embedded within problem functions (in the
problems/directory) - Circuit generator (
generator.py) - Transpilation layer built on existing SDK interfaces
- Parser (
-
Deployment Module
- Hardware recommender (
recommender_engine.py) - Execution interfaces provided by external quantum vendors
- Hardware recommender (
-
Decoder Module
- Result interpretation logic embedded within each problem-specific function (in the
problems/directory)
- Result interpretation logic embedded within each problem-specific function (in the
- Python 3.10+
- Git
git clone https://github.com/C2-Q/C2Q.git
cd C2Q
pip install -r requirements.txtRun the unit tests with pytest after installing the dependencies:
PYTHONPATH=. pytest -p no:warningsUse the reproducibility pipeline to run key experiments and export final artifacts.
Quick smoke run (small scale, around 4 reports):
make reproduce-smokeFull paper run (up to 434 reports, time-consuming):
make reproduce-paperWhat this pipeline does:
- Creates/updates a local virtual environment and installs dependencies.
- Runs implementation-level validation (
src/validation/implementation_validation.py). - Runs algorithmic/structural validation (
src/validation/diversity_validation.py). - Generates report artifacts via
src/tests/tests_reports.py. - Exports metadata and artifact index under
artifacts/reproduce/{smoke|paper}.
Input policy:
- Primary CSV:
src/parser/python_programs.csv - Backup CSV:
src/parser/data.csv - JSON inputs are kept under
src/c2q-dataset/inputs/json/ - Dataset archive uploaded to Zenodo: C2Q data record
Model requirement:
- The parser model is not committed to GitHub because of file size.
- Download the model from Google Drive: saved_models_2025_12
- Place it at
src/parser/saved_models_2025_12/(default path), or pass:MODEL_PATH=/path/to/saved_models_2025_12formake reproduce-*C2Q_MODEL_PATH=/path/to/saved_models_2025_12for directpytest/ script runs
Quick verification commands:
C2Q_MODEL_PATH=src/parser/saved_models_2025_12 PYTHONPATH=. pytest src/tests/test_c2q.py -p no:warnings
MODEL_PATH=src/parser/saved_models_2025_12 make reproduce-smokeIn addition to Python code snippets, C2|Q> supports a lightweight JSON-based Domain-Specific Language (DSL) that allows developers to describe quantum problem instances without writing any quantum code.
Each JSON file must contain two fields:
"problem_type": the problem class (e.g.,"maxcut","add","factor")"data": problem-specific parameters
Example — MaxCut on a 4-node graph:
{
"problem_type": "maxcut",
"data": {
"nodes": 4,
"edges": [[0, 1], [1, 2], [2, 3], [3, 0], [0, 2]]
}
}Supported problem types:
maxcutmis(Maximum Independent Set)tspcliquekcolorvc(Minimum Vertex Cover)factor(Integer Factorization)add(Integer Addition)mul(Integer Multiplication)sub(Integer Subtraction)
Sample files are available in: src/c2q-dataset/inputs/json/
To execute a JSON-defined problem instance using the full C2|Q> workflow, run:
python -m src.json_engine --input src/c2q-dataset/inputs/json/mis/mis_04.jsonThis command:
- Parses and validates the input
- Classifies the problem and extracts relevant data
- Generates a quantum circuit using the correct algorithm
- Selects the best-fit backend (simulator or hardware)
- Transpiles, executes, and generates reports
A detailed PDF report will be saved in:
./MIS_report.pdf
Each report includes:
- Problem summary and visualization
- Quantum circuit diagram
- Device recommendation and parameters
- Execution results (e.g., bitstring outcomes, optimal solution)
- Runtime, fidelity, and cost breakdown
We welcome contributions from researchers, developers, and practitioners interested in quantum software engineering.
- Fork the repository on GitHub.
- Clone your fork and install dependencies:
git clone https://github.com/YOUR_USERNAME/C2Q.git cd C2Q python -m venv venv source venv/bin/activate # On Windows use venv\Scripts\activate pip install -r requirements.txt
- Create a feature branch:
git checkout -b feature/my-feature
- Commit your changes:
git add . git commit -m "Add explanation / fix bug / implement feature"
- Push and open a pull request:
git push origin feature/my-feature
- Follow PEP8 coding conventions.
- Document public functions and modules clearly.
- Keep commits focused and descriptive.
- Be respectful in discussions and code reviews.
This project is licensed under the Apache 2.0 License.
For research collaboration or substantial contributions, contact the maintainer:
📧 arif.khan@oulu.fi (Project Principal Investigator (PI))
