2222 import Evolutionary
2323 import Test: @test
2424
25- test_icn= ICN (;
25+ test_icn = ICN (;
2626 parameters = [:dom_size , :numvars , :val ],
2727 layers = [Transformation, Arithmetic, Aggregation, Comparison],
2828 connection = [1 , 2 , 3 , 4 ]
3131 function allunique_val (x; val)
3232 for i in 1 : (length (x) - 1 )
3333 for j in (i + 1 ): length (x)
34- if x[i]== x[j]
35- if x[i]!= val
34+ if x[i] == x[j]
35+ if x[i] != val
3636 return false
3737 end
3838 end
4444 function allunique_vals (x; vals)
4545 for i in 1 : (length (x) - 1 )
4646 for j in (i + 1 ): length (x)
47- if x[i]== x[j]
47+ if x[i] == x[j]
4848 if ! (x[i] in vals)
4949 return false
5050 end
6262 val = 3
6363 )[2 ]
6464
65- new_test_icn= ICN (;
65+ new_test_icn = ICN (;
6666 parameters = [:dom_size , :numvars , :vals ],
6767 layers = [SimpleFilter, Transformation, Arithmetic, Aggregation, Comparison],
6868 connection = [1 , 2 , 3 , 4 , 5 ]
@@ -82,56 +82,57 @@ struct LocalSearchOptimizer <: AbstractOptimizer
8282 options:: Any
8383end
8484
85- # FIXME - Broken for compatibility reasons until LocalSearchSolvers updates its compat entries
86- # @testitem "LocalSearchOptimizer" tags = [:extension] default_imports = false begin
87- # import CompositionalNetworks: Transformation, Arithmetic, Aggregation, SimpleFilter
88- # import CompositionalNetworks: LocalSearchOptimizer, explore_learn, Comparison, ICN
89- # import ConstraintDomains: domain
90- # import LocalSearchSolvers
91- # import Test: @test
92-
93- # test_icn = ICN(;
94- # parameters=[:dom_size, :numvars, :val],
95- # layers=[Transformation, Arithmetic, Aggregation, Comparison],
96- # connection=[1, 2, 3, 4],
97- # )
98-
99- # function allunique_val(x; val)
100- # for i in 1:(length(x)-1)
101- # for j in (i+1):length(x)
102- # if x[i] == x[j]
103- # if x[i] != val
104- # return false
105- # end
106- # end
107- # end
108- # end
109- # return true
110- # end
111-
112- # function allunique_vals(x; vals)
113- # for i in 1:(length(x)-1)
114- # for j in (i+1):length(x)
115- # if x[i] == x[j]
116- # if !(x[i] in vals)
117- # return false
118- # end
119- # end
120- # end
121- # end
122- # return true
123- # end
124-
125- # @test explore_learn([domain([1, 2, 3, 4]) for i in 1:4], allunique_val, LocalSearchOptimizer(), icn=test_icn, val=3)[2]
126-
127- # new_test_icn = ICN(;
128- # parameters=[:dom_size, :numvars, :vals],
129- # layers=[SimpleFilter, Transformation, Arithmetic, Aggregation, Comparison],
130- # connection=[1, 2, 3, 4, 5],
131- # )
132-
133- # @test explore_learn([domain([1, 2, 3, 4]) for i in 1:4], allunique_vals, LocalSearchOptimizer(), icn=new_test_icn, vals=[3, 4])[2]
134- # end
85+ @testitem " LocalSearchOptimizer" tags= [:extension ] default_imports= false begin
86+ import CompositionalNetworks: Transformation, Arithmetic, Aggregation, SimpleFilter
87+ import CompositionalNetworks: LocalSearchOptimizer, explore_learn, Comparison, ICN
88+ import ConstraintDomains: domain
89+ import LocalSearchSolvers
90+ import Test: @test
91+
92+ test_icn = ICN (;
93+ parameters = [:dom_size , :numvars , :val ],
94+ layers = [Transformation, Arithmetic, Aggregation, Comparison],
95+ connection = [1 , 2 , 3 , 4 ]
96+ )
97+
98+ function allunique_val (x; val)
99+ for i in 1 : (length (x) - 1 )
100+ for j in (i + 1 ): length (x)
101+ if x[i] == x[j]
102+ if x[i] != val
103+ return false
104+ end
105+ end
106+ end
107+ end
108+ return true
109+ end
110+
111+ function allunique_vals (x; vals)
112+ for i in 1 : (length (x) - 1 )
113+ for j in (i + 1 ): length (x)
114+ if x[i] == x[j]
115+ if ! (x[i] in vals)
116+ return false
117+ end
118+ end
119+ end
120+ end
121+ return true
122+ end
123+
124+ @test explore_learn ([domain ([1 , 2 , 3 , 4 ]) for i in 1 : 4 ], allunique_val,
125+ LocalSearchOptimizer (), icn = test_icn, val = 3 )[2 ]
126+
127+ new_test_icn = ICN (;
128+ parameters = [:dom_size , :numvars , :vals ],
129+ layers = [SimpleFilter, Transformation, Arithmetic, Aggregation, Comparison],
130+ connection = [1 , 2 , 3 , 4 , 5 ]
131+ )
132+
133+ @test explore_learn ([domain ([1 , 2 , 3 , 4 ]) for i in 1 : 4 ], allunique_vals,
134+ LocalSearchOptimizer (), icn = new_test_icn, vals = [3 , 4 ])[2 ]
135+ end
135136
136137struct JuMPOptimizer <: AbstractOptimizer
137138end
0 commit comments