1- function _partial_search_space (domains, concept; sol_number= 100 )
1+ function _partial_search_space (domains, concept, param = nothing ; sol_number= 100 )
22 solutions = Set {Vector{Int}} ()
33 non_sltns = Set {Vector{Int}} ()
44
55 while length (solutions) < 100 || length (non_sltns) < 100
66 config = map (_draw, domains)
7- c = concept (config)
7+ c = concept (config; param = param )
88 c && length (solutions) < 100 && push! (solutions, config)
99 ! c && length (non_sltns) < 100 && push! (non_sltns, config)
1010 end
1111 return solutions, non_sltns
1212end
1313
14- function _complete_search_space (domains, concept)
14+ function _complete_search_space (domains, concept, param = nothing )
1515 solutions = Set {Vector{Int}} ()
1616 non_sltns = Set {Vector{Int}} ()
1717
@@ -24,8 +24,10 @@ function _complete_search_space(domains, concept)
2424 @warn message space_size
2525 end
2626
27+ f = isnothing (param) ? ((x; param = p) -> concept (x)) : concept
28+
2729 configurations = product (map (d -> _get_domain (d), domains)... )
28- foreach (c -> (cv = collect (c); push! (concept (cv) ? solutions : non_sltns, cv)), configurations)
30+ foreach (c -> (cv = collect (c); push! (f (cv; param = param ) ? solutions : non_sltns, cv)), configurations)
2931
3032 return solutions, non_sltns
3133end
@@ -54,7 +56,7 @@ function explore_learn_compose(concept; domains, param=nothing,
5456)
5557 dom_size = maximum (_length, domains)
5658 if search == :complete
57- X_sols, X = _complete_search_space (domains, concept)
59+ X_sols, X = _complete_search_space (domains, concept, param )
5860 union! (X, X_sols)
5961 return learn_compose (X, X_sols, dom_size, param;
6062 local_iter= local_iter, global_iter= global_iter, action= action)
@@ -72,7 +74,9 @@ function _compose_to_string(symbols, name)
7274 co = _reduce_symbols (symbols[4 ], " , " , false ; prefix= CN * " _co_" )
7375
7476 julia_string = """
75- $name = x -> fill(x, $tr_length ) .|> $tr |> $ar |> $ag |> $co
77+ function $name (x; param=nothing, dom_size)
78+ fill(x, $tr_length ) .|> map(f -> (y -> f(y; param=param)), $tr ) |> $ar |> $ag |> (y -> $co (y; param=param, dom_size=dom_size, nvars=length(x)))
79+ end
7680 """
7781
7882 return julia_string
0 commit comments