From 290b2be235f937780d270748f58c20b5e33850ca Mon Sep 17 00:00:00 2001 From: CompatHelper Julia Date: Sat, 16 Nov 2024 01:46:08 +0000 Subject: [PATCH 1/3] CompatHelper: bump compat for HerbSpecification to 0.2, (keep existing compat) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 9f9d5d3..703f4e3 100644 --- a/Project.toml +++ b/Project.toml @@ -20,7 +20,7 @@ HerbConstraints = "^0.2.0" HerbCore = "^0.3.0" HerbGrammar = "^0.4.0" HerbInterpret = "^0.1.3" -HerbSpecification = "^0.1.0" +HerbSpecification = "^0.1.0, 0.2" MLStyle = "^0.4.17" Random = "1.8.0,1.9.0,1.10.0,1.11.0" StatsBase = "^0.34" From e369d69c3fbb3be7b59bad8c02223a06227d9f6b Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:11:44 +0300 Subject: [PATCH 2/3] Remove support for `HerbSpecification@0.1.x` --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 703f4e3..dee6611 100644 --- a/Project.toml +++ b/Project.toml @@ -20,7 +20,7 @@ HerbConstraints = "^0.2.0" HerbCore = "^0.3.0" HerbGrammar = "^0.4.0" HerbInterpret = "^0.1.3" -HerbSpecification = "^0.1.0, 0.2" +HerbSpecification = "0.2" MLStyle = "^0.4.17" Random = "1.8.0,1.9.0,1.10.0,1.11.0" StatsBase = "^0.34" From 058ac9480ea9965c7e873a3dcdc86d2f4dd2b72e Mon Sep 17 00:00:00 2001 From: Reuben Gardos Reid <5456207+ReubenJ@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:54:25 +0300 Subject: [PATCH 3/3] Update types to reflect changes to `IOExample`s --- src/evaluate.jl | 8 +++++++- src/stochastic_iterator.jl | 2 +- test/test_search_procedure.jl | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/evaluate.jl b/src/evaluate.jl index 6fa4db1..79a160d 100644 --- a/src/evaluate.jl +++ b/src/evaluate.jl @@ -18,7 +18,13 @@ Optional parameters: Returns a score in the interval [0, 1] """ -function evaluate(problem::Problem{Vector{IOExample}}, expr::Any, symboltable::SymbolTable; shortcircuit::Bool=true, allow_evaluation_errors::Bool=false)::Number +function evaluate( + problem::Problem{<:AbstractVector{<:IOExample}}, + expr::Any, + symboltable::SymbolTable; + shortcircuit::Bool=true, + allow_evaluation_errors::Bool=false +)::Number number_of_satisfied_examples = 0 crashed = false diff --git a/src/stochastic_iterator.jl b/src/stochastic_iterator.jl index e678bd3..b8ae243 100644 --- a/src/stochastic_iterator.jl +++ b/src/stochastic_iterator.jl @@ -157,7 +157,7 @@ end Returns the cost of the `program` using the examples and the `cost_function`. It first convert the program to an expression and evaluates it on all the examples. """ -function _calculate_cost(program::Union{RuleNode, StateHole}, cost_function::Function, spec::AbstractVector{IOExample}, grammar::AbstractGrammar, evaluation_function::Function) +function _calculate_cost(program::Union{RuleNode, StateHole}, cost_function::Function, spec::AbstractVector{<:IOExample}, grammar::AbstractGrammar, evaluation_function::Function) results = Tuple{<:Number,<:Number}[] expression = rulenode2expr(program, grammar) diff --git a/test/test_search_procedure.jl b/test/test_search_procedure.jl index 965e231..ec46879 100644 --- a/test/test_search_procedure.jl +++ b/test/test_search_procedure.jl @@ -32,7 +32,7 @@ Index = List[Number] end - problem = Problem([IOExample(Dict(), x) for x ∈ 1:5]) + problem = Problem([IOExample(Dict{Symbol,Any}(), x) for x ∈ 1:5]) iterator = BFSIterator(g₂, :Index, max_depth=2) solution, flag = synth(problem, iterator, allow_evaluation_errors=true) @@ -70,7 +70,7 @@ Index = List[Number] end - problem = Problem([IOExample(Dict(), x) for x ∈ 1:5]) + problem = Problem([IOExample(Dict{Symbol,Any}(), x) for x ∈ 1:5]) iterator = BFSIterator(g₃, :Index, max_depth=2) solution, flag = synth(problem, iterator, allow_evaluation_errors=true)