build_constraints {cgaim}R Documentation

Common constraints

Description

Build a constraint matrix from common simple constraints. Internally used by g to construct index-specific constraint matrices.

Usage

build_constraints(p, first = 0, sign = 0, monotone = 0, convex = 0)

Arguments

p

The number of variables.

first

Indicates sign constraint for first coefficient. Recommended for identifiability if no other constraint is passed.

sign

Sign constraint applied to all coefficients. 0: no constraint,

monotone

Monotonicity constraint. 0: no constraint, -1: decreasing coefficients and 1: increasing coefficients.

convex

Convexity constraint. 0: no constraint, -1: convex coefficients and 1: concave coefficients.

Details

For monotonicity and convexity / concavity, the function assumes the coefficients are ordered. For instance, for increasing monotone coefficients, the first one will be lower than the second, which be lower than the third and so on.

The function automatically removes redundant constraints. For instance, if both sign = 1 and monotone = 1, then only the sign constraint on the first variable is kept as others are not needed.

Note that, for all arguments, any number can be passed to the function. In which case, the sign of the argument is used. Therefore passing monotone = 3.14 is the same as passing monotone = 1.

Value

A p-column constraint matrix.

Examples

# By default, produces only the identifiability constraint
build_constraints(4)

# Positive and increasing coefficients
build_constraints(4, sign = 1, monotone = 1)

# Concavity constraint
build_constraints(7, convex = -1)

# Any numeric can be passed to the function
build_constraints(5, monotone = pi)


[Package cgaim version 1.0.1 Index]