File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -429,7 +429,10 @@ where
429429 self . total_evaluations = self . islands . iter ( ) . map ( |i| i. evaluations ) . sum ( ) ;
430430
431431 // Migration
432- if self . generation % self . config . migration_interval == 0 {
432+ if self
433+ . generation
434+ . is_multiple_of ( self . config . migration_interval )
435+ {
433436 self . migrate ( rng) ;
434437 }
435438
Original file line number Diff line number Diff line change @@ -512,7 +512,7 @@ where
512512 step_count += 1 ;
513513
514514 // Record statistics at generation boundaries
515- if step_count % self . config . steps_per_generation == 0 {
515+ if step_count. is_multiple_of ( self . config . steps_per_generation ) {
516516 generation += 1 ;
517517 population. set_generation ( generation) ;
518518
@@ -677,7 +677,7 @@ where
677677 step_count += 1 ;
678678
679679 // Record statistics at generation boundaries
680- if step_count % self . config . steps_per_generation == 0 {
680+ if step_count. is_multiple_of ( self . config . steps_per_generation ) {
681681 generation += 1 ;
682682 population. set_generation ( generation) ;
683683
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ impl CheckpointManager {
255255
256256 /// Check if a checkpoint should be saved at this generation
257257 pub fn should_save ( & self , generation : usize ) -> bool {
258- generation > 0 && generation % self . interval == 0
258+ generation > 0 && generation. is_multiple_of ( self . interval )
259259 }
260260
261261 /// Get the path for the current checkpoint
You can’t perform that action at this time.
0 commit comments