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

ENHANCEMENT: Implemented cyipopt minimize_ipopt #342

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from

Conversation

RageTechDev
Copy link

Description

Alternative optimization algorithm implemented: cyipopt minimize_ipopt #12

Type of PR

  • Other: Enhancement

Checklist for PR

cmichelenstrofer and others added 16 commits April 1, 2024 09:54
* Make uniform shift default false and fix test_core

* Allow for non-uniform shift for impedance
* fix tests

* fix pioneer
* Pioneer tutorial realizations demo

Add frequency array and realization study to beginning of pioneer tutorial

* Update pioneer

* Clean pioneer and update docs

* remove print

* Units

* Update pioneer plots

* Waves before frequencies

* Explain less frequencies

* Minor updates

* Update pioneer

* Merge branch 'dev' of https://github.com/sandialabs/WecOptTool into phases_demo
* bug bix : DC and Nyquist frequency should not be devided by two before ifft


* Changed td_to_fd to scale single sided frequency components rather than TD signal

* minor bug fix from issue332 sandialabs#332
* run CI on PRs against dev branch

* revamped tutorial 1, including fix for sandialabs#293

* more tutorial cleanup and editorial changes

* more cleanup and incorporated changes in sandialabs#315

* fixed tutorial 2 colormaps

* finishing touches

* reverted a few accidental changes

* fixes as per Jeff's review comments

---------

Co-authored-by: Ryan Coe <[email protected]>
* run CI on PRs against dev branch

* coppied fundamental utility files

* import utilities module

* added utilities funtions to tut1

* added bem plot from utils

* added bem plot from utils

* updated sankey plot

* updated check_radiation_damping

* cleared outputs

* corrected bug

* changed Zi to hydro_impedance to be consistent with our variables name python convention

* PR review edits

* add grid to plots

* removed draft functions in utilities.py

* typo

* Fixed one more typo I found while reviewing Daniel's changes

---------

Co-authored-by: Ryan Coe <[email protected]>
Co-authored-by: Michael Devin <[email protected]>
@jtgrasb jtgrasb changed the base branch from main to dev May 2, 2024 19:39
Copy link
Collaborator

@jtgrasb jtgrasb left a comment

Choose a reason for hiding this comment

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

Hi Jorge, thank you for making this PR with the updates to cyipopt. The implementation looks pretty good overall. I left a few small comments and here are some larger comments to get this PR in a spot to be merged:

  • We recently shifted our workflow to merge PRs into dev branch. I changed your PR to be merging into dev instead of main but it looks like this led to some merge conflicts. You can usually view these conflicts in the command line or in GitHub desktop and manually sort through the conflicts to keep the correct version of code.
  • These changes don't impact the tutorials, right? Please remove any changes to the tutorials from this PR by reverting them back to the original versions.

wecopttool/core.py Outdated Show resolved Hide resolved
tests/test_integration.py Outdated Show resolved Hide resolved
tests/test_integration.py Show resolved Hide resolved
ryancoe and others added 4 commits May 3, 2024 09:45
…abs#337)

* post_processing docstrings

- examples
- parameters (order)

* handle multiple phase realizations internally

* Update wecopttool/core.py

* making outputs lists

* Update implementation to function with tutorial 1 for now

* Update tutorials

* Update LUPA

* Make sure same WEC is passed in

* Add test_utilities

Revert "Add test_utilities"

This reverts commit 27399f0.

* Update utilities module

* Update utilities

* Update test_utilities

* Update tutorial 1 utilities call

---------

Co-authored-by: Carlos A. Michelén Ströfer <[email protected]>
Co-authored-by: Carlos A. Michelén Ströfer <[email protected]>
Co-authored-by: jtgrasb <[email protected]>
Co-authored-by: jtgrasb <[email protected]>
@RageTechDev
Copy link
Author

I made another commit removing the comments regarding the callback implementation no longer being used and the unnecessary import. I also noticed that there were no changes made to the tutorials, the only thing I did was test two of them and make sure they worked. After that I restarted the Kernel and cleared all outputs, it might be detecting that as a change?

@jtgrasb
Copy link
Collaborator

jtgrasb commented May 7, 2024

Thanks for making those updates. The tutorials can be a bit finnicky to work with for these PRs. It looks like the outputs are still recorded in the PR here, so you should clear all outputs again and then go to edit notebook metadata and make sure the display name and version are the same as the default. The goal here is that neither of the tutorials show up in the Files Changed section on this PR.

@jorgeypcb
Copy link

Awesome, thanks for the heads up. It should be correct now. Not showing changes to the tutorials!

@coveralls
Copy link

coveralls commented May 16, 2024

Pull Request Test Coverage Report for Build 9130293491

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 11 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.09%) to 94.538%

Files with Coverage Reduction New Missed Lines %
wecopttool/core.py 11 92.55%
Totals Coverage Status
Change from base Build 9018937250: -0.09%
Covered Lines: 2752
Relevant Lines: 2911

💛 - Coveralls

@ryancoe
Copy link
Collaborator

ryancoe commented May 23, 2024

@jtgrasb - Please take a closer at this and compare scipy.minimize with cyipopt for case(s) where we struggle to get good solutions (e.g., when we need to tweak the scaling a lot and/or provide specific initial guess). @michaelcdevin - Please hold off on tagging v3.0 until we figure out how we're going to handle this.

@jtgrasb
Copy link
Collaborator

jtgrasb commented May 30, 2024

According to cyipopt's documentation, the following differences when compared to scipy.optimize.minimize():
"Differences compared to scipy.optimize.minimize() include:

  • A different default method: when method is not provided, Ipopt is used to solve the problem.
  • Support for parameter kwargs: additional keyword arguments to be passed to the objective function, constraints, and their derivatives.
  • Lack of support for callback and hessp with the default method."

When testing the tutorials side-by-side with scipy and cyipopt as currently implemented, there are no observable differences. The first difference stated above is not applied because we are still specifying 'SLSQP' as the solver method. If we leave the method section empty, we can leverage the interior point method, so this is worth exploring here.

Further differences may come with a shift to cyipopt's Problem Interface. The problem interface will require a restructuring of how the optimization problem is defined.

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.

8 participants