Skip to contents

Turns a model or a program into the bytes that solve() sends. The same program always gives the same bytes, in whatever order its parts were built. solve() also accepts the bytes directly.

Usage

encode(prog)

Arguments

prog

A model() or a program().

Value

A raw vector.

Examples

m <- model()
x <- num_var(m, "x", lower = 0, upper = 4)
maximize(m, 3 * x)
bytes <- encode(m)
length(bytes)
#> [1] 70
identical(bytes, encode(as_program(m)))   # TRUE
#> [1] TRUE