diff --git a/example/example_main.jl b/example/example_main.jl index 855eea7..8193ae8 100644 --- a/example/example_main.jl +++ b/example/example_main.jl @@ -41,7 +41,6 @@ ops, data = Options( fitting = fitting_params( max_iter = 10, ), - meta_data = Dict("ones" => ones(5)) ); # ================================================================================================== diff --git a/src/genetic_ops.jl b/src/genetic_ops.jl index 6ecb7da..04fbd76 100644 --- a/src/genetic_ops.jl +++ b/src/genetic_ops.jl @@ -207,16 +207,24 @@ function point_mutation2!(node, ops) node_elect = random_node(node, mode=0) if node_elect.ari == 2 - node_elect.ari = 1 - node_elect.ind = rand(1:length(ops.unaops)) - if rand(Bool) - node_elect.lef = copy(node_elect.rig) + if !isempty(ops.unaops) + node_elect.ari = 1 + node_elect.ind = rand(1:length(ops.unaops)) + if rand(Bool) + node_elect.lef = copy(node_elect.rig) + end + else + point_mutation1!(node, ops) end elseif node_elect.ari == 1 - node_elect.ari = 2 - node_elect.ind = rand(1:length(ops.binops)) - node_elect.rig = grow_equation(1, ops, method = :asym) + if !isempty(ops.binops) + node_elect.ari = 2 + node_elect.ind = rand(1:length(ops.binops)) + node_elect.rig = grow_equation(1, ops, method = :asym) + else + point_mutation1!(node, ops) + end elseif node_elect.ari == 0 node_elect.ari = -1 diff --git a/src/nsga-II.jl b/src/nsga-II.jl index 86eea11..48988bc 100644 --- a/src/nsga-II.jl +++ b/src/nsga-II.jl @@ -275,7 +275,7 @@ function generational_loop( if ops.general.print_progress display(cur_prog_dict) # println("\n", round(Int64, t_since ÷ 60), " min ", round(Int64, t_since % 60), " sec | type :q and enter to finish early") - println("\n", round(Int64, t_since ÷ 60), " min ", round(Int64, t_since % 60)) + println("\n", round(Int64, t_since ÷ 60), " min ", round(Int64, t_since % 60), " sec") end if ops.general.plot_hall_of_fame @@ -399,7 +399,7 @@ function generational_loop( if ops.general.print_progress display(cur_prog_dict) # println("\n", round(Int64, t_since ÷ 60), " min ", round(Int64, t_since % 60), " sec | type :q and enter to finish early") - println("\n", round(Int64, t_since ÷ 60), " min ", round(Int64, t_since % 60)) + println("\n", round(Int64, t_since ÷ 60), " min ", round(Int64, t_since % 60), " sec") end # ==================================================================================================