Re: [R] Solve equality function with GA

2022-09-25 Thread Bert Gunter
... oops. Ignore my last sentence. Need more coffee... -- Bert On Sun, Sep 25, 2022 at 7:45 AM Bert Gunter wrote: > ... and so you need f(x) = abs(x^2 - 25), > though I have no idea if GA handles non-continuously differentiable > functions. > > -- Bert > > On Sun, Sep 25, 2022 at 1:44 AM Eric Be

Re: [R] Solve equality function with GA

2022-09-25 Thread Bert Gunter
... and so you need f(x) = abs(x^2 - 25), though I have no idea if GA handles non-continuously differentiable functions. -- Bert On Sun, Sep 25, 2022 at 1:44 AM Eric Berger wrote: > ?ga states that ga() searches for the maximum of the fitness function. > The maximum of your fitness function is

Re: [R] Solve equality function with GA

2022-09-25 Thread Eric Berger
?ga states that ga() searches for the maximum of the fitness function. The maximum of your fitness function is at x=0. On Sun, Sep 25, 2022 at 4:52 AM Bert Gunter wrote: > We aren't supposed to do homework on this list. > > Bert Gunter > > On Sat, Sep 24, 2022 at 5:29 PM Barry King via R-help

Re: [R] Solve equality function with GA

2022-09-24 Thread Bert Gunter
We aren't supposed to do homework on this list. Bert Gunter On Sat, Sep 24, 2022 at 5:29 PM Barry King via R-help wrote: > I am having difficulty solving for 5 in this coded snippet. Please help. > --- > library(GA) > > # Solve for x where x^2 = 25, not x^2 <= 25 > > f <- functi

[R] Solve equality function with GA

2022-09-24 Thread Barry King via R-help
I am having difficulty solving for 5 in this coded snippet. Please help. --- library(GA) # Solve for x where x^2 = 25, not x^2 <= 25 f <- function(x) { x^2-25 } fitness <- function(x) -f(x) GA <- GA <- ga(type = "real-valued", fitness = fitness, lower = 0, upper = 10) summary(