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

Fix occasional optimiser test failure #1651

Merged
merged 2 commits into from
Nov 22, 2022

Conversation

CoronelBuendia
Copy link
Contributor

@CoronelBuendia CoronelBuendia commented Nov 21, 2022

Linked Issues

Closes #1652

Description

Fixes the optimiser test.

I went through the whole damn thing, checked the gradient calculations of the toy problem, and went pretty deep into what we have. I've narrowed it down to two things:

  • Invalid starting solution does not guarantee convergence (fixed)
  • Likely something wrong with the SLSQP implementation in NLOpt (unconfirmed)
    • Partly related to the strange problem formulation I had chosen in which 3 of the variables were basically dummy equality constraints that didn't feed into the objective function, but it seems that very occasionally SLSQP's Hessian calculation (again probably) causes a starting solution of zeros to be passed into the objective function repeatedly until the number of iterations is reached.
    • This is probably a very strange edge case in the SLSQP algorithm, and the problem formulation was not a good one in any case.
    • I fixed this by changing the objective function so that it used all variables and kept all the inequality and equality constraints as before.

Interface Changes

N/A

Checklist

I confirm that I have completed the following checks:

  • Tests run locally and pass pytest tests --reactor
  • Code quality checks run locally and pass flake8 and black .
  • Documentation built locally and checked sphinx-build -W documentation/source documentation/build

@CoronelBuendia CoronelBuendia requested a review from a team as a code owner November 21, 2022 16:28
@sonarcloud
Copy link

sonarcloud bot commented Nov 21, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2022

Codecov Report

Merging #1651 (7745a4b) into develop (ebec2de) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop    #1651   +/-   ##
========================================
  Coverage    74.65%   74.65%           
========================================
  Files          162      162           
  Lines        19213    19213           
========================================
+ Hits         14343    14344    +1     
+ Misses        4870     4869    -1     
Impacted Files Coverage Δ
bluemira/equilibria/solve.py 68.22% <0.00%> (+0.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link
Contributor

⚠️ Warning Report

Found 0 new warnings, 0 fixed warnings. 🎉

@CoronelBuendia CoronelBuendia added bug Something isn't working utilities Tasks relating to the utilities module optimisation Tasks relating to optimisation labels Nov 22, 2022
@je-cook je-cook merged commit 5ca5343 into develop Nov 22, 2022
@je-cook je-cook deleted the matti/fix-optimiser-test-periodic-failure branch November 22, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working optimisation Tasks relating to optimisation utilities Tasks relating to the utilities module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sporadic failure in optimiser test
4 participants