|
14 | 14 | @testset for (func, arity) in t.functions
|
15 | 15 | @test arity == 2
|
16 | 16 | end
|
17 |
| - @test_skip summary(t) == "TreeGP[P=10,Parameter[x,y],Function[*, +, /, -]]" |
| 17 | + show(IOBuffer(), summary(t)) |
18 | 18 |
|
19 | 19 | # population initialization
|
20 | 20 | popexp = Evolutionary.initial_population(t, rng=rng);
|
|
36 | 36 | @test Evolutionary.nodes(ft) == 15
|
37 | 37 | @test Evolutionary.height(ft) == 3
|
38 | 38 | @test length(ft) == 15
|
39 |
| - # @test Evolutionary.depth(ft, :x) == 3 |
40 |
| - # ft[3] = :z |
41 |
| - # @test Evolutionary.depth(ft, :z) == 3 |
| 39 | + @test Evolutionary.depth(ft, :x) == 3 |
| 40 | + ft[3] = :z |
| 41 | + @test Evolutionary.depth(ft, :z) == 3 |
42 | 42 | @test Evolutionary.depth(ft, ft) == 0
|
43 | 43 | @test Evolutionary.depth(ft, ft[3]) > 0
|
44 | 44 | @test Evolutionary.depth(ft, :w) == -1
|
45 |
| - @test Evolutionary.evaluate([1.0, 2.0], :y, [:y, :z]) == 1.0 |
| 45 | + @test Evolutionary.evaluate(:y, Dict(:y=>1, :z=>2), 1.0, 2.0) == 1.0 |
46 | 46 | copyto!(ft, gt)
|
47 | 47 | @test ft == gt
|
48 |
| - # @test Evolutionary.symbols(ft) |> sort == [:x, :y] |
| 48 | + @test Evolutionary.symbols(ft) |> sort == [:x, :y] |
49 | 49 |
|
50 | 50 | # simplification
|
51 | 51 | using Evolutionary: simplify!
|
|
64 | 64 | @test Expr(:call, log, Expr(:call, exp, 1)) |> simplify! == 1
|
65 | 65 | @test Expr(:call, -, Expr(:call, +, :x, 1), 2) |> simplify! == Expr(:call, +, :x, -1)
|
66 | 66 | @test Expr(:call, -, Expr(:call, +, 1, :x), 2) |> simplify! == Expr(:call, +, :x, -1)
|
67 |
| - @test Expr(:call, +, 2, Expr(:call, +, 1, :x)) |> simplify! == Expr(:call, +, :x, 3) |
68 |
| - @test Expr(:call, +, 2, Expr(:call, +, :x, 1)) |> simplify! == Expr(:call, +, :x, 3) |
| 67 | + @test Expr(:call, +, Expr(:call, +, :x, 1), 2) |> simplify! == Expr(:call, +, :x, 3) |
| 68 | + @test Expr(:call, +, Expr(:call, +, 1, :x), 2) |> simplify! == Expr(:call, +, :x, 3) |
| 69 | + @test Expr(:call, +, Expr(:call, -, 1, :x), 2) |> simplify! == Expr(:call, -, 3, :x) |
| 70 | + @test Expr(:call, -, Expr(:call, -, 1, :x), 2) |> simplify! == Expr(:call, -, -1, :x) |
| 71 | + @test Expr(:call, +, Expr(:call, -, :x, 1), 2) |> simplify! == Expr(:call, +, :x, 1) |
| 72 | + @test Expr(:call, -, Expr(:call, -, :x, 1), 2) |> simplify! == Expr(:call, -, :x, 3) |
| 73 | + @test Expr(:call, +, :x, Expr(:call, -, 1, :x)) |> simplify! == 1 |
| 74 | + @test Expr(:call, +, Expr(:call, -, 2, :x), :x) |> simplify! == 2 |
| 75 | + @test Expr(:call, -, :x, Expr(:call, +, :x, :y)) |> simplify! == Expr(:call, -, :y) |
| 76 | + @test Expr(:call, -, :x, Expr(:call, -, :x, :y)) |> simplify! == :y |
| 77 | + @test Expr(:call, -, :x, Expr(:call, +, :y, :x)) |> simplify! == Expr(:call, -, :y) |
| 78 | + @test Expr(:call, -, Expr(:call, -, :x, :y), :x) |> simplify! == Expr(:call, -, :y) |
| 79 | + @test Expr(:call, -, Expr(:call, +, :x, :y), :x) |> simplify! == :y |
| 80 | + @test Expr(:call, +, 2, Expr(:call, +, 1, :x)) |> simplify! == Expr(:call, +, 3, :x) |
| 81 | + @test Expr(:call, +, 2, Expr(:call, -, 1, :x)) |> simplify! == Expr(:call, -, 3, :x) |
| 82 | + @test Expr(:call, +, 2, Expr(:call, +, :x, 1)) |> simplify! == Expr(:call, +, 3, :x) |
| 83 | + @test Expr(:call, +, 2, Expr(:call, -, :x, 1)) |> simplify! == Expr(:call, +, 1, :x) |
| 84 | + @test Expr(:call, -, 2, Expr(:call, +, 1, :x)) |> simplify! == Expr(:call, -, 1, :x) |
| 85 | + @test Expr(:call, -, 2, Expr(:call, +, :x, 1)) |> simplify! == Expr(:call, -, 1, :x) |
| 86 | + @test Expr(:call, -, 1, Expr(:call, -, 2, :x)) |> simplify! == Expr(:call, +, -1, :x) |
| 87 | + @test Expr(:call, -, 2, Expr(:call, -, :x, 1)) |> simplify! == Expr(:call, -, 3, :x) |
69 | 88 |
|
70 | 89 | # evaluation
|
71 | 90 | ex = Expr(:call, +, 1, :x) |> Evolutionary.Expression
|
|
100 | 119 | ε = 0.1
|
101 | 120 | ),
|
102 | 121 | ),
|
103 |
| - Evolutionary.Options(show_trace=true, rng=rng, iterations=50) |
| 122 | + Evolutionary.Options(show_trace=false, rng=rng, iterations=50) |
104 | 123 | )
|
105 | 124 | @test minimum(res) < 1.1
|
106 | 125 |
|
|
0 commit comments