sa: Simulated annealing

Description Usage Arguments Details Value See Also Examples

View source: R/sa.R

Description

Use simulated annealing to find the global minimum

Usage

1
2
3
sa(f, x, temp = 10000, rate = 1e-04)

tspsa(x, temp = 100, rate = 1e-04)

Arguments

f

function representing f

x

an initial estimate of the minimum

temp

the initial temperature

rate

the cooling rate

Details

Simulated annealing finds a global minimum by mimicing the metallurgical process of annealing.

Value

the x value of the minimum found

See Also

Other optimz: bisection, goldsect, gradient, hillclimbing, newton, secant

Examples

1
2
3
4
5
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)

cmna documentation built on June 20, 2017, 9:08 a.m.