pyoptsparse | oriented framework
kandi X-RAY | pyoptsparse Summary
kandi X-RAY | pyoptsparse Summary
pyOptSparse is an object-oriented framework for formulating and solving nonlinear constrained optimization problems in an efficient, reusable, and portable manner.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Optimized Algorithm .
- Top level function for master functions .
- plots the plot
- Add a variable group .
- Function to update the plot
- Initialize the optimization history .
- Finalize the constraint .
- Add variables to the history .
- Evaluate the objective function .
- Create SWIG interface .
pyoptsparse Key Features
pyoptsparse Examples and Code Snippets
Community Discussions
Trending Discussions on pyoptsparse
QUESTION
I am having trouble navigating the source code to see how the design variables in the initial population for the SimpleGA and DifferentialEvolution Drivers are set. Is there some sort of Latin Hypercube sampling of the design variable ranges? Do the initial values I set in my problem instance get used like they would for the other drivers (Scipy and pyOptSparse)?
Many thanks, Garrett
...ANSWER
Answered 2022-Apr-10 at 23:31For these two drivers, the initial value in the model is not used. Its not even clear to me what it would mean to use that value directly, since you need a stochastically generated population --- but I'm admittedly not an expert on the latest GA population initialization methods. However, I can answer the question of how they do get initialized as of OpenMDAO V3.17:
This driver does seem to use an LHS sampling like this:
QUESTION
When using the SciPyOptimize SLSQP driver in OpenMDAO, bounds on design variables seem to be strongly enforced (i.e. the optimizer does not seem to ever pick values that are outside those bounds). However, with the PyOptSparse SLSQP driver, the bounds are still treated as constraints, but it does seem to try to evaluate cases outside the bounds. Is there a way to force the PyOptSparse driver to behave more like the SciPyOptimize one in this sense?
...ANSWER
Answered 2021-Jun-08 at 15:35despite both having the SLSQP name, Scipy and pyoptsparse use different implementations of the algorithm. The Scipy one was updated with stricter bounds enforcement a few years ago, but the one in pyoptsparse was not.
To fix this, someone would need to spend some time updating the SLSQP fortran code pyoptsparse itself. Jacob Williams has done a decent job of creating an updated SLSQP codebase. Perhaps you could collaborate with him to add his version of the algorithm to pyoptsparse.
QUESTION
I am looking to purchase SNOPT for openMDAO(for AMIEGO specifically). May be I'm missing the obvious, but I have no idea where to begin. Should I get the SNOPT compiled executable built against ASL or mex-file version or something else? I found multiple sellers who offer different formats of SNOPT. Which one is compatible with openMDAO? Also once I have it, how should I go about setting up everything with openMDAO? (I already have pyOptSparse installed)
I apologize if this type of question is not encouraged in this platform. I'm new to this and I'm completely lost.
...ANSWER
Answered 2021-Mar-17 at 12:12SNOPT installation is purely a related to pyOptSparse. OpenMDAO uses pyOptSparse as is. So if SNOPT is not working in OpenMDAO, then it is because something has gone wrong with your SNOPT install in pyOptSparse itself.
One way you can test if things are working is to run the pyOptSparse test for SNOPT.
You want to order a source distribution of SNOPT from here
QUESTION
I recently came across AMIEGO. When I try to run the example problems (provided in the example directory) I get the following error.
...ANSWER
Answered 2020-Oct-26 at 23:16I've pushed up a couple of fixes to the repository so that you can run it without SNOPT. The basic Branin problem in the examples works and gets to the expected answer now. I can't promise that SLSQP is the best choice for more complicated problems as we usually favor SNOPT over SLSQP in our work. This is still very experimental code, so the documentation is weak and there are still a lot of control knobs and flags that are buried as subcomponent attributes (including ideas that we tried that didn't pan out). But we appreciate users who are willing to try AMIEGO and help us improve it.
QUESTION
I have a mixed integer nonlinear problem. I dont want to use any penalty approaches so I am looking for a MINLP solver in Openmdao. Is it possible to use APOPT solver in openmdao ? It isn't available in pyoptsparse driver. Is there any other alternative ? If not how should I go about implementing APOPT in openmdao ?
...ANSWER
Answered 2020-Oct-04 at 14:05The first step in making any optimizer available to OpenMDAO is to make it accessible in Python itself. It looks like APOPT is available in Python through the GEKKO library. So Step 1 is for you to get that library, and figure out how to use it.
Then you can write a driver that integrates GEKKO in OpenMDAO. To do that you will write your own plugin that wraps GEKKO. You can search for the openmdao github topic to see a list of existing plugins for some examples (you can make plugins for anything, not just drivers)
One example driver plugin for is the OpenMDAO wrapper for the NLopt library, written by the National Renewable Energy Laboratory. https://github.com/johnjasa/nrel_openmdao_extensions/blob/master/nrel_openmdao_extensions/nlopt_driver.py
The actual driver code is here, but the full repo is necessary to actually register it as a plugin.
You can also look into the MINLP algorithm AMIEGO, which is also available as a plugin. You can read about it in detail in this paper.
QUESTION
I am in the process of validating a couple of models that I have written in pyoptsparse and scipy. I want to be able to test the same code in Gekko to see if the results are consistent with the more symbolic Gekko version that I originally made. To do this I have tried to use Odeint and integrating with my own code instead of using the built in Gekko capabilities. Is it possible to do it this way? is the issue with the optimizers ability to take the gradient of the Odeint?
...ANSWER
Answered 2020-Jul-01 at 20:39All of the expressions in Gekko must use Gekko variables so that the model can be compiled to byte-code. If you open the run folder and gk_model0.apm
, you will see the model that you've created with this script:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pyoptsparse
You can use pyoptsparse like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page