瀏覽代碼

Reinit with value 0 and change when increment is done

Jérôme BUISINE 3 年之前
父節點
當前提交
46eacca0cd
共有 1 個文件被更改,包括 5 次插入4 次删除
  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}")