浏览代码

train surrogate before starting ILS

Jérôme BUISINE 4 年之前
父节点
当前提交
1f1c3485a6
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      optimization/ILSSurrogate.py

+ 3 - 2
optimization/ILSSurrogate.py

@@ -144,8 +144,7 @@ class ILSSurrogate(Algorithm):
         self.resume()
 
         if self.start_train_surrogate <= self.getGlobalEvaluation():
-            self.load_surrogate()
-        else:
+        
             # get `self.start_train_surrogate` number of real evaluations and save it into surrogate dataset file
             # using randomly generated solutions (in order to cover seearch space)
             while self.start_train_surrogate <= self.getGlobalEvaluation():
@@ -159,6 +158,8 @@ class ILSSurrogate(Algorithm):
                 self.add_to_surrogate(newSolution)
 
                 self.increaseEvaluation()
+        
+        self.load_surrogate()
 
         # initialize current solution
         self.initRun()