entropicalabs / openqaoa

Multi-backend SDK for quantum optimisation
MIT License
113 stars 59 forks source link

Improve test_problems.py #226

Closed vishal-ph closed 1 year ago

vishal-ph commented 1 year ago

Issue Description

Describe the solution you'd like:

Create a new folder in test_problems and create scripts consisting of specific tests corresponding to that problem class. For e.g. create test_maximumcut.py and put all tests corresponding to maximum_cut.py in this file

NOTE: Please branch out of openqaoa/dev and make the PR to openqaoa/dev

jiggychauhi commented 1 year ago

Hey, this sound like something a newbie like me can do. Please assign me this issue.

devilkiller-ag commented 1 year ago

Hi, Can I work on this issue?

vishal-ph commented 1 year ago

Hello, thanks for your interest in contributing to OpenQAOA! We encourage you to collaborate on this issue, otherwise, feel free to make an attempt individually and raise a PR to openqaoa/dev branch.

devilkiller-ag commented 1 year ago

Thank you @vishal-ph, Since it's a good first issue I will like to try it alone.

devilkiller-ag commented 1 year ago

Hi @vishal-ph, can you check and confirm if I am using correct naming conventions for test files or not? Also the example 01_workflows_example.ipynb is using MaximumCut and NumberPartition both. Under which problem test file should I keep it in?

devilkiller-ag commented 1 year ago

@vishal-ph , I have moved all the tests into different files. Kindly heck my PR if it's ready for merge with dev branch or not.

devilkiller-ag commented 1 year ago

@vishal-ph any updates?

vishal-ph commented 1 year ago

@devilkiller-ag, I have added my comments on the PR itself

Newtech66 commented 1 year ago

@vishal-ph The path is tests/test_problems.py right, not src/openqaoa-core/tests/test_problems.py? So, we want it to be broken into tests/test_problems/test_*.py? (where * is a problem class)

devilkiller-ag commented 1 year ago

@vishal-ph the hyphen in folder name 'openqaoa-core' is causing an import problem. Python import statemens follows standard naming conventions, where module names shoukd consist of letters, digits and underscores only. Can I rename it to 'openqaoa_core'?

vishal-ph commented 1 year ago

@Newtech66, no, the path is correct. You will need to look at the dev branch. Note the comment at the end of issue description

vishal-ph commented 1 year ago

@devilkiller-ag, yes, you are right about the import name conventions. However, openqaoa-core is just the name of the module, the import statement still works with openqaoa. Similarly for the remaining plug-ins, they are imported with underscores in the names. For instance, openqaoa-qiskit will be imported as openqaoa_qiskit. So, please refrain from implementing any name changes

Newtech66 commented 1 year ago

@vishal-ph Ok, so all the new files should live in the same path as test_problems.py? Not a subfolder ./test_problems/ right?

vishal-ph commented 1 year ago

@Newtech66 Yes, that's correct. Although eventually, we would want to put all the problem class tests in the test_problems folder as you suggested. This would then require updating the test workflows, so that can be done later.

vishal-ph commented 1 year ago

Fixed in PR #254