Skip to content

Commit a55eabc

Browse files
committed
merge main
2 parents 7a22b7b + a3c3181 commit a55eabc

File tree

20 files changed

+163
-234
lines changed

20 files changed

+163
-234
lines changed

Artifacts.toml

Lines changed: 0 additions & 34 deletions
This file was deleted.

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ authors = ["Jin-Guo Liu", "Martin Roa Villescas"]
44
version = "0.1.0"
55

66
[deps]
7-
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
87
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
98
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
109
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -16,7 +15,6 @@ TropicalGEMM = "a4ad3063-64a7-4bad-8738-34ed09bc0236"
1615
TropicalNumbers = "b3a74e9c-7526-4576-a4eb-79c0d4c32334"
1716

1817
[compat]
19-
Artifacts = "1"
2018
CUDA = "4"
2119
DocStringExtensions = "0.8.6, 0.9"
2220
OMEinsum = "0.7"

benchmark/bench_map.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ using Artifacts
66

77
const SUITE = BenchmarkGroup()
88

9-
problem = read_uai_problem("Promedus_14")
9+
model_filepath, evidence_filepath, solution_filepath = get_instance_filepaths("Promedus_14", "MAR")
10+
problem = read_instance(model_filepath; evidence_filepath, solution_filepath)
1011

1112
optimizer = TreeSA(ntrials = 1, niters = 2, βs = 1:0.1:40)
1213
tn = TensorNetworkModel(problem; optimizer)

benchmark/bench_mar.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ using Artifacts
88

99
const SUITE = BenchmarkGroup()
1010

11-
problem = read_uai_problem("Promedus_14")
11+
model_filepath, evidence_filepath, solution_filepath = get_instance_filepaths("Promedus_14", "MAR")
12+
problem = read_instance(model_filepath; evidence_filepath, solution_filepath)
1213

1314
optimizer = TreeSA(ntrials = 1, niters = 5, βs = 0.1:0.1:100)
1415
tn1 = TensorNetworkModel(problem; optimizer)

benchmark/bench_mmap.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ using Artifacts
66

77
const SUITE = BenchmarkGroup()
88

9-
problem = read_uai_problem("Promedus_14")
9+
model_filepath, evidence_filepath, solution_filepath = get_instance_filepaths("Promedus_14", "MAR")
10+
problem = read_instance(model_filepath; evidence_filepath, solution_filepath)
1011
optimizer = TreeSA(ntrials = 1, niters = 2, βs = 1:0.1:40)
1112

1213
# Does not marginalize any var

example/asia/asia.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using TensorInference
22

33
# Load the model that detailed in the README and `asia.uai`.
4-
instance = uai_problem_from_file(joinpath(@__DIR__, "asia.uai"))
4+
instance = read_instance(joinpath(@__DIR__, "asia.uai"))
55
tnet = TensorNetworkModel(instance)
66

77
# Get the probabilities (PR)
@@ -36,4 +36,4 @@ mmap = MMAPModel(instance; marginalized=[1,2,3,5,6,8])
3636
most_probable_config(mmap)
3737
# The total probability of having lung cancer is roughly half.
3838
log_probability(mmap, [1, 0])
39-
log_probability(mmap, [0, 0])
39+
log_probability(mmap, [0, 0])

src/Core.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ end
4141
$TYPEDSIGNATURES
4242
4343
Set the evidence of an UAI instance.
44-
45-
### Examples
46-
```jldoctest; setup=:(using TensorInference)
47-
julia> problem = read_uai_problem("Promedus_14"); problem.obsvars, problem.obsvals
48-
([42, 48, 27, 30, 29, 15, 124, 5, 148], [1, 1, 1, 1, 1, 1, 1, 1, 1])
49-
50-
julia> set_evidence!(problem, 2=>0, 4=>1); problem.obsvars, problem.obsvals
51-
([2, 4], [0, 1])
52-
```
5344
"""
5445
function set_evidence!(uai::UAIInstance, pairs::Pair{Int}...)
5546
empty!(uai.obsvars)

src/TensorInference.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module TensorInference
22

33
using OMEinsum, LinearAlgebra
44
using DocStringExtensions, TropicalNumbers
5-
using Artifacts
65
# The Tropical GEMM support
76
using TropicalGEMM
87
using StatsBase
@@ -12,7 +11,7 @@ export RescaledArray
1211
export contraction_complexity, TreeSA, GreedyMethod, KaHyParBipartite, SABipartite, MergeGreedy, MergeVectors
1312

1413
# read and load uai files
15-
export read_uai_file, read_td_file, read_uai_evid_file, read_uai_mar_file, read_uai_problem, uai_problem_from_file
14+
export read_model_file, read_td_file, read_evidence_file, read_solution_file, read_instance
1615
export set_evidence!
1716

1817
# marginals
@@ -30,8 +29,8 @@ export MMAPModel
3029
include("Core.jl")
3130
include("RescaledArray.jl")
3231
include("utils.jl")
33-
include("inference.jl")
34-
include("maxprob.jl")
32+
include("mar.jl")
33+
include("map.jl")
3534
include("mmap.jl")
3635
include("sampling.jl")
3736

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)