3

scipy.optimize.dual_annealing is not respecting the bounds on variables. I am optimizng a five-variable function; the variables at issue("nu", "vBar") are the third and fifth. python version 3.6.0, scipy version 1.4.1.

command: bounds = ( (-1.0 / np.sqrt(2), -epsRho), (0.0 + epsH, 0.5 - epsH), (0.0 + epsNu, 1.0), (0.0, 5.0), (0.0, 1.0))

res = sp.optimize.dual_annealing(minFuncExact, bounds=bounds, args=args, x0=np.asarray(x0), seed=20200220, local_search_options={"method": "L-BFGS-B"})

output from running program: rho is 0.05421130947051514 H is 0.19431094432639348 nu is 2.446853627283776 kappa is 0.21658987615448913 vBar is -0.3671109297261478

Initial condition x0 consists of the midpoints of the bounds intervals. Text in bold shows the issue.

Progman
  • 16,827
  • 6
  • 33
  • 48
user18010
  • 31
  • 2

1 Answers1

0

Two years later... better late than never, I guess.

The issue you are having is not related to the annealing part of the algorithm, but to the local search. To avoid this, you want to indicate the bounds to the local search engine.

Your new code line would be:

res = sp.optimize.dual_annealing(minFuncExact, bounds=bounds, args=args, x0=np.asarray(x0), seed=20200220, local_search_options={"method": "L-BFGS-B"}, "bounds": bounds)
FoxMrD
  • 1
  • 1