MilesCranmer commited on
Commit
7d1a81e
1 Parent(s): 29eb327

Fix rounding of floats

Browse files
Files changed (1) hide show
  1. eureqa.jl +3 -3
eureqa.jl CHANGED
@@ -439,7 +439,7 @@ end
439
  function regEvolCycle(
440
  pop::Population, T::Float32;
441
  annealing::Bool=true)::Population
442
- for i=1:Integer(pop.n/ns)
443
  baby = iterateSample(pop, T, annealing=annealing)
444
  #printTree(baby.tree)
445
  oldest = argmin([pop.members[member].birth for member=1:pop.n])
@@ -611,7 +611,7 @@ function fullRun(niterations::Integer;
611
  # Migration
612
  if migration
613
  for j=1:nthreads
614
- for k in rand(1:npop, Integer(npop*fractionReplaced))
615
  # Copy in case one gets used twice
616
  allPops[j].members[k] = deepcopy(bestPops.members[rand(1:size(bestPops.members)[1])])
617
  end
@@ -621,7 +621,7 @@ function fullRun(niterations::Integer;
621
  # Hall of fame migration
622
  if hofMigration && size(dominating)[1] > 0
623
  for j=1:nthreads
624
- for k in rand(1:npop, Integer(npop*fractionReplacedHof))
625
  # Copy in case one gets used twice
626
  allPops[j].members[k] = deepcopy(dominating[rand(1:size(dominating)[1])])
627
  end
 
439
  function regEvolCycle(
440
  pop::Population, T::Float32;
441
  annealing::Bool=true)::Population
442
+ for i=1:round(Integer, pop.n/ns)
443
  baby = iterateSample(pop, T, annealing=annealing)
444
  #printTree(baby.tree)
445
  oldest = argmin([pop.members[member].birth for member=1:pop.n])
 
611
  # Migration
612
  if migration
613
  for j=1:nthreads
614
+ for k in rand(1:npop, round(Integer, npop*fractionReplaced))
615
  # Copy in case one gets used twice
616
  allPops[j].members[k] = deepcopy(bestPops.members[rand(1:size(bestPops.members)[1])])
617
  end
 
621
  # Hall of fame migration
622
  if hofMigration && size(dominating)[1] > 0
623
  for j=1:nthreads
624
+ for k in rand(1:npop, round(Integer, npop*fractionReplacedHof))
625
  # Copy in case one gets used twice
626
  allPops[j].members[k] = deepcopy(dominating[rand(1:size(dominating)[1])])
627
  end