We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
autodiff = :forward
The following snippet seems to never converge, might even be an infinite loop.
import Optim c = 0.46827885610377784 g = [-0.017808551990403484, -0.009150354124211798, 0.023989940649623325, -0.0015879460060053466, -0.0030085905935535303] H = [-1.4083929846267207 -0.08729658128691528 1.1062858720713942 0.010727524904536382 0.006676603598248883; -0.08729658128691528 -0.02571314825119676 0.026159077016407118 -0.0012507499641383534 -0.015024125029329585; 1.1062858720713942 0.026159077016407118 -1.2014469206354028 -0.00606355787389272 -0.0071288964953479085; 0.010727524904536382 -0.0012507499641383534 -0.00606355787389272 -0.0025608299686474597 0.0058944641908055245; 0.006676603598248883 -0.015024125029329585 -0.0071288964953479085 0.0058944641908055245 0.015761181422473437] lb = [-0.19119409272715046, -0.78118946939934, -0.22241627896062094, -0.16624708126377563, -4.449294665337389e-17] ub = [0.19119409272715046, 0.78118946939934, 0.22241627896062094, 0.8336529187362244, 0.611545827757757] result = Optim.optimize( x -> -1e4 * (c + g'*x + 0.5 * x'*H*x), lb, ub, zeros(length(g)), Optim.Fminbox(Optim.BFGS()), Optim.Options(; show_trace=true); autodiff = :forward, )
and if you re-run the same snippet without autodiff = :forward it converges immediately.
The text was updated successfully, but these errors were encountered:
We would have to analyze the finer details here, but I agree, it does not go as expected. However, changing the starting values does help in this case
julia> result = Optim.optimize( x -> -1e4 * (c + g'*x + 0.5 * x'*H*x), lb, ub, 0.1.+zeros(length(g)), Optim.Fminbox(Optim.BFGS()), Optim.Options(; show_trace=false, iterations=100); autodiff = :finite, ) * Status: success * Candidate solution Final objective value: -4.818047e+03 * Found with Algorithm: Fminbox with BFGS * Convergence measures |x - x'| = 1.57e-16 ≰ 0.0e+00 |x - x'|/|x'| = 1.20e-16 ≰ 0.0e+00 |f(x) - f(x')| = 0.00e+00 ≤ 0.0e+00 |f(x) - f(x')|/|f(x')| = 0.00e+00 ≤ 0.0e+00 |g(x)| = 4.51e-06 ≰ 1.0e-08 * Work counters Seconds run: 0 (vs limit Inf) Iterations: 6 f(x) calls: 559 ∇f(x) calls: 559 julia> result = Optim.optimize( x -> -1e4 * (c + g'*x + 0.5 * x'*H*x), lb, ub, 0.1.+zeros(length(g)), Optim.Fminbox(Optim.BFGS()), Optim.Options(; show_trace=false, iterations=100); autodiff = :forward, ) * Status: success * Candidate solution Final objective value: -4.818047e+03 * Found with Algorithm: Fminbox with BFGS * Convergence measures |x - x'| = 1.57e-16 ≰ 0.0e+00 |x - x'|/|x'| = 1.20e-16 ≰ 0.0e+00 |f(x) - f(x')| = 0.00e+00 ≤ 0.0e+00 |f(x) - f(x')|/|f(x')| = 0.00e+00 ≤ 0.0e+00 |g(x)| = 2.76e-06 ≰ 1.0e-08 * Work counters Seconds run: 1 (vs limit Inf) Iterations: 6 f(x) calls: 7568 ∇f(x) calls: 7568
Sorry, something went wrong.
No branches or pull requests
The following snippet seems to never converge, might even be an infinite loop.
and if you re-run the same snippet without
autodiff = :forward
it converges immediately.The text was updated successfully, but these errors were encountered: