Skip to content

Fix initial_ctrl! not applying controls to population - #141

Merged
LiuJPhys merged 1 commit into
QuanEstimation:mainfrom
S02-xc:fix-de-control-init
Dec 18, 2025
Merged

LiuJPhys merged 1 commit into
QuanEstimation:mainfrom
S02-xc:fix-de-control-init

Conversation

@S02-xc

@S02-xc S02-xc commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Summary

Fix initial_ctrl! for DE control optimization so that the initial controls from ini_population are actually applied to each individual in the population.

Details

Previously initial_ctrl! only updated the local all_ctrl array and never wrote back to the Scheme objects, so all individuals kept the same opt.ctrl. I added a final loop:

for i = 1:p_num
    param_data(scheme[i]).ctrl = all_ctrl[i]
end

### Summary

Fix `initial_ctrl!` for DE control optimization so that the initial controls from `ini_population` are actually applied to each individual in the population.

### Details

Previously `initial_ctrl!` only updated the local `all_ctrl` array and never wrote back to the `Scheme` objects, so all individuals kept the same `opt.ctrl`. I added a final loop:

```julia
for i = 1:p_num
    param_data(scheme[i]).ctrl = all_ctrl[i]
end
@LiuJPhys
LiuJPhys merged commit b8c5011 into QuanEstimation:main Dec 18, 2025
3 of 4 checks passed
@codecov

codecov Bot commented Dec 18, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.54%. Comparing base (7672dd7) to head (c16f905).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #141      +/-   ##
==========================================
+ Coverage   77.40%   77.54%   +0.14%     
==========================================
  Files          41       41              
  Lines        5204     5207       +3     
==========================================
+ Hits         4028     4038      +10     
+ Misses       1176     1169       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants