JuliaNLSolvers / Optim.jl

Optimization functions for Julia
Other
1.1k stars 214 forks source link

Expose more optimisation parameters to users #1093

Open rafaqz opened 2 months ago

rafaqz commented 2 months ago

In simulated annealing the start temperature, rate of expansion, and acceptance ratio are all fixed constants defined in code.

With expensive objective functions it can make a lot of sense to adjust these parameters, but currently that requires editing the code directly.

pkofod commented 2 months ago

I agree 👍 Edit: or maybe not

pkofod commented 2 months ago

Start temperature is controlled by the temperature input. For example SimulatedAnnealing(; temperature=t->30/t) gives you a temperature of 30 in the first iteration, then 15, then 7.5, .... The temperature controls the rate of cooling (is that what you call rate of expansion?) and the formulate for the acceptance probability depends on the temperature. Can you maybe expand on your thoughts? Is this maybe a documentation issue?

rafaqz commented 2 months ago

Sorry I mean bounded, SAMIN. But really they should be the same in this regard.

In SAMIN the start temperature is just set to 2.0: https://github.com/JuliaNLSolvers/Optim.jl/blob/master/src/multivariate/solvers/constrained/samin.jl#L76

Acceptance thresholds are hard coded: https://github.com/JuliaNLSolvers/Optim.jl/blob/master/src/multivariate/solvers/constrained/samin.jl#L218-L219

And the temperature is multiplied by 10 in the increase phase: https://github.com/JuliaNLSolvers/Optim.jl/blob/master/src/multivariate/solvers/constrained/samin.jl#L312

pkofod commented 2 months ago

I see, let me review that then :)