Learn R Programming

bbo (version 0.2)

bbo-methods: bbo-methods

Description

Methods for bbo objects.

Usage

"summary"(object, ...) "plot"(x, plot.type = c("itersAvg", "itersBestValue"), ...)

Arguments

object
an object of class bbo; usually, a result of a call to bbo.
x
an object of class bbo; usually, a result of a call to bbo.
plot.type
should we plot the best member at each iteration, the best value at each iteration or the intermediate populations?
...
any additional arguments to be passed to plot function

Details

Members of the class bbo have a plot method that accepts the argument plot.type. plot.type = "itersAvg" results in a plot of the parameter values that represent the lowest value of the objective function at each generation. plot.type = "itersBestValue" plots the best value of the objective function each generation. A summary method also exists and returns the best parameter vector (habitat), the best value of the objective function, average cost of all habitats in the population at each iteration, best habitat at each iteration and the cost of the best habitats.

References

D. Simon, "Biogeography-Based Optimization", IEEE Transactions on Evolutionary Computation, vol. 12, no. 6, pp. 702-713, December 2008.

See Also

bbo and bbo.control.

Examples

Run this code
        ## --------------------
        ## Rosenbrock function:
        ## --------------------
        ## It has a global minimum f(x) = 0 at (1,1).  
        ## Kindly note that the first parameter passed to the 
        ## objective function should be the vector of parameters
        ## to be optimized.
        Rosenbrock <- function(x){
          x1 <- x[1]
          x2 <- x[2]
          return(  100 * (x2 - x1 * x1)^2 + (1 - x1)^2 )
        }

        sample.output.of.bbo <- bbo(Rosenbrock, -5, 5, 
					DisplayFlag = FALSE, 
					control = bbo.control(pMutate = 0.4, 
								numVar = 2, 
								popSize = 50, 
								KEEP = 5, 
								maxGen = 20))

	## print the output information
	bbo:::summary.bbo(sample.output.of.bbo)

	## plot
	bbo:::plot.bbo(sample.output.of.bbo, plot.type = "itersBestValue")

Run the code above in your browser using DataLab