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
shgo
error since scipy 1.8.0.dev0+1529.803e52d
#14589
Comments
Thanks for the report. @Stefan-Endres is working on a PR that is going to refactor quite some things. Stefan, does your PR address this? |
It seems that the regression has been introduced in #14274. |
This bug got me too. FWIW, I reproduced it with the following code: import scipy.optimize as so
def obj_fun(x, a, b):
return (x[0]/a)**2 + (x[1]/b)**2
def main():
a = 1.0
b = 1.0
bounds = [(-1.0, 1.0),
(-1.0, 1.0)]
result = so.shgo(obj_fun,
bounds,
args = (a,b))
if result.success:
print(f"x = {result.x} and obj_fun(x) = {result.x}")
else:
print(f"""
Message from minimizer: {result.message}
Status code from minimizer: {result.status}
Optimization "solution" at failure: {result.x}
""")
if __name__ == "__main__":
main() It looks like the problem is in how |
I think I've found a solution. On line 900 of self.HC = Complex(self.dim, self.func, self.args, to self.HC = Complex(self.dim, self.func, (), What's happening is that since Unfortunately, an alternative like setting |
There are large development in progress changing the whole architecture of |
Understood, but bear in mind that this bug is not only almost a year old, but breaks some very basic documented functionality. A minimal fix now will provide an indicator to those making large changes of what should or shouldn't be done with function arguments, while solving a problem facing end users of SHGO now. |
@jjramsey you are welcomed to make such a fix. |
The large developments are happening here #14013 |
Looks like the pull request for those large developments has been stalled since Jul 26, 2021, apparently due to some automatic tests failing for some unclear reason. Any way to rerun the tests to see if the failure was a fluke (or perhaps some fault in the Azure pipelines)? |
@jjramsey the PR is not staled due to failing tests but it's conditioned to maintainers time to work on SciPy. Most of us are volunteers and don't have much time to work on SciPy. |
Hi all! I was experimenting with |
@abianco88, I posted an answer to your question on Stackoverflow, the essential part of which is:
|
Solution suggested by jjramsey in scipy#14589 (comment) The answer at the time was that an important refactor was in progress scipy#14013 This pull request is now closed and the bug persists in version 1.8.1 accordingly to this stack overflow question https://stackoverflow.com/q/72794609/12750353
* Fix bug #14589 where arguments to objective function aren't passed properly Co-authored-by: J. J. Ramsey <jjramsey@pobox.com>
* Fix bug scipy#14589 where arguments to objective function aren't passed properly Co-authored-by: J. J. Ramsey <jjramsey@pobox.com>
* Fix bug scipy#14589 where arguments to objective function aren't passed properly Co-authored-by: J. J. Ramsey <jjramsey@pobox.com>
shgo
raises an error with the following example since scipy 1.8.0.dev0+1529.803e52d.This error was noticed in the hyperspy test suite (https://github.com/hyperspy/hyperspy-extensions-list/actions/runs/1111267440) and previous scipy development version (1.8.0.dev0+1503.8647ee9) didn't raise an error. Scipy development version are installed from https://pypi.anaconda.org/scipy-wheels-nightly/simple.
Reproducing code example:
Error message:
Scipy/Numpy/Python version information:
1.8.0.dev0+1529.803e52d 1.21.1 sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)
The text was updated successfully, but these errors were encountered: