
R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> suppressMessages(library(rgenoud))
> 
> #maximize the sin function
> sin1 <- genoud(sin, nvars=1, max=TRUE, unif.seed=912821, int.seed=93058, print.level=0)
> sin1$value <- signif(sin1$value,6)
> sin1$par <- signif(sin1$par,6)
> sin1$gradients <- signif(sin1$gradients,6)
> print(sin1)
$value
[1] 1

$par
[1] 7.85398

$gradients
[1] -3.8465e-11

$generations
[1] 11

$peakgeneration
[1] 1

$popsize
[1] 1000

$operators
[1] 122 125 125 125 125 126 125 126   0

> 
> #minimize the sin function
> sin2 <- genoud(sin, nvars=1, max=FALSE, unif.seed=912821, int.seed=93058, print.level=0)
> sin2$value <- signif(sin2$value,6)
> sin2$par <- signif(sin2$par,6)
> sin2$gradients <- signif(sin2$gradients,6)
> print(sin2)
$value
[1] -1

$par
[1] -1.5708

$gradients
[1] 5.94475e-11

$generations
[1] 11

$peakgeneration
[1] 1

$popsize
[1] 1000

$operators
[1] 122 125 125 125 125 126 125 126   0

> 
> 
> proc.time()
   user  system elapsed 
  0.508   0.045   0.537 
