Learn R Programming

CEoptim (version 1.3)

print: Print method for the CEoptim object

Description

Produce print method for class "CEoptim"

Usage

# S3 method for CEoptim
print(x,...)

Arguments

x

object of class inheriting from "CEoptim"

...

additional arguments: optimizer; optimum; termination;states;states.probs

Author

Tim Benham, Qibin Duan, Dirk P. Kroese, Benoit Liquet

Details

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".

References

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.

See Also

CEoptim

Examples

Run this code
## 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)

Run the code above in your browser using DataLab