powered by
Use simulated annealing to find the global minimum
sa(f, x, temp = 10000, rate = 1e-04)tspsa(x, temp = 100, rate = 1e-04)
tspsa(x, temp = 100, rate = 1e-04)
function representing f
f
an initial estimate of the minimum
the initial temperature
the cooling rate
the x value of the minimum found
x
Simulated annealing finds a global minimum by mimicing the metallurgical process of annealing.
Other optimz: bisection(), goldsect, gradient, hillclimbing(), newton(), secant()
bisection()
goldsect
gradient
hillclimbing()
newton()
secant()
# NOT RUN { f <- function(x) { x^6 - 4 * x^5 - 7 * x^4 + 22 * x^3 + 24 * x^2 + 2} sa(f, 0) f <- function(x) { (x[1] - 1)^2 + (x[2] - 1)^2 } sa(f, c(0, 0), 0.05) # }
Run the code above in your browser using DataLab