Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix vanishing instances after elimination #158

Merged
merged 18 commits into from
Jan 18, 2023

Conversation

kidiki
Copy link
Contributor

@kidiki kidiki commented Dec 27, 2022

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

  • I have performed a self-review of my code.
  • I have commented my code and used numpy-style docstrings
  • I have made corresponding updates to the documentation.
  • My changes generate no new warnings
  • I have added/updated tests to make sure bugfix/feature works.
  • New and existing unit tests pass locally with my changes.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Write unit tests for the specific instances which were failing previously.

…k the rqaoa cycle and solve for a the smallest non-vanishing instance.
@codecov
Copy link

codecov bot commented Dec 27, 2022

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%) ⬆️
openqaoa/workflows/optimizer.py 93.81% <96.20%> (-0.26%) ⬇️
openqaoa/problems/problem.py 98.16% <96.29%> (+0.28%) ⬆️
openqaoa/optimizers/result.py 92.85% <100.00%> (-0.78%) ⬇️
openqaoa/rqaoa/rqaoa_results.py 100.00% <100.00%> (ø)
tests/test_problems.py 99.16% <100.00%> (+0.04%) ⬆️
tests/test_rqaoa.py 100.00% <100.00%> (ø)
tests/test_workflows.py 99.84% <100.00%> (+0.01%) ⬆️

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

@kidiki
Copy link
Contributor Author

kidiki commented Dec 27, 2022

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

@kidiki kidiki changed the title checking if the new problem is an empty dictionary and if it is, brea… Bugfix vanishing instances after elimination Dec 27, 2022
@kidiki
Copy link
Contributor Author

kidiki commented Dec 27, 2022

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

openqaoa/workflows/optimizer.py Outdated Show resolved Hide resolved
openqaoa/workflows/optimizer.py Show resolved Hide resolved
@Q-lds Q-lds added the bug Something isn't working label Jan 4, 2023
openqaoa/rqaoa/rqaoa.py Outdated Show resolved Hide resolved
@vishal-ph vishal-ph merged commit 6edae89 into dev Jan 18, 2023
@vishal-ph vishal-ph deleted the dev-bugfix-rqaoa-total-elimination branch January 18, 2023 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants