Browse Source

Reinit with value 0 and change when increment is done

Jérôme BUISINE 1 year ago
parent
commit
46eacca0cd
1 changed files with 5 additions and 4 deletions
  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}")