From c607ca8d0433bc654159b4c3ebf03ba2cde936c6 Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk> Date: Wed, 21 Feb 2024 14:01:22 +0000 Subject: [PATCH] Allow setting :min/:max on vectors --- src/variables.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/variables.jl b/src/variables.jl index fdbbdd1..8ff7409 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -322,6 +322,7 @@ Add a single constraint or objective to the `variable`. - `equation`: fix variable to the result of this equation """ apply_simple_constraint!(variable, ::Nothing) = nothing +apply_simple_constraint!(variable::AbstractVector, value::Symbol) = apply_simple_constraint!(sum(variable), Val(value)) apply_simple_constraint!(variable, value::Symbol) = apply_simple_constraint!(variable, Val(value)) apply_simple_constraint!(variable, ::Val{:min}) = @objective global_model() Min objective_function(global_model()) + variable apply_simple_constraint!(variable, ::Val{:max}) = @objective global_model() Min objective_function(global_model()) - variable -- GitLab