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

Bugfix for optimal objective value #364

Merged
merged 5 commits into from
Dec 4, 2023
Merged

Conversation

ewu63
Copy link
Collaborator

@ewu63 ewu63 commented Nov 14, 2023

Purpose

Previously, sol.fStar is taken to be the optimal objective value, but sol.objectives[obj_name].value is the objective value of the last queried point, which is not guaranteed to match. This is now fixed, even though this is ambiguous and undocumented.

Note that the constraint values are still the last queried values, since the constraint value at the optimum is not returned by the optimizer and we do not want to query the constraints just to get this value. So they are left as the last value.

Expected time until merged

1 week

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

I added a test

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@ewu63 ewu63 requested a review from a team as a code owner November 14, 2023 02:14
@ewu63 ewu63 requested review from lamkina and sseraj November 14, 2023 02:14
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (f56e159) 73.38% compared to head (3355ba0) 61.65%.

Files Patch % Lines
pyoptsparse/pyOpt_solution.py 71.42% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #364       +/-   ##
===========================================
- Coverage   73.38%   61.65%   -11.74%     
===========================================
  Files          22       22               
  Lines        3307     3312        +5     
===========================================
- Hits         2427     2042      -385     
- Misses        880     1270      +390     

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

lamkina
lamkina previously approved these changes Nov 27, 2023
Copy link
Contributor

@lamkina lamkina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Copy link
Contributor

@sseraj sseraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one minor comment

for var in self.variables[dvGroup]:
var.value = xopt[i]
i += 1
i = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line necessary?

@ewu63
Copy link
Collaborator Author

ewu63 commented Dec 4, 2023

bump @lamkina

@lamkina lamkina merged commit 75e6479 into mdolab:main Dec 4, 2023
12 of 13 checks passed
@ewu63 ewu63 deleted the bugfix/fix-obj-value branch December 4, 2023 21:01
@ewu63 ewu63 mentioned this pull request Dec 7, 2023
13 tasks
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.

None yet

3 participants