cobraInit: Initial phase for SACOBRA optimizer

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/cobraInit.R

Description

In this phase the important parameters are set and the initial design population are evaluated on the real function. The problem to solve is:

\mbox{Minimize}\quad f(\vec{x}) , \vec{x} \in [\vec{a},\vec{b}] \subset \mathbf{R}^d

\mbox{subject to}\quad g_i(\vec{x}) ≤ 0, i=1,…,m

\mbox{~~~~~~~~~~}\quad\quad h_j(\vec{x}) = 0, j=1,…,r.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
cobraInit(
  xStart,
  fn,
  fName,
  lower,
  upper,
  feval,
  initDesign = "LHS",
  initDesPoints = 2 * length(xStart) + 1,
  initDesOptP = NULL,
  initBias = 0.005,
  skipPhaseI = TRUE,
  seqOptimizer = "COBYLA",
  seqFeval = 1000,
  seqTol = 1e-06,
  ptail = TRUE,
  squares = TRUE,
  conTol = 0,
  DOSAC = 1,
  sac = defaultSAC(DOSAC),
  repairInfeas = FALSE,
  ri = defaultRI(),
  RBFmodel = "cubic",
  RBFwidth = -1,
  GaussRule = "One",
  widthFactor = 1,
  RBFrho = 0,
  MS = defaultMS(),
  equHandle = defaultEquMu(),
  rescale = TRUE,
  newlower = -1,
  newupper = 1,
  XI = DRCL,
  TrustRegion = FALSE,
  TRlist = defaultTR(),
  conditioningAnalysis = defaultCA(),
  penaF = c(3, 1.7, 3e+05),
  sigmaD = c(3, 2, 100),
  constraintHandling = "DEFAULT",
  verbose = 1,
  verboseIter = 10,
  DEBUG_RBF = defaultDebugRBF(),
  DEBUG_TR = FALSE,
  DEBUG_TRU = FALSE,
  DEBUG_RS = FALSE,
  DEBUG_XI = FALSE,
  trueFuncForSurrogates = FALSE,
  saveIntermediate = FALSE,
  saveSurrogates = FALSE,
  epsilonInit = NULL,
  epsilonMax = NULL,
  solu = NULL,
  cobraSeed = 42
)

Arguments

xStart

a vector of dimension d containing the starting point for the optimization problem

fn

objective and constraint functions: fn is a function accepting a d-dimensional vector \vec{x} and returning an (1+m+r)-dimensional vector c(f,g_1,…,g_m,h_1,…,h_r)

fName

the results of cobraPhaseII are saved to <fname>.Rdata

lower

lower bound \vec{a} of search space, same dimension as xStart

upper

upper bound \vec{b} of search space, same dimension as xStart

feval

maximum number of function evaluations

initDesign

["LHS"] one out of ["RANDOM","LHS","BIASED","OPTIMIZED","OPTBIASED"]

initDesPoints

[2*d+1] number of initial points, must be smaller than feval

initDesOptP

[NULL] only for initDesign=="OPTBIASED": number of points for the "OPT" phase. If NULL, take initDesPoints.

initBias

[0.005] bias for normal distribution in "OPTBIASED" and "BIASED"

skipPhaseI

[TRUE] if TRUE, then skip cobraPhaseI

seqOptimizer

["COBYLA"] string defining the optimization method for COBRA phases I and II, one out of ["COBYLA","ISRES","HJKB","NMKB","ISRESCOBY"]

seqFeval

[1000] maximum number of function evaluations on the surrogate model

seqTol

[1e-6] convergence tolerance for sequential optimizer, see param tol in nmkb or param control$xtol_rel in cobyla

ptail

[TRUE] TRUE: with, FALSE: without polynomial tail in trainRBF

squares

[TRUE] set to TRUE for including the second order polynomials in building the fitness and constraint surrogates in trainRBF

conTol

[0.0] constraint violation tolerance

DOSAC

[1] set one out of [0|1|2].
0: COBRA-R settings,
1: SACOBRA settings,
2: SACOBRA settings with fewer parameters.
The precise settings are documented in defaultSAC.

sac

[defaultSAC(DOSAC)] list with other parameters for SACOBRA.

repairInfeas

[FALSE] if TRUE, trigger the repair of appropriate infeasible solutions

ri

[defaultRI()] list with other parameters for repairInfeasRI2

RBFmodel

["cubic"] a string for the type of the RBF model, "cubic", "Gaussian" or "MQ"

RBFwidth

[-1] only relevant for Gaussian RBF model. Determines the width σ. For more details see parameter width in trainGaussRBF in RBFinter.R.

GaussRule

["One"] only relevant for Gaussian RBF model, see trainGaussRBF

widthFactor

[1.0] only relevant for Gaussian RBF model. Additional constant factor applied to each width σ

RBFrho

[0.0] experimental: 0: interpolating, > 0, approximating (spline-like) Gaussian RBFs

MS

[defaultMS()] list of online model selection parameters described in defaultMS. If MS$active = TRUE then the type of RBF models for each function will be selected automatically and the RBFmodel parameter becomes irrelevant.

equHandle

[defaultEquMu()] list with of parameters for equality constraint handling described in defaultEquMu(). equHandle$active is set to TRUE by default.

rescale

[TRUE] if TRUE, transform the input space from [lower,upper] to hypercube [newlower,newupper]^d

newlower

[-1] lower bound of each rescaled input space dimension, if rescale==TRUE

newupper

[+1] upper bound of each rescaled input space dimension, if rescale==TRUE

XI

[DRCL] magic parameters for the distance requirement cycle (DRC)

TrustRegion

[FALSE] if TRUE, perform trust region algorithm trustRegion.

TRlist

[defaultTR()] a list of parameters, needed only in case TrustRegion==TRUE.

conditioningAnalysis

[defaultCA()] A list with setting for the objective function conditioning analysis and online whitening

penaF

[c(3,1.7,3e5)] parameters for dynamic penalty factor (fct subProb in cobraPhaseII): c(start,augment,max), only relevant if seqOptimizer==HJKB or seqOptimizer==NMKB

sigmaD

[c(3,2.0,100)] parameters for dynamic distance factor (fct subProb in cobraPhaseII): c(start,augment,max), , only relevant if seqOptimizer==HJKB or seqOptimizer==NMKB

constraintHandling

["DEFAULT"] (other choices: "JOINESHOUCK", "SMITHTATE", "COIT", "BAECKKHURI"; experimental, only relevant if seqOptimizer==HJKB or seqOptimizer==NMKB see the code in function subProb in cobraPhaseII)

verbose

[1] set one out of [0|1|2], how much output to print

verboseIter

[10] an interegr value. Printing the summarized results after each verboseIter iterations.

DEBUG_RBF

[defaultDebugRBF()] list with settings for visualization RBF (only for d==2)

DEBUG_TR

[FALSE] prints information about trust region status and visualisation for d==2 (coming soon)

DEBUG_TRU

[FALSE] visualize trust-region RBF (only for dimension==2)

DEBUG_RS

[FALSE] prints the RS probability in each iteration in the console

DEBUG_XI

[FALSE] if TRUE, then print in cobraPhaseII extra debug information: xStart in every iteration to console and add some extra debug columns to cobra$df

trueFuncForSurrogates

[FALSE] if TRUE, use the true (constraint & fitness) functions instead of surrogates (only for debug analysis)

saveIntermediate

[FALSE] if TRUE, then cobraPhaseII saves intermediate results in dir 'results/' (create it, if necessary)

saveSurrogates

[FALSE] if TRUE, then cobraPhaseII returns the last surrogate models in cobra$fitnessSurrogate and cobra$constraintSurrogates

epsilonInit

[NULL] initial constant added to each constraint to maintain a certain margin to boundary

epsilonMax

[NULL] maximum for constant added to each constraint

solu

[NULL] the best-known solution (only for diagnostics). This is normally a vector of length d. If there are multiple solutions, it is a matrix with d columns (each row is a solution). If NULL, then the current best point will be used in cobraPhaseII. solu is given in original input space.

cobraSeed

[42] seed for random number generator

Details

If epsilonInit or epsilonMax are NULL on input, then cobra$epsilonInit and cobra$epsilonMax, resp., are set to 0.005*l where l is the smallest side of the search box.

Note that the parameters penaF, sigmaD, constraintHandling are only relevant for penalty-based internal optimizers nmkb or HJKB. They are NOT relevant for default optimizer cobyla.

Although the software was originally designed to handle only constrained optimization problems, it can also address unconstrained optimization problems

How to code which constraint is equality constraint? - Function fn should return an (1+m+r)-dimensional vector with named elements. The first element is the objective, the other elements are the constraints. All equality constraints should carry the name equ. (Yes, it is possible that multiple elements of a vector have the same name.)

Value

cobra, an object of class COBRA, this is a (long) list containing most of the argument settings (see above) and in addition (among others):

A

(feval x dim)-matrix containing the initial design points in input . space. If rescale==TRUE, all points are in rescaled input space.

Fres

a vector of the objective values of the initial design points

Gres

a matrix of the constraint values of the initial design points

nConstraints

the total number m+r of constraints

Tfeas

the threshhold parameter for the number of consecutive iterations that yield feasible solutions before margin epsilon is reduced

Tinfeas

the threshhold parameter for the number of consecutive iterations that yield infeasible solutions before margin epsilon is increased

numViol

number of constraint violations

maxViol

maximum constraint violation

trueMaxViol

maximum constraint violation

trustregX

A vector of all refined solutions generated by trust region algorithm (see trustRegion)

Note that cobra$Fres, cobra$fbest, cobra$fbestArray and similar contain always the objective values of the orignial function cobra$fn[1]. (The surrogate models may be trained on a plog-transformed version of this function.)

Author(s)

Wolfgang Konen, Samineh Bagheri, Patrick Koch, Cologne University of Applied Sciences

See Also

startCobra, cobraPhaseI, cobraPhaseII

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Initialize cobra. The problem to solve is the sphere function sum(x^2)    
## with the equality constraint that the solution is on a circle with 
## radius 2 and center at c(1,0).
d=2
fName="onCircle"
cobra <- cobraInit(xStart=rep(5,d), fName=fName,
                   fn=function(x){c(obj=sum(x^2),equ=(x[1]-1)^2+(x[2]-0)^2-4)},  
                   lower=rep(-10,d), upper=rep(10,d), feval=40)
                   
## Run sacobra optimizer
cobra <- cobraPhaseII(cobra)

## The true solution is at solu = c(-1,0) (the point on the circle closest 
## to the origin) where the true optimum is fn(solu)[1] = optim = 1
## The solution found by SACOBRA:
print(getXbest(cobra))
print(getFbest(cobra))

## Plot the resulting error (best-so-far feasible optimizer result - true optimum)
## on a logarithmic scale:
optim = 1
plot(abs(cobra$df$Best-optim),log="y",type="l",ylab="error",xlab="iteration",main=fName)

SACOBRA documentation built on March 26, 2020, 7:15 p.m.