# Constraints: Formulating Constraints In adoptr: Adaptive Optimal Two-Stage Designs in R

## Description

Conceptually, constraints work very similar to scores (any score can be put in a constraint). Currently, constraints of the form 'score <=/>= x', 'x <=/>= score' and 'score <=/>= score' are admissible.

## 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``` ```## S4 method for signature 'Constraint,TwoStageDesign' evaluate(s, design, optimization = FALSE, ...) ## S4 method for signature 'ConditionalScore,numeric' e1 <= e2 ## S4 method for signature 'ConditionalScore,numeric' e1 >= e2 ## S4 method for signature 'numeric,ConditionalScore' e1 <= e2 ## S4 method for signature 'numeric,ConditionalScore' e1 >= e2 ## S4 method for signature 'ConditionalScore,ConditionalScore' e1 <= e2 ## S4 method for signature 'ConditionalScore,ConditionalScore' e1 >= e2 ## S4 method for signature 'UnconditionalScore,numeric' e1 <= e2 ## S4 method for signature 'UnconditionalScore,numeric' e1 >= e2 ## S4 method for signature 'numeric,UnconditionalScore' e1 <= e2 ## S4 method for signature 'numeric,UnconditionalScore' e1 >= e2 ## S4 method for signature 'UnconditionalScore,UnconditionalScore' e1 <= e2 ## S4 method for signature 'UnconditionalScore,UnconditionalScore' e1 >= e2 ```

## Arguments

 `s` `Score` object `design` object `optimization` logical, if `TRUE` uses a relaxation to real parameters of the underlying design; used for smooth optimization. `...` further optional arguments `e1` left hand side (score or numeric) `e2` right hand side (score or numeric)

`minimize`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```design <- OneStageDesign(50, 1.96) cp <- ConditionalPower(Normal(), PointMassPrior(0.4, 1)) pow <- Power(Normal(), PointMassPrior(0.4, 1)) # unconditional power constraint constraint1 <- pow >= 0.8 evaluate(constraint1, design) # conditional power constraint constraint2 <- cp >= 0.7 evaluate(constraint2, design, .5) constraint3 <- 0.7 <= cp # same as constraint2 evaluate(constraint3, design, .5) ```