Learn R Programming

SACOBRA (version 1.2)

COP: Constraint Optimization Problem Benchmark (G Function Suite)

Description

COP is an object of class R6ClassGenerator which can be used to access G problems (aka G functions) implementations in R, by simply generating a new instance of COP for each G function problem<-COP.new("problem"). The COP instances have the following useful attributes:

  • name : name of the problem given by the user

  • dimension: dimension of the problem. For the scalable problems G02 and G03, the dimension should be given by users, otherwise it will be set automaticaly

  • lower: lower boundary of the problem

  • upper: upper boundary of the problem

  • fn: the COP function which can be passed to SACOBRA. (see fn description in cobraInit)

  • nConstraints: number of constraints

  • xStart: The suggested optimization starting point

  • solu: the best known solution, (only for diagnostics purposes)

  • info: information about the problem

G function suite is a set of 24 constrained optimization problems with various properties like dimension, number of equality/ inequality constraint, feasibilty ratio, etc. Although these problems were introduced as a suite in a technical report at CEC 2006, many of them have been used by different autors earlier. For more details see: Liang, J., Runarsson, T.P., Mezura-Montes, E., Clerc, M., Suganthan, P., Coello, C.C., Deb, K.: Problem definitions and evaluation criteria for the CEC 2006 special session on constrained real-parameter optimization. Journal of Applied Mechanics 41, 8 (2006), http://www.lania.mx/~emezura/util/files/tr_cec06.pdf

Arguments

Methods

Public methods

Method new()

Usage

COP$new(name, dimension)

Method clone()

The objects of this class are cloneable with this method.

Usage

COP$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code
# NOT RUN {
##creating an instance for G24 problem
G24<-COP$new("G24")

##initializing SACOBRA
cobra <- cobraInit(xStart=G24$lower, fName=G24$name,
                   fn=G24$fn,  
                   lower=G24$lower, upper=G24$upper, feval=25)
                   
## Run sacobra optimizer
cobra <- cobraPhaseII(cobra)

## The true solution is at solu = G24$solu
## The solution found by SACOBRA:
print(getXbest(cobra))
print(getFbest(cobra))                    
plot(abs(cobra$df$Best-G24$fn(G24$solu)[1]),log="y",type="l",
ylab="error",xlab="iteration",main=G24$name)


## creating an instance for G03 in 2-dimensional space
G03<-COP$new("G03",2)

## Initializing sacobra
cobra <- cobraInit(xStart=G03$lower, fn=G03$fn, 
fName=G03$name, lower=G03$lower, upper=G03$upper, feval=40)

# }

Run the code above in your browser using DataLab