Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sorta works now
  • Loading branch information
Stephen committed Mar 9, 2018
1 parent eb73253 commit 6b1d7a4
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions gp.jl
Expand Up @@ -17,12 +17,6 @@ Number of elites: 2
Selection: Tournament
=#


function math_expr(op, op1, op2)
expr = Expr(:call, op, , op1, op2)
return expr
end

function GT(a,b)
if a > b
return 1
Expand All @@ -39,19 +33,18 @@ function DIV(a,b)
end
end

function create_single_full_tree(depth, function_set, terminal_set)
function create_single_full_tree(depth, fs, ts)
# If we are not at the bottom
if depth > 2:
fn = function_set[1]
trm1 = create_single
if depth == 1
return Expr(:call, fs[rand(1:length(fs))], ts[rand(1:length(ts))], ts[rand(1:length(ts))])
else
return Expr(:call, fs[rand(1:length(fs))], create_single_full_tree(depth-1, fs, ts), create_single_full_tree(depth-1, fs, ts))
end
end


function main()

function_set = [:+, :-, :DIV, :GT]
terminal_Set = ["x", "v", -1]


fs = [:+, :-, :DIV, :GT]
ts = [:x, :v, -1]
tst = create_single_full_tree(4, fs, ts)
end
main()

0 comments on commit 6b1d7a4

Please sign in to comment.