Skip to content

Remove high relative tolerance on VMCON QPP#3964

Merged
timothy-nunn merged 2 commits intomainfrom
remove-qpp-tolerance
Nov 4, 2025
Merged

Remove high relative tolerance on VMCON QPP#3964
timothy-nunn merged 2 commits intomainfrom
remove-qpp-tolerance

Conversation

@timothy-nunn
Copy link
Copy Markdown
Collaborator

@timothy-nunn timothy-nunn commented Oct 30, 2025

This should go some of the way to improving the performance of VMCON, particularly when running a scan #3957.

I noticed that when running a scan over the same point (e.g. sweep = x, x, x, ..., x) VMCON would perform many iterations on the non-first scan points. This does not make any sense because, after the first scan point, PROCESS is at a converged solution and VMCON should immediately identify this and not perform any iterations. I have verified that old VMCON did this as expected.

VMCON's convergence criteria has two components:

  • $|\nabla f(x)\cdot\delta|$: the predicted change in the objective function if VMCON is allowed another iteration.
  • $\sum^m_{i=1}|\lambda_{i} c_i(x)|$: the complementary error.

In new VMCON, the first term was much higher than old VMCON, causing new VMCON to not believe it is converged and iterate in search of a solution. This was being driven by a difference in $\delta$. And the reason $\delta$ was different is because the relative tolerance on the quadratic programming solver was so high.

With this PR:

  • The $\delta$ calculated by new VMCON and old VMCON are near identical.
  • A PROCESS scan of the same point correctly does not iterate and converges immediately.

@timothy-nunn timothy-nunn self-assigned this Oct 30, 2025
@timothy-nunn timothy-nunn marked this pull request as ready for review October 30, 2025 14:31
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 30, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3964      +/-   ##
==========================================
- Coverage   45.98%   43.34%   -2.65%     
==========================================
  Files         123      123              
  Lines       28550    33509    +4959     
==========================================
+ Hits        13129    14523    +1394     
- Misses      15421    18986    +3565     

☔ 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.

@timothy-nunn
Copy link
Copy Markdown
Collaborator Author

timothy-nunn commented Nov 3, 2025

Here is some data to highlight the impact of this PR. PROCESS has broadly three methods of termination:

  • Converging: a sufficiently feasible and locally-optimal solution is found
  • Crashing: a Python error occurs in one of the models, often the Newton failure (Newton solve crashing when calculating t_zero_margin #3674)
  • QSP failing: VMCON's quadratic programming problem solver fails, often because the problem appears locally infeasible when linearised.

I have performed a Monte Carlo experiment of PROCESS runs within +/-30% of the initial starting point of the large_tokamak_nof and st_regression input files, totalling 2000 input files run per configuration.

The first configuration uses VMCON 2.4.0 (new VMCON) with the old high QPP tolerance. As can be seen, there is no significant difference in the number of converging runs before and after this change.
image
1290 runs that converged before this change still converge. 36 runs that used to crash now converge, and 27 that used to converge now crash.

The second configuration used VMCON 2.3.1 (old VMCON) with the new lower QPP tolerance. I had to upgrade CVXPY to 1.7.3 because there was a lot crashes from within CVXPY that this release--or possibly another release >=1.7.1--fixes. Again, there is no significant changes in the number of converging runs.
image

The final configuration combined all of these changes to use the new lower QPP tolerance, VMCON 2.4.0, and CVXPY 1.7.3. There is a significant, but not disastrous, change in the number of converging runs. Many runs that used to converge now crash within the models.

image

Generally, I do not find these results to be concerning as hopefully #3674 will allow many more of these to converge.

@timothy-nunn timothy-nunn force-pushed the remove-qpp-tolerance branch 2 times, most recently from 010d822 to 2d9b166 Compare November 3, 2025 15:27
Comment thread tests/integration/test_vmcon.py
@timothy-nunn timothy-nunn merged commit 09699de into main Nov 4, 2025
14 of 18 checks passed
@timothy-nunn timothy-nunn deleted the remove-qpp-tolerance branch November 4, 2025 11:41
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.

3 participants