optimize.shgo gives unexpected TypeError
See original GitHub issueMy issue is about optimize.shgo. It gives an unexpected TypeError.
When running the following
from scipy.optimize import rosen, rosen_der, rosen_hess
bounds = [(0,1.6), (0, 1.6), (0, 1.4), (0, 1.4), (0, 1.4)]
result = scipy.optimize.shgo(rosen, bounds, options={'jac':rosen_der,'hess':rosen_hess})
I get
TypeError: _minimize_slsqp() got multiple values for argument 'jac'
I believe that jac
is correctly specified here (see this documentation). Did I make a mistake or is there a bug here?
Scipy/Numpy/Python version information:
1.6.0 1.20.0 sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Possible bug in SciPy shgo (Unexpected TypeError)
When running the following from scipy.optimize import rosen, rosen_der, rosen_hess bounds = ...
Read more >shgo is not correctly passing jac to minimizer #12963 - GitHub
Is this a bug in shgo or am I doing something wrong? Please advise if there is a ... optimize.shgo gives unexpected TypeError...
Read more >scipy.optimize.shgo — SciPy v1.9.3 Manual
Finds the global minimum of a function using SHG optimization. SHGO stands for “simplicial homology global optimization”. Parameters. funccallable.
Read more >scipy/optimize/_shgo.py - Fossies
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting...
Read more >SciPy 1.10.0 Release Notes
The new scipy.ndimage.value_indices function provides a time-efficient method to search for the ... #14533: optimize.shgo gives unexpected TypeError.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Stefan-Endres I believe this was a duplicate of gh-12963 (different from above). This appears to have been fixed by gh-17140.
Yes, by default shgo will explore all these minima. Once it has found the local minimum in a basin of attraction it will not search locally in that basin again (there is a theoretical advantage that it will not waste additional local searches in every subdomain that is a convex basin of attraction). If you keep iterating then it will explore all the local minima. Refining the complex globally has the guarantee that
shgo
will explore all the local minima until all are found (iff the number of local minima are finite and the minima are strictly convex).This is also one of the reasons shgo was developed to supply bounds/constraints for every local basin of attraction it detects, it then constructs and passes the local constraints of that basin (based on the geometry known from the global sampling data in the current iteration) and keeps the local solver in the local basin of attraction (ex. in solutions thermodynamics this is important to find all phases in equilibrium). However, this of course only works in the limit where enough global exploration has been performed (by iterating more sampling points).
This is perfect for
shgo
.Yes, when you supply
f_min
the global algorithm will stop when a solution was found within a givenf_tol
off_min
, but if you would like to explore all minima with an objective function value around -0.001 or possibly lower value it would be better to not supply thisf_min
option.I would be very happy to talk more about your problem and help you further if needed. Unfortunately, I do not think GitHub is the appropriate forum to discuss use cases, but please feel free to contact me by e-mail (either work/personal e-mail are both fine). Alternatively, we can post on the scipy-user mailing lists (which I believe is also appropriate), especially if you think the discussion could have value staying in the public domain.