From a7cc7cc613a99139c62e6baab1015b1513c0e9e1 Mon Sep 17 00:00:00 2001
From: Stephan Hilb <stephan@ecshi.net>
Date: Sun, 7 Jan 2024 16:55:51 +0100
Subject: [PATCH] close connectors

---
 scripts/run_experiments.jl | 1 +
 src/common.jl              | 1 +
 src/dualtvdd.jl            | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/scripts/run_experiments.jl b/scripts/run_experiments.jl
index 6c4e7c7..148cf55 100644
--- a/scripts/run_experiments.jl
+++ b/scripts/run_experiments.jl
@@ -193,6 +193,7 @@ function run_while(fwhile, alg)
         k += 1
         step!(st)
     end
+    close(st)
     return st
 end
 
diff --git a/src/common.jl b/src/common.jl
index e5fe030..0748b6e 100644
--- a/src/common.jl
+++ b/src/common.jl
@@ -48,6 +48,7 @@ information to act as a checkpoint for continuing the algorithm at that point.
 abstract type State end
 
 function init end
+function Base.close(::State) end
 function step! end
 function fetch end
 
diff --git a/src/dualtvdd.jl b/src/dualtvdd.jl
index da47e60..2828d28 100644
--- a/src/dualtvdd.jl
+++ b/src/dualtvdd.jl
@@ -88,6 +88,10 @@ function init(alg::DualTVDDAlgorithm{<:DualTVL1ROFOpProblem})
     return DualTVDDState(alg, p, subax, cons)
 end
 
+function Base.close(st::DualTVDDState)
+    foreach(close, st.cons)
+end
+
 function intersectin(a, b)
     c = intersect(a, b)
     az = first(a) - one(eltype(a))
-- 
GitLab