From 4be5f0ca4fcf95cbb024aec27856188db6e222a6 Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <MichielCottaar@protonmail.com> Date: Thu, 30 May 2024 11:35:02 +0100 Subject: [PATCH] Allow apply_simple_constraint! with nothing --- src/variables.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/variables.jl b/src/variables.jl index 39e87ef..eca69ad 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -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 -- GitLab