Herb-AI / HerbSearch.jl

Search procedures and synthesizers for Herb.jl

Home Page:https://herb-ai.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix the probabilistic enumerator

Whebon opened this issue · comments

The test below is broken because of new top down iteration technique. The new MLFSIterator <: TopDownIterator produces fixed shaped trees, and then delegates enumeration of fixed shaped trees to the FixedShapedIterator. The FixedShapedIterator is not a MLFSIterator, so the priority function does not use rule probabilities.

@testset "probabilistic enumerator" begin
    g₁ = @pcsgrammar begin
        0.2 : Real = |(0:1)
        0.5 : Real = Real + Real
        0.3 : Real = Real * Real 
    end
  
    programs = collect(MLFSIterator(g₁, :Real, max_depth=2))
    @test length(programs) == length(BFSIterator(g₁, :Real, max_depth=2))
    @test all(map(t -> rulenode_log_probability(t[1], g₁)  rulenode_log_probability(t[2], g₁), zip(programs[begin:end-1], programs[begin+1:end])))
end

Does this require adding a domain heuristics into UniformTreeSolver?

Update: I am cleaning up "TODO"s in the codebase, so I have deleted this test and the TODO above it.

However, this test is still broken. So this issue must remain.

Does this require adding a domain heuristics into UniformTreeSolver?

Yes, which is currently supported. However, it also requires a more sophisticated priority_function.