From f600c879e9aaf02f8e0a5ce29e25c9677638e7cf Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@protonmail.com>
Date: Tue, 30 Jul 2024 16:46:51 +0100
Subject: [PATCH] Ignore any constant additions to the cost function

---
 src/variables.jl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/variables.jl b/src/variables.jl
index b8d9b85..3e7cac0 100644
--- a/src/variables.jl
+++ b/src/variables.jl
@@ -465,10 +465,13 @@ which will generally only be optimised after any user-defined cost functions (wh
 
 Any sequence will also have a `level=3` cost function, which minimises the total sequence duration.
 """
-function add_cost_function!(func, level=2)
+function add_cost_function!(func::AbstractJuMPScalar, level=2)
     push!(GLOBAL_MODEL[][2], (Float64(level), func))
 end
 
+add_cost_function!(func::Number, level=2) = nothing
+
+
 """
     set_simple_constraints!(block, kwargs)
 
-- 
GitLab