diff --git a/dfols/__init__.py b/dfols/__init__.py index 543a507..12af57a 100644 --- a/dfols/__init__.py +++ b/dfols/__init__.py @@ -39,7 +39,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals # DFO-LS version -__version__ = '1.5.2' +__version__ = '1.5.3' # Main solver & exit flags from .solver import * diff --git a/dfols/solver.py b/dfols/solver.py index 8ce384c..b46921c 100644 --- a/dfols/solver.py +++ b/dfols/solver.py @@ -148,7 +148,9 @@ def solve_main(objfun, x0, argsf, xl, xu, projections, npt, rhobeg, rhoend, maxf exit_info = ExitInformation(EXIT_SUCCESS, "Objective is sufficiently small") if exit_info is not None: - return x0, r0_avg, sumsq(r0_avg), None, num_samples_run, nf, nx, nruns_so_far+1, exit_info, diagnostic_info + xmin_eval_num = 0 + jacmin_eval_nums = np.array([0], dtype=int) + return x0, r0_avg, sumsq(r0_avg), None, num_samples_run, nf, nx, nruns_so_far+1, exit_info, diagnostic_info, xmin_eval_num, jacmin_eval_nums else: # have old r0 information (e.g. from previous restart), use this instead diff --git a/dfols/tests/test_solver.py b/dfols/tests/test_solver.py index 737665d..0d5d149 100644 --- a/dfols/tests/test_solver.py +++ b/dfols/tests/test_solver.py @@ -210,3 +210,22 @@ def runTest(self): self.assertTrue(array_compare(soln.resid, rosenbrock(soln.x), thresh=1e-10), "Wrong resid") self.assertTrue(array_compare(soln.jacobian, rosenbrock_jacobian(soln.x), thresh=1e-2), "Wrong Jacobian") self.assertTrue(abs(soln.obj - fmin) < 1e-4, "Wrong fmin") + +class TestDiagnosticInto(unittest.TestCase): + # Return diagnostic info - minimal working example for issue #23 + def runTest(self): + ## Minimal working example for DFO-LS bug #23 + objfun = lambda x: x + x0 = np.arange(3) + xmin = np.zeros(x0.shape) + soln = dfols.solve(objfun=objfun, x0=x0, user_params={"logging.save_diagnostic_info": True}) + self.assertTrue(array_compare(soln.x, xmin, thresh=1e-2), "Wrong xmin") + +class TestStartAtMin(unittest.TestCase): + # Start solver at solution - minimal working example for issue #24 + def runTest(self): + objfun = lambda x: x + x0 = np.zeros(3) + xmin = x0.copy() + soln = dfols.solve(objfun=objfun, x0=x0, user_params={"logging.save_diagnostic_info": True}) + self.assertTrue(array_compare(soln.x, xmin, thresh=1e-8), "Wrong xmin") \ No newline at end of file diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index b31a400..a88a727 100755 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/history.doctree b/docs/build/doctrees/history.doctree index 35a68e8..ddfde40 100755 Binary files a/docs/build/doctrees/history.doctree and b/docs/build/doctrees/history.doctree differ diff --git a/docs/build/doctrees/index.doctree b/docs/build/doctrees/index.doctree index 9b290fd..06981d4 100755 Binary files a/docs/build/doctrees/index.doctree and b/docs/build/doctrees/index.doctree differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index b6a06b1..a1846d4 100644 --- a/docs/build/html/.buildinfo +++ b/docs/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 865700494aceade7d85c2a3d7b404b00 +config: e27aac59f14e76a4142e0b9f9d374216 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/_sources/history.rst.txt b/docs/build/html/_sources/history.rst.txt index d5aee69..69b7093 100644 --- a/docs/build/html/_sources/history.rst.txt +++ b/docs/build/html/_sources/history.rst.txt @@ -75,3 +75,7 @@ Version 1.5.1 (10 Oct 2024) Version 1.5.2 (28 Oct 2024) --------------------------- * Bugfix for saving diagnostic info (bug introduced in v1.5.1) + +Version 1.5.3 (30 Oct 2024) +--------------------------- +* Bugfix when starting solver at problem minimizer (bug introduced in v1.5.1) diff --git a/docs/build/html/_static/documentation_options.js b/docs/build/html/_static/documentation_options.js index 67b298a..e4b664c 100644 --- a/docs/build/html/_static/documentation_options.js +++ b/docs/build/html/_static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: '1.5.2', + VERSION: '1.5.3', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/build/html/advanced.html b/docs/build/html/advanced.html index f9aebcf..10b73dc 100644 --- a/docs/build/html/advanced.html +++ b/docs/build/html/advanced.html @@ -4,7 +4,7 @@ -