From efb5b6545176e6e8ec3706fabff4fa5e09f4c6e9 Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <MichielCottaar@protonmail.com>
Date: Wed, 11 Sep 2024 16:45:36 +0100
Subject: [PATCH] Check optimiser values have been correctly set

---
 src/build_sequences.jl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/build_sequences.jl b/src/build_sequences.jl
index 6a4b1f6..9afde5b 100644
--- a/src/build_sequences.jl
+++ b/src/build_sequences.jl
@@ -151,6 +151,7 @@ function optimise_with_cost_func!(jump_model::Model, cost_func, n_attempts)
         error("Optimisation failed to converge. The following errors were raised: $err_string. Example errors for each type are printed above.")
     end
     backend(jump_model).optimizer.model.inner.x .= min_values
+    @assert value(cost_func) == min_objective
 end
 
 function build_sequence(f::Function, scanner::Union{Nothing, Scanner}=Default_Scanner; optimise=true, n_attempts=20, print_level=0, mu_strategy="adaptive", max_iter=1000, kwargs...)
-- 
GitLab