Spaces:
Sleeping
Sleeping
Commit
·
92088a8
1
Parent(s):
7e735f6
Print speed of processing
Browse files- julia/sr.jl +29 -6
julia/sr.jl
CHANGED
|
@@ -762,6 +762,11 @@ function fullRun(niterations::Integer;
|
|
| 762 |
end
|
| 763 |
println("Started!")
|
| 764 |
cycles_complete = nprocs * 10
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 765 |
while cycles_complete > 0
|
| 766 |
for i=1:nprocs
|
| 767 |
if isready(allPops[i])
|
|
@@ -782,10 +787,6 @@ function fullRun(niterations::Integer;
|
|
| 782 |
# Dominating pareto curve - must be better than all simpler equations
|
| 783 |
dominating = PopMember[]
|
| 784 |
open(hofFile, "w") do io
|
| 785 |
-
debug(verbosity, "\n")
|
| 786 |
-
debug(verbosity, "Hall of Fame:")
|
| 787 |
-
debug(verbosity, "-----------------------------------------")
|
| 788 |
-
debug(verbosity, "Complexity \t MSE \t Equation")
|
| 789 |
println(io,"Complexity|MSE|Equation")
|
| 790 |
for size=1:actualMaxsize
|
| 791 |
if hallOfFame.exists[size]
|
|
@@ -794,13 +795,11 @@ function fullRun(niterations::Integer;
|
|
| 794 |
numberSmallerAndBetter = sum([curMSE > MSE(evalTreeArray(hallOfFame.members[i].tree), y) for i=1:(size-1)])
|
| 795 |
betterThanAllSmaller = (numberSmallerAndBetter == 0)
|
| 796 |
if betterThanAllSmaller
|
| 797 |
-
debug(verbosity, "$size \t $(curMSE) \t $(stringTree(member.tree))")
|
| 798 |
println(io, "$size|$(curMSE)|$(stringTree(member.tree))")
|
| 799 |
push!(dominating, member)
|
| 800 |
end
|
| 801 |
end
|
| 802 |
end
|
| 803 |
-
debug(verbosity, "")
|
| 804 |
end
|
| 805 |
|
| 806 |
# Try normal copy otherwise.
|
|
@@ -838,9 +837,33 @@ function fullRun(niterations::Integer;
|
|
| 838 |
end
|
| 839 |
|
| 840 |
cycles_complete -= 1
|
|
|
|
| 841 |
end
|
| 842 |
end
|
| 843 |
sleep(1e-3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 844 |
end
|
| 845 |
end
|
| 846 |
|
|
|
|
| 762 |
end
|
| 763 |
println("Started!")
|
| 764 |
cycles_complete = nprocs * 10
|
| 765 |
+
|
| 766 |
+
last_print_time = time()
|
| 767 |
+
num_equations = 0.0
|
| 768 |
+
print_every_n_seconds = 1
|
| 769 |
+
|
| 770 |
while cycles_complete > 0
|
| 771 |
for i=1:nprocs
|
| 772 |
if isready(allPops[i])
|
|
|
|
| 787 |
# Dominating pareto curve - must be better than all simpler equations
|
| 788 |
dominating = PopMember[]
|
| 789 |
open(hofFile, "w") do io
|
|
|
|
|
|
|
|
|
|
|
|
|
| 790 |
println(io,"Complexity|MSE|Equation")
|
| 791 |
for size=1:actualMaxsize
|
| 792 |
if hallOfFame.exists[size]
|
|
|
|
| 795 |
numberSmallerAndBetter = sum([curMSE > MSE(evalTreeArray(hallOfFame.members[i].tree), y) for i=1:(size-1)])
|
| 796 |
betterThanAllSmaller = (numberSmallerAndBetter == 0)
|
| 797 |
if betterThanAllSmaller
|
|
|
|
| 798 |
println(io, "$size|$(curMSE)|$(stringTree(member.tree))")
|
| 799 |
push!(dominating, member)
|
| 800 |
end
|
| 801 |
end
|
| 802 |
end
|
|
|
|
| 803 |
end
|
| 804 |
|
| 805 |
# Try normal copy otherwise.
|
|
|
|
| 837 |
end
|
| 838 |
|
| 839 |
cycles_complete -= 1
|
| 840 |
+
num_equations += ncyclesperiteration * npop / 10.0
|
| 841 |
end
|
| 842 |
end
|
| 843 |
sleep(1e-3)
|
| 844 |
+
elapsed = time() - last_print_time
|
| 845 |
+
if elapsed > print_every_n_seconds
|
| 846 |
+
# Dominating pareto curve - must be better than all simpler equations
|
| 847 |
+
debug(verbosity, "\n")
|
| 848 |
+
debug(verbosity, "Cycles per second: $(num_equations/elapsed)")
|
| 849 |
+
debug(verbosity, "Hall of Fame:")
|
| 850 |
+
debug(verbosity, "-----------------------------------------")
|
| 851 |
+
debug(verbosity, "Complexity \t MSE \t Equation")
|
| 852 |
+
for size=1:actualMaxsize
|
| 853 |
+
if hallOfFame.exists[size]
|
| 854 |
+
member = hallOfFame.members[size]
|
| 855 |
+
curMSE = MSE(evalTreeArray(member.tree), y)
|
| 856 |
+
numberSmallerAndBetter = sum([curMSE > MSE(evalTreeArray(hallOfFame.members[i].tree), y) for i=1:(size-1)])
|
| 857 |
+
betterThanAllSmaller = (numberSmallerAndBetter == 0)
|
| 858 |
+
if betterThanAllSmaller
|
| 859 |
+
debug(verbosity, "$size \t $(curMSE) \t $(stringTree(member.tree))")
|
| 860 |
+
end
|
| 861 |
+
end
|
| 862 |
+
end
|
| 863 |
+
debug(verbosity, "")
|
| 864 |
+
last_print_time = time()
|
| 865 |
+
num_equations = 0.0
|
| 866 |
+
end
|
| 867 |
end
|
| 868 |
end
|
| 869 |
|