entropicalabs / openqaoa

Multi-backend SDK for quantum optimisation
MIT License
116 stars 58 forks source link

Bugfix vanishing instances after elimination #158

Closed kidiki closed 1 year ago

kidiki commented 1 year ago

Description

Summary: Solving and RQAOA bug when vanishing problems. Context: unweighted graphs have a lot of edge cases when reduced during the RQAOA algorithm. Bug description: Approach to fixing: check if the new problem is an empty dictionary, which would mean that a total elimination happened. If so, set the new problem to the old one and break the optimization cycle. Hence, solving for the smallest non-vanishing instance or equivalently, increasing the cutoff.

Note: this might cause a potential problem if the smallest non-vanishing instance is too big to be solved classically. TODO

Checklist

Type of change

Please delete options that are not relevant.

codecov[bot] commented 1 year ago

Codecov Report

Merging #158 (a513760) into dev (13f8f4d) will increase coverage by 0.28%. The diff coverage is 97.76%.

@@            Coverage Diff             @@
##              dev     #158      +/-   ##
==========================================
+ Coverage   81.70%   81.98%   +0.28%     
==========================================
  Files          95       95              
  Lines       11794    11994     +200     
==========================================
+ Hits         9636     9833     +197     
- Misses       2158     2161       +3     
Impacted Files Coverage Δ
openqaoa/rqaoa/rqaoa.py 96.95% <92.15%> (+0.42%) :arrow_up:
openqaoa/workflows/optimizer.py 93.81% <96.20%> (-0.26%) :arrow_down:
openqaoa/problems/problem.py 98.16% <96.29%> (+0.28%) :arrow_up:
openqaoa/optimizers/result.py 92.85% <100.00%> (-0.78%) :arrow_down:
openqaoa/rqaoa/rqaoa_results.py 100.00% <100.00%> (ø)
tests/test_problems.py 99.16% <100.00%> (+0.04%) :arrow_up:
tests/test_rqaoa.py 100.00% <100.00%> (ø)
tests/test_workflows.py 99.84% <100.00%> (+0.01%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

kidiki commented 1 year ago

"Spiders are the only web developers that enjoy finding bugs." + Kristina ;) :D

kidiki commented 1 year ago

Note that this bug occurs for 27 out of 1100 random instances for unweighted graphs with p=0.7 probability for an edge.