View source: R/121_constraints_constraint.R
| set_label | R Documentation |
Attaches a human-readable label to a constraint for use in visualizations and pretty-printing. Labels are visualization-only and never affect the solver pipeline.
set_label(constraint, label)
constraint |
A |
label |
A character string label. |
Because R uses copy-on-modify semantics, you must either assign the
result back or use set_label fluently when building constraint
lists.
The modified constraint (invisibly).
## Not run:
x <- Variable(3, name = "x")
# Assign back
con <- (x >= 0)
con <- set_label(con, "non-negativity")
# Fluent use in constraint lists
constraints <- list(
set_label(x >= 1, "lower bound"),
set_label(sum_entries(x) <= 10, "budget")
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.