Skip to content

Commit 8ff0c97

Browse files
committed
Additional filtering test until this is refactored
1 parent e4a81d4 commit 8ff0c97

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/needsahome.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ function buildSubgraphFromLabels!(dfg::G,
2424
#Same type
2525
cliqSubFg = G(params=getSolverParams(dfg))
2626
else
27-
#Default
27+
#Default if not in-memory
2828
cliqSubFg = destType{typeof(getSolverParms(dfg))}(params=getSolverParams(dfg))
2929
end
3030

3131
# add a little too many variables (since we need the factors)
3232
for sym in syms
33-
getSubgraphAroundNode(dfg, getVariable(dfg, sym), 2, false, cliqSubFg, solvable=solvable)
33+
if getSolvable(dfg, sym) >= solvable
34+
getSubgraphAroundNode(dfg, getVariable(dfg, sym), 2, false, cliqSubFg, solvable=solvable)
35+
end
3436
end
3537

3638
# remove excessive variables that were copied by neighbors distance 2

test/needsahomeTests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,27 @@ using Test
66
struct TestInferenceVariable1 <: InferenceVariable end
77
struct TestInferenceVariable2 <: InferenceVariable end
88

9+
# Build a graph
910
v1 = DFGVariable(:a, TestInferenceVariable1())
1011
v2 = DFGVariable(:b, TestInferenceVariable1())
1112
f1 = DFGFactor{Int, :Symbol}(:f1)
1213
addVariable!(dfg, v1)
1314
addVariable!(dfg, v2)
1415
addFactor!(dfg, [v1, v2], f1)
1516

17+
# Standard tests
1618
newdfg = buildSubgraphFromLabels!(dfg, [:b])
1719
@test ls(newdfg) == [:b]
1820
# Okay it looks like this function only accepts variables, is that right?
1921
@test_throws Exception newdfg = buildSubgraphFromLabels!(dfg, [:b, :f1])
2022
newdfg = buildSubgraphFromLabels!(dfg, [:b, :a])
2123
@test symdiff(ls(newdfg), [:b, :a]) == []
24+
@test lsf(newdfg) == [:f1]
2225

26+
# Check solvable filter
27+
@test setSolvable!(getVariable(dfg, :a), 1) == 1
28+
@test setSolvable!(getVariable(dfg, :b), 0) == 0
29+
@test setSolvable!(getFactor(dfg, :f1), 1) == 1
30+
newdfg = buildSubgraphFromLabels!(dfg, [:b, :a]; solvable = 1)
31+
@test ls(newdfg) == [:a]
2332
end

0 commit comments

Comments
 (0)