# To attach a simdesign, a nl object needs to be created first (see ?nl).
# For this example, we load a nl object from test data.
nl <- nl_lhs
# Example 1: Using a metric from the experiment metrics vector for evaluation:
nl@simdesign <- simdesign_GenSA(nl=nl,
par=NULL,
evalcrit=1,
control=list(max.time = 600),
nseeds=1)
# Example 2: Using a self-defined evaluation function
# For demonstration we define a simple function that calculates
# the maximum value of count sheep output.
critfun <- function(nl) {
results <- nl@simdesign@simoutput
crit <- as.integer(max(results$`count sheep`))
return(crit)
}
nl@simdesign <- simdesign_GenSA(nl=nl,
par=NULL,
evalcrit=critfun,
control=list(max.time = 600),
nseeds=1)
Run the code above in your browser using DataLab