Parcourir la source

restart algorithm using loading of best obtained solutions

Jérôme BUISINE il y a 3 ans
Parent
commit
8552bd5117
2 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. 5 3
      optimization/ILSSurrogate.py
  2. 0 1
      optimization/LSSurrogate.py

+ 5 - 3
optimization/ILSSurrogate.py

@@ -140,12 +140,12 @@ class ILSSurrogate(Algorithm):
         # by default use of mother method to initialize variables
         super().run(_evaluations)
 
-        # enable resuming for ILS
-        self.resume()
-
         # initialize current solution
         self.initRun()
 
+        # enable resuming for ILS
+        self.resume()
+
         if self.start_train_surrogate > self.getGlobalEvaluation():
         
             # get `self.start_train_surrogate` number of real evaluations and save it into surrogate dataset file
@@ -207,6 +207,8 @@ class ILSSurrogate(Algorithm):
 
                 self.add_to_surrogate(newSolution)
 
+                self.progress()
+
             # check if necessary or not to train again surrogate
             if self.n_local_search % self.ls_train_surrogate == 0 and self.start_train_surrogate < self.getGlobalEvaluation():
 

+ 0 - 1
optimization/LSSurrogate.py

@@ -59,7 +59,6 @@ class LocalSearchSurrogate(Algorithm):
                 # increase number of evaluations
                 self.increaseEvaluation()
 
-                self.progress()
                 logging.info("---- Current %s - SCORE %s" %
                              (newSolution, newSolution.fitness()))