# minimize: Find optimal two-stage design by constraint minimization In adoptr: Adaptive Optimal Two-Stage Designs in R

## Description

`minimize` takes an unconditional score and a constraint set (or no constraint) and solves the corresponding minimization problem using `nloptr` (using COBYLA by default). An initial design has to be defined. It is also possible to define lower- and upper-boundary designs. If this is not done, the boundaries are determined automatically heuristically.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```minimize( objective, subject_to, initial_design, lower_boundary_design = get_lower_boundary_design(initial_design), upper_boundary_design = get_upper_boundary_design(initial_design), opts = list(algorithm = "NLOPT_LN_COBYLA", xtol_rel = 1e-05, maxeval = 10000), ... ) ```

## Arguments

 `objective` objective function `subject_to` constraint collection `initial_design` initial guess (x0 for nloptr) `lower_boundary_design` design specifying the lower boundary. `upper_boundary_design` design specifying the upper boundary `opts` options list passed to nloptr `...` further optional arguments passed to `nloptr`

## Value

a list with elements:

 `design` The resulting optimal design `nloptr_return` Output of the corresponding nloptr call `call_args` The arguments given to the optimization call

## 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``` ```# Define Type one error rate toer <- Power(Normal(), PointMassPrior(0.0, 1)) # Define Power at delta = 0.4 pow <- Power(Normal(), PointMassPrior(0.4, 1)) # Define expected sample size at delta = 0.4 ess <- ExpectedSampleSize(Normal(), PointMassPrior(0.4, 1)) # Compute design minimizing ess subject to power and toer constraints ## Not run: minimize( ess, subject_to( toer <= 0.025, pow >= 0.9 ), initial_design = TwoStageDesign(50, .0, 2.0, 60.0, 2.0, 5L) ) ## End(Not run) ```

adoptr documentation built on June 28, 2021, 5:11 p.m.