Parcourir la source

avoid train every modulo 0

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

+ 3 - 1
optimization/ILSPopSurrogate.py

@@ -322,11 +322,13 @@ class ILSPopSurrogate(Algorithm):
                 training_surrogate_every = int(r_squared * self._ls_train_surrogate)
                 print(f"=> R² of surrogate is of {r_squared}.")
                 print(f"=> MAE of surrogate is of {mae}.")
-                print(f'=> Retraining model every {training_surrogate_every} LS ({self._ls_local_search % training_surrogate_every} of {training_surrogate_every})')
+                
                 # avoid issue when lauching every each local search
                 if training_surrogate_every <= 0:
                     training_surrogate_every = 1
 
+                print(f'=> Retraining model every {training_surrogate_every} LS ({self._ls_local_search % training_surrogate_every} of {training_surrogate_every})')
+
 
                 # increase number of local search done
                 self._n_local_search += 1