Description Usage Arguments Details Value Note Examples

Transformation of a box/bound constrained region to an unconstrained one.

1 | ```
transfinite(lower, upper, n = length(lower))
``` |

`lower, upper` |
lower and upper box/bound constraints. |

`n` |
length of upper, lower if both are scalars, to which they get repeated. |

Transforms a constraint region in n-dimensional space bijectively to the
unconstrained *R^n* space, applying a `atanh`

resp. `exp`

transformation to each single variable that is bound constraint.

It provides two functions, `h: B = []x...x[] --> R^n`

and its inverse
`hinv`

. These functions can, for example, be used to add box/bound
constraints to a constrained optimization problem that is to be solved with
a (nonlinear) solver not allowing constraints.

Returns to functions as components `h`

and `hinv`

of a list.

Based on an idea of Ravi Varadhan, intrinsically used in his implementation of Nelder-Mead in the ‘dfoptim’ package.

For positivity constraints, `x>=0`

, this approach is considered to be
numerically more stable than `x-->exp(x)`

or `x-->x^2`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
lower <- c(-Inf, 0, 0)
upper <- c( Inf, 0.5, 1)
Tf <- transfinite(lower, upper)
h <- Tf$h; hinv <- Tf$hinv
## Not run:
## Solve Rosenbrock with one variable restricted
rosen <- function(x) {
n <- length(x)
x1 <- x[2:n]; x2 <- x[1:(n-1)]
sum(100*(x1-x2^2)^2 + (1-x2)^2)
}
f <- function(x) rosen(hinv(x)) # f must be defined on all of R^n
x0 <- c(0.1, 0.1, 0.1) # starting point not on the boundary!
nm <- nelder_mead(h(x0), f) # unconstraint Nelder-Mead
hinv(nm$xmin); nm$fmin # box/bound constraint solution
# [1] 0.7085596 0.5000000 0.2500004
# [1] 0.3353605
## End(Not run)
``` |

adagio documentation built on May 18, 2018, 1:08 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.