DAY 21
0
AI & Data

## 【Day21】GA with you - R Package genoud R套件 genoud

### Usage 用法

``````genoud(fn, nvars, max=FALSE, pop.size=1000, max.generations=100,
wait.generations=10, hard.generation.limit=TRUE, starting.values=NULL,
MemoryMatrix=TRUE, Domains=NULL, default.domains=10,
solution.tolerance=0.001, gr=NULL, boundary.enforcement=0, lexical=FALSE,
unif.seed=round(runif(1, 1, 2147483647L)),
int.seed=round(runif(1, 1, 2147483647L)),print.level=2, share.type=0,
instance.number=0, output.path="stdout", output.append=FALSE,
project.path=NULL, P1=50, P2=50, P3=50, P4=50, P5=50, P6=50, P7=50,
P8=50, P9=0, P9mix=NULL, BFGSburnin=0, BFGSfn=NULL, BFGShelp=NULL,
control=list(), optim.method=ifelse(boundary.enforcement < 2, "BFGS",
"L-BFGS-B"), transform=FALSE, debug=FALSE, cluster=FALSE, balance=FALSE,
...)
``````

### Arguments 參數

`fn`:函數
`nvars`:有多少個參數將帶入計算適應值的函數中
`max`:決定是要求最大值還是最小值
`pop.size`:群體的大小
`max.generations`:迭代的世代數

### Example 範例

(`genoud`在R v3.1.1以後就不支援了～～)

``````install.packages("genoud")
library("genoud")
``````
``````#maximize the sin function
sin1 <- genoud(sin, nvars=1, max=TRUE)

#minimize the sin function
sin2 <- genoud(sin, nvars=1, max=FALSE)
``````