Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add method to free all variables at once.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 14 Jun 2019 20:21:00 +0000 (22:21 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 14 Jun 2019 20:23:31 +0000 (22:23 +0200)
src/kernel/lmm/maxmin.cpp
src/kernel/lmm/maxmin.hpp

index 06822fd..05bf4b7 100644 (file)
@@ -224,6 +224,13 @@ void System::variable_free(Variable* var)
   var_free(var);
 }
 
+void System::variable_free_all()
+{
+  Variable* var;
+  while ((var = extract_variable()))
+    variable_free(var);
+}
+
 void System::expand(Constraint* cnst, Variable* var, double consumption_weight)
 {
   modified_ = true;
index a7b7298..dab8763 100644 (file)
@@ -409,6 +409,9 @@ public:
    */
   void variable_free(Variable * var);
 
+  /** @brief Free all variables */
+  void variable_free_all();
+
   /**
    * @brief Associate a variable to a constraint with a coefficient
    * @param cnst A constraint