Parcourir la source

Reinit with value 0 and change when increment is done

Jérôme BUISINE il y a 3 ans
Parent
commit
46eacca0cd
1 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 4
      optimization/ILSPopSurrogate.py

+ 5 - 4
optimization/ILSPopSurrogate.py

@@ -327,6 +327,11 @@ class ILSPopSurrogate(Algorithm):
                 if training_surrogate_every <= 0:
                     training_surrogate_every = 1
 
+
+                # increase number of local search done
+                self._n_local_search += 1
+                self._ls_local_search += 1
+
                 # check if necessary or not to train again surrogate
                 if self._ls_local_search % training_surrogate_every == 0 and self._start_train_surrogate <= self.getGlobalEvaluation():
 
@@ -343,10 +348,6 @@ class ILSPopSurrogate(Algorithm):
                     # reinit ls search
                     self._ls_local_search = 0
 
-                # increase number of local search done
-                self._n_local_search += 1
-                self._ls_local_search += 1
-
                 self.information()
 
         logging.info(f"End of {type(self).__name__}, best solution found {self._bestSolution}")