constrain: constrain

Description Usage Arguments Author(s) Examples

Description

Make a constraint list. Write each constraint as c_1 v_1 + ... + c_n v_n (in)equality constant, where c_i are real coefficients and v_i are optimization variables.

Usage

1
constrain(equality, constant, ...)

Arguments

equality

"eq" or "geq" designating whether this is an equality or an inequality constraint.

constant

constant on the right side of the inequality.

...

Variables to include in this constraint, usually using something like variable("xi",i,j,-1).

Author(s)

Toby Dylan Hocking

Examples

1
2
3
4
5
6
7
constraints <- list()
for(i in 1:3){
  constraints <-
    c(constraints,list(constrain("geq",0,variable("xi",i))))
}

lapply(1:3,function(i)constrain("geq",0,variable("xi",i)))

quadmod documentation built on Aug. 18, 2017, 3 a.m.