q-optimize / c3

Toolset for control, calibration and characterization of physical systems
https://c3-toolset.readthedocs.io/
Apache License 2.0
66 stars 36 forks source link

Increase evaluation number in OptimalControl #197

Closed alex-simm closed 2 years ago

alex-simm commented 2 years ago

What

Increases the evaluation index after each iteration. Currently, the number always stays at 1. I think this used to be in the code, but probably got lost somewhere.

Why

Describe what motivated this Pull Request and why this was necessary. Use closing keywords to link to the relevant Issue. Ex. Closes #666

How

Describe details of how you implemented the solution, outlining the major steps involved in adding this new feature or fixing this bug. Provide code-snippets if possible, showing example usage.

Remarks

Add notes on possible known quirks/drawbacks of this solution. If this introduces an API-breaking change, please provide an explanation on why it is necessary to break API compatibility and how users should update their notebook/script workflows once this PR is merged.

Checklist

Please include and complete the following checklist. Your Pull Request is (in most cases) not ready for review until the following have been completed. You can create a draft PR while you are still completing the checklist. Check the Contribution Guidelines for more details. You can mark an item as complete with the - [x] prefix

codecov[bot] commented 2 years ago

Codecov Report

Merging #197 (168a7b3) into dev (4a8e154) will decrease coverage by 0.01%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##              dev     #197      +/-   ##
==========================================
- Coverage   74.78%   74.77%   -0.02%     
==========================================
  Files          38       38              
  Lines        5552     5553       +1     
==========================================
  Hits         4152     4152              
- Misses       1400     1401       +1     
Impacted Files Coverage Δ
c3/optimizers/optimalcontrol.py 67.44% <0.00%> (-0.80%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4a8e154...168a7b3. Read the comment docs.

nwittler commented 2 years ago

Can you add a super simple test to check that the counter is increased correctly?

alex-simm commented 2 years ago

It does happen in both. I moved it to fct_to_min in the superclass now. Will have a look into tests.

lgtm-com[bot] commented 2 years ago

This pull request introduces 1 alert when merging d0895653629ecae19b69a3d2008a2dc257870ab1 into f7274202c017d296be052723f555faaf8820b2b3 - view on LGTM.com

new alerts:

alex-simm commented 2 years ago

The test is now added to test_two_qubits.py. I left the increment in the subclasses because it makes more sense to do it in goal_run than in fct_to_min.