Spaces:
Running
Running
Commit
·
941b663
1
Parent(s):
58f63a3
Fix potential problem with copying reference
Browse files
eureqa.jl
CHANGED
|
@@ -366,7 +366,7 @@ function iterate(
|
|
| 366 |
probChange = exp(-delta/(T*alpha))
|
| 367 |
|
| 368 |
if isnan(afterLoss) || probChange < rand()
|
| 369 |
-
return prev
|
| 370 |
end
|
| 371 |
end
|
| 372 |
|
|
@@ -409,7 +409,7 @@ end
|
|
| 409 |
# Sample 10 random members of the population, and make a new one
|
| 410 |
function samplePop(pop::Population)::Population
|
| 411 |
idx = rand(1:pop.n, ns)
|
| 412 |
-
return Population(pop.members[idx])
|
| 413 |
end
|
| 414 |
|
| 415 |
# Sample the population, and get the best member from that sample
|
|
|
|
| 366 |
probChange = exp(-delta/(T*alpha))
|
| 367 |
|
| 368 |
if isnan(afterLoss) || probChange < rand()
|
| 369 |
+
return deepcopy(prev)
|
| 370 |
end
|
| 371 |
end
|
| 372 |
|
|
|
|
| 409 |
# Sample 10 random members of the population, and make a new one
|
| 410 |
function samplePop(pop::Population)::Population
|
| 411 |
idx = rand(1:pop.n, ns)
|
| 412 |
+
return Population(pop.members[idx])
|
| 413 |
end
|
| 414 |
|
| 415 |
# Sample the population, and get the best member from that sample
|