Description Usage Arguments Value Details Examples
This function adds a constraint to a model. Models can only have one constraint per parameter. Running this function multiple times with the same model and parameter will replace the existing constraint.
1 | add_constraint_to_model(model, parameter, constraint_type, constraint)
|
model |
The model object for which the the constraint should be added |
parameter |
The name of the parameter for which the constraint will be added |
constraint_type |
The type of constraint to add, one of ("range", "vary", "variable_range") – see details |
constraint |
Either c(min, max) value or c(value, min, max) depending on constraint_type – see details |
A model object
There are 3 types of constraint currently implemented:
range: Allow the value of this parameter to vary between the 2 values given.
vary: Allow the value of this parameter to vary by this ammount since the previous scan
variable_range: Allow the value of this parameter to vary by this ammount since the previous scan, provided it remains within the range given.
Values of the constraint parameter are thus:
range: c(min, max)
vary: value
variable_range: c(value, min, max)
1 2 3 | add_constraint_to_model(model, "height", "range", c(0, 1))
add_constraint_to_model(model, "height", "vary", 0.5)
add_constraint_to_model(model, "height", "variable_range", c(0.5, 0, 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.