From 49177280593b29ebb478dd1fe7bdc00eeb70455e Mon Sep 17 00:00:00 2001 From: Michiel Cottaar <MichielCottaar@protonmail.com> Date: Sat, 25 May 2024 18:18:27 +0100 Subject: [PATCH] Skip variables that are always zero --- src/variables.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/variables.jl b/src/variables.jl index 52bc2db..39e87ef 100644 --- a/src/variables.jl +++ b/src/variables.jl @@ -12,7 +12,7 @@ In addition this defines: - [`gradient_orientation`](@ref): returns the gradient orientation of a waveform if fixed. """ module Variables -import JuMP: @constraint, @variable, Model, @objective, objective_function, AbstractJuMPScalar +import JuMP: @constraint, @variable, Model, @objective, objective_function, AbstractJuMPScalar, QuadExpr, AffExpr import StaticArrays: SVector import MacroTools import ..Scanners: gradient_strength, slew_rate, Scanner @@ -472,6 +472,9 @@ function scanner_constraints!(bb::AbstractBlock) continue end for v in value + if v isa Number || ((v isa Union{QuadExpr, AffExpr}) && length(v.terms) == 0) + continue + end @constraint global_model() v <= max_value @constraint global_model() v >= -max_value end -- GitLab