Skip to content
Snippets Groups Projects
Verified Commit cfff62e6 authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

apply constraints to NamedTuple variables

parent 65d76dcc
No related branches found
No related tags found
No related merge requests found
......@@ -328,6 +328,11 @@ apply_simple_constraint!(variable, ::Val{:max}) = @objective global_model() Min
apply_simple_constraint!(variable, value::VariableType) = @constraint global_model() variable == value
apply_simple_constraint!(variable::AbstractVector, value::AbstractVector) = [apply_simple_constraint!(v1, v2) for (v1, v2) in zip(variable, value)]
apply_simple_constraint!(variable::Number, value::Number) = @assert variable value "Variable set to multiple incompatible values."
function apply_simple_constraint!(variable::NamedTuple, value::NamedTuple)
for key in keys(value)
apply_simple_constraint!(variable[key], value[key])
end
end
"""
......
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