Paper-69: Merlin Implementation of ObliQ - Photonic QUBO solver - #95
Paper-69: Merlin Implementation of ObliQ - Photonic QUBO solver#95ranjanaditya9061 wants to merge 26 commits into
Conversation
CassNot
left a comment
There was a problem hiding this comment.
Thank you for this work ! This is the first of its kind in this repo !
I trust you for the implementation because you are the main author of the work in the first place :)
I left some comments below and here are general comments:
Major issues:
- no
implementation.pymain entry point so runningpython implementation.py --paper ObliQ_photonic_QUBOwill fail - caution with the general layout expected for this folder
Minor issues:
- the ruff version of this repo was changed to use always the latest ones and not 0.4 only (we are 0.16 now) so the ruff fails on this repo now
- you also need to add one line in the table of the main README to describe your work and findings
There was a problem hiding this comment.
This file should go in utils/ or lib/ I believe. The only python file in the root folder is the implementation.py (which does not exist here and this breaks the semantic of the repo)
There was a problem hiding this comment.
I moved benchmark to lib/ folder. Do I need another implementation.py in the root folder? Isn't implementation.py being called at the reproduced_papers/ level.
There was a problem hiding this comment.
My mistake, it is not needed
There was a problem hiding this comment.
Pull request overview
Adds a new paper reproduction under papers/ObliQ_photonic_QUBO/ implementing the ObliQ photonic QUBO solver (MerLin/Perceval/torch) plus a Q-score benchmarking harness and baseline solvers (photonic CVaR-VQE, Qiskit QAOA, and D-Wave Ocean solvers). The folder includes runnable CLI tooling, plotting, pinned sweep configs/results, and a comprehensive unit test suite focused on reproducibility and scoring correctness.
Changes:
- Implement photonic solvers (ObliQ static/VQC/hybrid + CVaR-VQE) and baseline solvers (QAOA, SA/Tabu/QPU/hybrid) behind a common solver-dispatch API.
- Add a config-hashed benchmarking harness (
benchmark.py) and plotting tooling (plotter.py) aligned to Q-score beta/Q-score computation, plus seeded instance generation. - Add extensive tests that pin encoding/decoding, config hashing stability, reproducibility, CLI override behavior, and instance regeneration.
Reviewed changes
Copilot reviewed 61 out of 67 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| papers/ObliQ_photonic_QUBO/utils/readout.py | Shared readout utilities: Fock outcome → bitstring mapping and lazy energy table. |
| papers/ObliQ_photonic_QUBO/utils/qubo.py | QUBO conversions, problem dispatch, beta computation, normalization, and brute-force helper. |
| papers/ObliQ_photonic_QUBO/utils/max_cut.py | Max-Cut QUBO formulation, exact solve, and beta normalization. |
| papers/ObliQ_photonic_QUBO/utils/max_clique.py | Max-Clique QUBO formulation, naive baseline, exact solve, and beta normalization. |
| papers/ObliQ_photonic_QUBO/utils/graphs.py | Seed-replayable Erdos–Renyi instance generator with retry-on-edgeless behavior. |
| papers/ObliQ_photonic_QUBO/tests/test_solvers.py | End-to-end solver dispatch, scoring, and reproducibility tests for local solvers. |
| papers/ObliQ_photonic_QUBO/tests/test_seeding.py | Seed derivation and cross-process stability tests. |
| papers/ObliQ_photonic_QUBO/tests/test_qubo.py | QUBO matrix/dict correctness tests and small-instance optimality checks. |
| papers/ObliQ_photonic_QUBO/tests/test_graphs.py | Graph sampling determinism and retry behavior tests. |
| papers/ObliQ_photonic_QUBO/tests/test_encoding.py | ObliQ augmentation/encoding/decoding and readout behavior-lock tests. |
| papers/ObliQ_photonic_QUBO/tests/test_config.py | Config hashing, canonicalization, and shipped-config coverage tests. |
| papers/ObliQ_photonic_QUBO/tests/test_cli.py | CLI-schema-driven parsing and override semantics tests. |
| papers/ObliQ_photonic_QUBO/tests/conftest.py | Test sys.path setup and common fixtures. |
| papers/ObliQ_photonic_QUBO/results/d7656dd61c88/config.json | Stored config snapshot for a QAOA max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/results/a29bcaa44236/config.json | Stored config snapshot for a tabu max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/results/973001a93134/config.json | Stored config snapshot for an ObliQ static max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/results/80fbf13e256a/config.json | Stored config snapshot for a photonic CVaR-VQE max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/results/6df457c14c8f/config.json | Stored config snapshot for SA max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/results/2f9a63e4529a/config.json | Stored config snapshot for ObliQ hybrid max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/results/2cdd563cfee8/config.json | Stored config snapshot for ObliQ VQC max-clique sweep hash. |
| papers/ObliQ_photonic_QUBO/requirements.txt | Paper-local dependency set spanning MerLin/perceval/torch, Qiskit, and D-Wave Ocean. |
| papers/ObliQ_photonic_QUBO/README.md | Full paper README: method summary, run instructions, config schema, results, and reproducibility notes. |
| papers/ObliQ_photonic_QUBO/pytest.ini | Paper-local pytest configuration. |
| papers/ObliQ_photonic_QUBO/plotter.py | Plotting tool for beta/time curves with exact/asymptotic beta modes and Q-score computation. |
| papers/ObliQ_photonic_QUBO/models/solver.py | Central solver dispatch with capability sets and seeding behavior. |
| papers/ObliQ_photonic_QUBO/models/qaoa.py | Qiskit-based QAOA baseline with reproducible local sampling and optional hardware backends. |
| papers/ObliQ_photonic_QUBO/models/obliq.py | ObliQ solver implementation: augmentation, encoding, decoding, and training (Adam/SGD/COBYLA). |
| papers/ObliQ_photonic_QUBO/models/dwave.py | D-Wave Ocean and Leap solvers: SA/Tabu/QPU/hybrid with timeout/seeding handling. |
| papers/ObliQ_photonic_QUBO/models/cvar_vqe.py | Photonic CVaR-VQE baseline using MerLin with autograd and COBYLA training options. |
| papers/ObliQ_photonic_QUBO/models/circuits.py | MerLin/Perceval circuit construction, coefficient management, and local/remote execution. |
| papers/ObliQ_photonic_QUBO/models/backend.py | Quandela token resolution helper. |
| papers/ObliQ_photonic_QUBO/LICENSE | Apache 2.0 license file for this paper folder. |
| papers/ObliQ_photonic_QUBO/lib/timeout.py | Out-of-process timeout enforcement utility. |
| papers/ObliQ_photonic_QUBO/lib/seeding.py | Deterministic seed derivation and global RNG seeding helper. |
| papers/ObliQ_photonic_QUBO/lib/config.py | Config loading, CLI overrides, canonicalization, and content hashing for results addressing. |
| papers/ObliQ_photonic_QUBO/configs/*.json | Sweep/run configuration set covering solver/problem combinations and comparable hyperparameters. |
| papers/ObliQ_photonic_QUBO/cli.json | CLI schema used to generate the benchmark subcommands and overrides. |
| papers/ObliQ_photonic_QUBO/benchmark.py | Benchmark runner for single instances and sweeps with config-hashed outputs. |
| papers/ObliQ_photonic_QUBO/.gitignore | Paper-local ignore rules (incl. token file). |
Suppressed comments (1)
papers/ObliQ_photonic_QUBO/models/solver.py:132
run_obliq_solveris called withbackend=backendwhilesolver_optionsare expanded as**options. If a user suppliesbackendinsidesolver_options(the README lists it as an accepted ObliQ option), this will raiseTypeError: got multiple values for keyword argument 'backend'. Prefer mergingbackendintooptionswithsetdefaultand passingbackendonly once.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…across platforms Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…r implementation.py; Moved benchmark to lib/ and plotter to utils/; Updated the readme and cli
…enabling Adam based training, and added an overall conclusion
…ntribute to the probability
CassNot
left a comment
There was a problem hiding this comment.
Just a fix on the tests and it should be good !
Implements the ObliQ and CVaR-VQE algorithm using MerLin 0.4. Utilizes both gradient-based and gradient-free optimization routines with support for hardware evaluation.
Compares against baselines such as QAOA and Annealing using beta values and Q-score (https://ieeexplore.ieee.org/document/9860191). Benchmarks over 100 max-clique problems varying from size 2 to 10. Also includes a direct caller that works on user-defined graph input and optimizes using ObliQ.