View source: R/print.CEoptim.R
R Documentation |
Produce print
method for class "CEoptim"
## S3 method for class 'CEoptim'
print(x,...)
x |
object of class inheriting from |
... |
additional arguments: |
print
method for "CEoptim"
class,
returns by default the main description of the x
object including: optimizer
; optimum
; termination
.
To get the states
and states.probs
outputs, one should specify the corresponding argument to "TRUE".
Tim Benham, Qibin Duan, Dirk P. Kroese, Benoit Liquet
Benham T., Duan Q., Kroese D.P., Liquet B. (2017) CEoptim: Cross-Entropy R package for optimization. Journal of Statistical Software, 76(8), 1-29.
CEoptim
## Maximizing the Peaks Function
fun <- function(x){
return(3*(1-x[1])^2*exp(-x[1]^2 - (x[2]+1)^2)
-10*(x[1]/5-x[1]^3 - x[2]^5)*exp(-x[1]^2 - x[2]^2)
-1/3*exp(-(x[1]+1)^2 - x[2]^2))}
set.seed(1234)
mu0 <- c(-3,-3); sigma0 <- c(10,10)
res <- CEoptim(fun,continuous=list(mean=mu0, sd=sigma0), maximize=TRUE)
## Print method provides by default
## optimizer; optimum and termination.
print(res)
## To print only the Optimal value of fun
print(res,optimum=TRUE)
## To print only the location of the optimal value
print(res,optimizer=TRUE)
## To print only termination information
print(res,termination=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.