Skip to content

Paper-69: Merlin Implementation of ObliQ - Photonic QUBO solver - #95

Open
ranjanaditya9061 wants to merge 26 commits into
merlinquantum:mainfrom
ranjanaditya9061:obliq_code
Open

Paper-69: Merlin Implementation of ObliQ - Photonic QUBO solver#95
ranjanaditya9061 wants to merge 26 commits into
merlinquantum:mainfrom
ranjanaditya9061:obliq_code

Conversation

@ranjanaditya9061

Copy link
Copy Markdown

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.

@ranjanaditya9061
ranjanaditya9061 requested a review from CassNot July 29, 2026 15:29
@ranjanaditya9061 ranjanaditya9061 self-assigned this Jul 29, 2026
@CassNot CassNot self-assigned this Jul 31, 2026
@CassNot CassNot added the new-paper New paper reproduced label Aug 4, 2026

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image 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.py main entry point so running python implementation.py --paper ObliQ_photonic_QUBO will 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

Comment thread papers/ObliQ_photonic_QUBO/LICENSE Outdated
Comment thread papers/ObliQ_photonic_QUBO/utils/plotter.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, it is not needed

Comment thread papers/ObliQ_photonic_QUBO/README.md Outdated
Comment thread papers/ObliQ_photonic_QUBO/requirements.txt Outdated
Comment thread papers/ObliQ_photonic_QUBO/results/2cdd563cfee8/config.json
Comment thread papers/ObliQ_photonic_QUBO/notebook.ipynb
Comment thread papers/ObliQ_photonic_QUBO/notebook.ipynb Outdated
Comment thread papers/ObliQ_photonic_QUBO/notebook.ipynb
Comment thread papers/ObliQ_photonic_QUBO/models/circuits.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_solver is called with backend=backend while solver_options are expanded as **options. If a user supplies backend inside solver_options (the README lists it as an accepted ObliQ option), this will raise TypeError: got multiple values for keyword argument 'backend'. Prefer merging backend into options with setdefault and passing backend only once.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread papers/ObliQ_photonic_QUBO/benchmark.py Outdated
Comment thread papers/ObliQ_photonic_QUBO/models/solver.py
Comment thread papers/ObliQ_photonic_QUBO/README.md Outdated

@CassNot CassNot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a fix on the tests and it should be good !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-paper New paper reproduced

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants