Skip to content
Snippets Groups Projects
Unverified Commit 4be5f0ca authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Allow apply_simple_constraint! with nothing

parent fe33a03b
No related branches found
No related tags found
1 merge request!2Define variables through new @defvar macro
Pipeline #24149 failed
......@@ -423,6 +423,8 @@ Add a single constraint or objective to the `variable`.
- `equation`: fix variable to the result of this equation
"""
apply_simple_constraint!(variable::AbstractVector, value::Symbol) = apply_simple_constraint!(sum(variable), Val(value))
apply_simple_constraint!(variable, value::Nothing) = nothing
apply_simple_constraint!(variable::NamedTuple, value::Nothing) = nothing
apply_simple_constraint!(variable::VariableType, value::Symbol) = apply_simple_constraint!(variable, Val(value))
apply_simple_constraint!(variable::VariableType, ::Val{:min}) = @objective global_model() Min objective_function(global_model()) + variable
apply_simple_constraint!(variable::VariableType, ::Val{:max}) = @objective global_model() Min objective_function(global_model()) - variable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment