TA.info: Threshold-Accepting Information

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

Description

The function can be called from the objective and neighbourhood function during a run of TAopt; it provides information such as the current iteration, the current solution, etc.

Usage

1
  TA.info(n = 0L)

Arguments

n

generational offset; see Details.

Details

This function is still experimental.

The function can be called in the neighbourhood function or the objective function during a run of TAopt. It evaluates to a list with the state of the optimisation run, such as the current iteration.

TA.info relies on parent.frame to retrieve its information. If the function is called within another function in the neighbourhood or objective function, the argument n needs to be increased.

Value

A list

OF.sampling

logical: if TRUE, is the algorithm sampling the objective function to compute thresholds; otherwise (i.e. during the actual optimisation) FALSE

iteration

current iteration

step

current step (i.e. for a given threshold)

threshold

current threshold (the number, not the value)

xbest

the best solution found so far

Author(s)

Enrico Schumann

References

Gilli, M., Maringer, D. and Schumann, E. (2011) Numerical Methods and Optimization in Finance. Elsevier. http://www.elsevierdirect.com/product.jsp?isbn=9780123756626

Schumann, E. (2016) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual

See Also

TAopt

Examples

 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
### MINIMAL EXAMPLE for TAopt

## objective function evaluates to a constant
fun <- function(x)
    0

## neighbourhood function does not even change the solution,
## but it reports information
nb <- function(x) {
    tmp <- TA.info()
    cat("current threshold ",   tmp$threshold,
        "| current step ",      tmp$step,
        "| current iteration ", tmp$iteration, "\n")
    x
}

## run TA
algo <- list(nS = 5,
             nT = 2,
             nD = 3,
             x0 = rep(0, 5),
             neighbour = nb,
             printBar = FALSE,
             printDetail = FALSE)
ignore <- TAopt(fun, algo)

## printed output:
##    current threshold  NA | current step  1 | current iteration  NA 
##    current threshold  NA | current step  2 | current iteration  NA 
##    current threshold  NA | current step  3 | current iteration  NA 
##    current threshold   1 | current step  1 | current iteration  1 
##    current threshold   1 | current step  2 | current iteration  2 
##    current threshold   1 | current step  3 | current iteration  3 
##    current threshold   1 | current step  4 | current iteration  4 
##    current threshold   1 | current step  5 | current iteration  5 
##    current threshold   2 | current step  1 | current iteration  6 
##    current threshold   2 | current step  2 | current iteration  7 
##    current threshold   2 | current step  3 | current iteration  8 
##    current threshold   2 | current step  4 | current iteration  9 
##    current threshold   2 | current step  5 | current iteration  10 

enricoschumann/NMOF documentation built on June 5, 2019, 8:56 a.m.