View source: R/algorithms_2sided.R
rnabox | R Documentation |
An internal function that implements the RNABOX
algorithm that solves the
following optimal allocation problem, formulated below in the language of
mathematical optimization.
Minimize
f(x_1,\ldots,x_H) = \sum_{h=1}^H \frac{A^2_h}{x_h}
subject to
\sum_{h=1}^H x_h = n
m_h \leq x_h \leq M_h, \quad h = 1,\ldots,H,
where n > 0,\, A_h > 0,\, m_h > 0,\, M_h > 0
, such that
m_h < M_h,\, h = 1,\ldots,H
, and
\sum_{h=1}^H m_h \leq n \leq \sum_{h=1}^H M_h
, are given numbers.
The minimization is on \mathbb R_+^H
.
Inequality constraints are optional and can be skipped.
rnabox()
function should not be called directly by the user. Use opt()
instead.
rnabox(
n,
A,
bounds1 = NULL,
bounds2 = NULL,
check_violations1 = .Primitive(">="),
check_violations2 = .Primitive("<=")
)
n |
( |
A |
( |
bounds1 |
( |
bounds2 |
( |
check_violations1 |
( |
check_violations2 |
( |
Numeric vector with optimal sample allocations in strata.
To be added soon.
opt()
, optcost()
, sga()
, sgaplus()
, coma()
.
N <- c(454, 10, 116, 2500, 2240, 260, 39, 3000, 2500, 400)
S <- c(0.9, 5000, 32, 0.1, 3, 5, 300, 13, 20, 7)
A <- N * S
m <- c(322, 3, 57, 207, 715, 121, 9, 1246, 1095, 294) # lower bounds
M <- N # upper bounds
# Regular allocation.
n <- 6000
opt_regular <- rnabox(n, A, M, m)
# Vertex allocation.
n <- 4076
opt_vertex <- rnabox(n, A, M, m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.