num_var declares a continuous variable, int_var an integer one, and
bin_var a binary one. With n greater than 1 the declaration is a vector
variable: x[3] indexes it, sum(x) folds it, arithmetic is elementwise,
and per-element bounds are given as vectors of length n. Solutions come
back keyed "x" for a scalar and "x[1]", "x[2]", ... for a vector.
Usage
num_var(m, name, lower = -Inf, upper = Inf, n = 1, start = 0)
int_var(m, name, lower = -Inf, upper = Inf, n = 1, start = 0)
bin_var(m, name, n = 1)
add_var(
m,
name,
lower = -Inf,
upper = Inf,
n = 1,
start = 0,
domain = c("num", "int", "bin")
)Arguments
- m
A
model().- name
The variable's name, unique within the model.
- lower, upper
Bounds;
-Inf/Infleave a direction unbounded. A vector of lengthnsets per-element bounds.- n
How many elements the variable has.
- start
The initial point handed to the solver.
- domain
For
add_var:"num","int"or"bin".