pyoptsparse
pyoptsparse copied to clipboard
Refactor optimizer wrappers
Description of feature
There is a ton of shared code between different optimizer wrappers:
- setting up the parameters
- comm splitting and bcast after
- creating the solution after
There are also tons of class attributes which are set by each optimizer without using the class structure properly. All these can be reorganized with significantly less code duplication.
Potential solution
- Create a
__call__function in the parent class, which does the shared stuff:- This can call optimizer-specific functions which does the actual work (generating inputs, calling the optimizer, etc.)
- In the init, properly set the class attributes.