davidbarber / Julia0p4ProbabilisticInferenceEngine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: UndefVarError: DiscreteVariable not defined

tigerneil opened this issue · comments

julia> include("setup.jl")
9-element Array{ByteString,1}:
 "/Applications/Julia-0.4.5.app/Contents/Resources/julia/local/share/julia/site/v0.4"   
 "/Applications/Julia-0.4.5.app/Contents/Resources/julia/share/julia/site/v0.4"         
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine"                       
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine/src"                   
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine/src/GraphPlot"         
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine/src/HMM"               
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine/src/PotentialInference"
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine/Demos"                 
 "/Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine"                       

julia> demoBurglar()
ERROR: UndefVarError: DiscreteVariable not defined
 in demoBurglar at /Users/zhuxiaohu/projects/Julia0p4ProbabilisticInferenceEngine/Demos/demoBurglar.jl:9

julia> using brml

julia> demoBurglar()

ERROR: UndefVarError: DiscreteVariable not defined

totally lost. :(

The cwd must be the folder where you cloned the repo, since brml.jl uses cwd relative paths. I've managed to use the code as a library by replacing the cwd() calls in brml.jl to Base.source_path() calls, but there are still some functions that are not correctly exported.

Edit: Apparently the @__FILE__ macro is preferred over Base.source_path()
Edit2: Now all functions are exporting correctly. The problem was that PotentialInference was trying to include stuff relative to cwd() I've got it to work as a separate library by also changing line 74 in PotentialInference.jl to current_path = dirname(@__FILE__).

@florinb Is there any reason to prefer cwd() over @__FILE__.