11"""
22$(TYPEDSIGNATURES)
33
4- Parse the problem instance found in `uai_filepath ` defined in the UAI model
4+ Parse the problem instance found in `model_filepath ` defined in the UAI model
55format.
66
77The UAI file formats are defined in:
88https://personal.utdallas.edu/~vibhav.gogate/uai16-evaluation/uaiformat.html
99"""
10- function read_model_file (uai_filepath ; factor_eltype = Float64)
10+ function read_model_file (model_filepath ; factor_eltype = Float64)
1111 # Read the uai file into an array of lines
12- str = open (uai_filepath ) do file
12+ str = open (model_filepath ) do file
1313 read (file, String)
1414 end
1515 return read_model_string (str; factor_eltype)
6565"""
6666$(TYPEDSIGNATURES)
6767
68- Return the observed variables and values in `uai_evid_filepath `. If the passed
68+ Return the observed variables and values in `evidence_filepath `. If the passed
6969file path is an empty string, return empty vectors.
7070
7171The UAI file formats are defined in:
7272https://personal.utdallas.edu/~vibhav.gogate/uai16-evaluation/uaiformat.html
7373"""
74- function read_evidence_file (uai_evid_filepath :: AbstractString )
75- if isempty (uai_evid_filepath )
74+ function read_evidence_file (evidence_filepath :: AbstractString )
75+ if isempty (evidence_filepath )
7676 # No evidence
7777 return Int64[], Int64[]
7878 else
7979 # Read the last line of the uai evid file
80- line = open (uai_evid_filepath ) do file
80+ line = open (evidence_filepath ) do file
8181 readlines (file)
8282 end |> last
8383
@@ -104,10 +104,10 @@ as in the model
104104The UAI file formats are defined in:
105105https://personal.utdallas.edu/~vibhav.gogate/uai16-evaluation/uaiformat.html
106106"""
107- function read_solution_file (uai_mar_filepath :: AbstractString ; factor_eltype = Float64)
107+ function read_solution_file (solution_filepath :: AbstractString ; factor_eltype = Float64)
108108
109109 # Read the uai mar file into an array of lines
110- rawlines = open (uai_mar_filepath ) do file
110+ rawlines = open (solution_filepath ) do file
111111 readlines (file)
112112 end
113113
@@ -178,14 +178,14 @@ $(TYPEDSIGNATURES)
178178Read a UAI problem instance from a file.
179179"""
180180function read_instance (
181- uai_filepath :: AbstractString ;
182- uai_evid_filepath :: AbstractString = " " ,
183- uai_mar_filepath :: AbstractString = " " ,
181+ model_filepath :: AbstractString ;
182+ evidence_filepath :: AbstractString = " " ,
183+ solution_filepath :: AbstractString = " " ,
184184 eltype = Float64
185185):: UAIInstance
186- nvars, cards, ncliques, factors = read_model_file (uai_filepath ; factor_eltype = eltype)
187- obsvars, obsvals = read_evidence_file (uai_evid_filepath )
188- reference_marginals = isempty (uai_mar_filepath ) ? Vector{eltype}[] : read_solution_file (uai_mar_filepath )
186+ nvars, cards, ncliques, factors = read_model_file (model_filepath ; factor_eltype = eltype)
187+ obsvars, obsvals = read_evidence_file (evidence_filepath )
188+ reference_marginals = isempty (solution_filepath ) ? Vector{eltype}[] : read_solution_file (solution_filepath )
189189 return UAIInstance (nvars, ncliques, cards, factors, obsvars, obsvals, reference_marginals)
190190end
191191
0 commit comments