Skip to content

Commit 403650c

Browse files
authored
Merge branch 'master' into maint/20Q1/rem_fncargvID
2 parents 5b29544 + 76a1aef commit 403650c

File tree

9 files changed

+63
-35
lines changed

9 files changed

+63
-35
lines changed

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
88
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1010
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
11-
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
1211
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1312
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1413
JSON2 = "2535ab7d-5cd8-5a07-80ac-9b1792aadce3"
@@ -24,7 +23,6 @@ Unmarshal = "cbff2730-442d-58d7-89d1-8e530c41eb02"
2423
Colors = "0.8, 0.9, 0.10, 0.11"
2524
Distributions = "0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 1"
2625
DocStringExtensions = "0.8, 0.9, 0.10, 1"
27-
GraphPlot = "0.3.1, 0.4"
2826
Graphs = "0.10.2, 0.11, 1"
2927
JSON = "0.21"
3028
JSON2 = "0.3.1"

attic/sandbox.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function copyGraph!(destDFG::AbstractDFG, sourceDFG::AbstractDFG, variableFactor
3232
# Only if we have all of them should we add it (otherwise strange things may happen on evaluation)
3333
if includeOrphanFactors || length(factVariableIds) == length(sourceFactorVariableIds)
3434
if !exists(destDFG, factor)
35-
addFactor!(destDFG, factVariableIds, factor)
35+
addFactor!(destDFG, factor)
3636
end
3737
end
3838
end

src/BigData/services/AbstractDataStore.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ Returns the list of copied entries.
4949
"""
5050
function copyStore(sourceStore::D1, destStore::D2; sourceEntries=listEntries(sourceStore))::Vector{E} where {T, D1 <: AbstractDataStore{T}, D2 <: AbstractDataStore{T}, E <: AbstractBigDataEntry}
5151
# Quick check
52-
destEntries = listEntries(destStore)
52+
destEntries = listStoreEntries(destStore)
5353
typeof(sourceEntries) != typeof(destEntries) && error("Can't copy stores, source has entries of type $(typeof(sourceEntries)), destination has entries of type $(typeof(destEntries)).")
5454
# Same source/destination check
5555
sourceStore == destStore && error("Can't specify same store for source and destination.")
5656
# Otherwise, continue
5757
for sourceEntry in sourceEntries
58-
addData!(destStore, deepcopy(sourceEntry), getData(sourceStore, sourceEntry))
58+
addBigData!(destStore, deepcopy(sourceEntry), getBigData(sourceStore, sourceEntry))
5959
end
6060
return sourceEntries
6161
end

src/LightDFG/services/LightDFG.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ function getNeighbors(dfg::LightDFG, label::Symbol; solvable::Int=0)::Vector{Sym
255255
end
256256

257257
function _copyIntoGraph!(sourceDFG::LightDFG{<:AbstractParams, V, F}, destDFG::LightDFG{<:AbstractParams, V, F}, ns::Vector{Int}, includeOrphanFactors::Bool=false)::Nothing where {V <: AbstractDFGVariable, F <: AbstractDFGFactor}
258+
259+
includeOrphanFactors && (@error "Adding orphaned factors is not supported")
260+
258261
#kan ek die in bulk copy, soos graph en dan nuwe map maak
259262
# Add all variables first,
260263
labels = [sourceDFG.g.labels[i] for i in ns]
@@ -283,7 +286,7 @@ function _copyIntoGraph!(sourceDFG::LightDFG{<:AbstractParams, V, F}, destDFG::L
283286

284287
# Only if we have all of them should we add it (otherwise strange things may happen on evaluation)
285288
if includeOrphanFactors || length(factVariables) == length(neigh_labels)
286-
exists(destDFG, f.label) ? (@warn "_copyIntoGraph $(f.label) exists, ignoring pending error behaviour decision") : addFactor!(destDFG, factVariables, deepcopy(f))
289+
exists(destDFG, f.label) ? (@warn "_copyIntoGraph $(f.label) exists, ignoring pending error behaviour decision") : addFactor!(destDFG, deepcopy(f))
287290
end
288291
end
289292
end

src/entities/DFGFactor.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ mutable struct GenericFunctionNodeData{T, S}
2727
edgeIDs::Array{Int,1}
2828
frommodule::S #Union{Symbol, AbstractString}
2929
fnc::T
30-
multihypo::String # likely to moved when GenericWrapParam is refactored
30+
multihypo::Array{Float64} # likely to moved when GenericWrapParam is refactored
3131
certainhypo::Vector{Int}
3232
solveInProgress::Int
3333
GenericFunctionNodeData{T, S}() where {T, S} = new{T,S}()
34-
GenericFunctionNodeData{T, S}(x1, x2, x3, x4, x5::S, x6::T, x7::String="", x8::Vector{Int}=Int[], x9::Int=0) where {T, S} = new{T,S}(x1, x2, x3, x4, x5, x6, x7, x8, x9)
35-
GenericFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, x7::String="", x8::Vector{Int}=Int[], x9::Int=0) where {T, S} = new{T,S}(x1, x2, x3, x4, x5, x6, x7, x8, x9)
34+
GenericFunctionNodeData{T, S}(x1, x2, x3, x4, x5::S, x6::T, multihypo::Vector{<:Real}=Float64[], certainhypo::Vector{Int}=Int[], x9::Int=0) where {T, S} = new{T,S}(x1, x2, x3, x4, x5, x6, multihypo, certainhypo, x9)
35+
GenericFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, multihypo::Vector{<:Real}=Float64[], certainhypo::Vector{Int}=Int[], x9::Int=0) where {T, S} = new{T,S}(x1, x2, x3, x4, x5, x6, multihypo, certainhypo, x9)
3636
# GenericFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, x7::String) where {T, S} = new{T,S}(x1, x2, x3, x4, x5, x6, x7)
3737
end
3838

@@ -43,9 +43,9 @@ end
4343

4444
# Simply for convenience - don't export, TODO Its used in IIF so maybe it should be exported
4545
const PackedFunctionNodeData{T} = GenericFunctionNodeData{T, <: AbstractString}
46-
PackedFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, x7::String="", x8::Vector{Int}=Int[], x9::Int=0) where {T <: PackedInferenceType, S <: AbstractString} = GenericFunctionNodeData(x1, x2, x3, x4, x5, x6, x7, x8, x9)
46+
PackedFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, multihypo::Vector{Float64}=[], certainhypo::Vector{Int}=Int[], x9::Int=0) where {T <: PackedInferenceType, S <: AbstractString} = GenericFunctionNodeData(x1, x2, x3, x4, x5, x6, multihypo, certainhypo, x9)
4747
const FunctionNodeData{T} = GenericFunctionNodeData{T, Symbol}
48-
FunctionNodeData(x1, x2, x3, x4, x5::Symbol, x6::T, x7::String="", x8::Vector{Int}=Int[], x9::Int=0) where {T <: Union{FunctorInferenceType, ConvolutionObject}}= GenericFunctionNodeData{T, Symbol}(x1, x2, x3, x4, x5, x6, x7, x8, x9)
48+
FunctionNodeData(x1, x2, x3, x4, x5::Symbol, x6::T, multihypo::Vector{Float64}=[], certainhypo::Vector{Int}=Int[], x9::Int=0) where {T <: Union{FunctorInferenceType, ConvolutionObject}}= GenericFunctionNodeData{T, Symbol}(x1, x2, x3, x4, x5, x6, multihypo, certainhypo, x9)
4949

5050
##==============================================================================
5151
## Factors

src/services/AbstractDFG.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,8 @@ NOTE: copyGraphMetadata not supported yet.
855855
"""
856856
function _copyIntoGraph!(sourceDFG::G, destDFG::H, variableFactorLabels::Vector{Symbol}, includeOrphanFactors::Bool=false; copyGraphMetadata::Bool=false)::Nothing where {G <: AbstractDFG, H <: AbstractDFG}
857857
# Split into variables and factors
858+
includeOrphanFactors && (@error "Adding orphaned factors is not supported")
859+
858860
sourceVariables = map(vId->getVariable(sourceDFG, vId), intersect(listVariables(sourceDFG), variableFactorLabels))
859861
sourceFactors = map(fId->getFactor(sourceDFG, fId), intersect(listFactors(sourceDFG), variableFactorLabels))
860862
if length(sourceVariables) + length(sourceFactors) != length(variableFactorLabels)
@@ -883,7 +885,7 @@ function _copyIntoGraph!(sourceDFG::G, destDFG::H, variableFactorLabels::Vector{
883885
# Only if we have all of them should we add it (otherwise strange things may happen on evaluation)
884886
if includeOrphanFactors || length(factVariableIds) == length(sourceFactorVariableIds)
885887
if !exists(destDFG, factor)
886-
addFactor!(destDFG, factVariableIds, deepcopy(factor))
888+
addFactor!(destDFG, deepcopy(factor))
887889
end
888890
end
889891
end

test/iifInterfaceTests.jl

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -434,23 +434,25 @@ end
434434
# Only returns x1 and x2
435435
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
436436
# Test include orphan factorsVoid
437-
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 1, true)
438-
@test symdiff([:x1, :x1x2f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
439-
# Test adding to the dfg
440-
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 2, true, dfgSubgraph)
441-
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
442-
#
437+
@test_broken begin
438+
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 1, true)
439+
@test symdiff([:x1, :x1x2f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
440+
# Test adding to the dfg
441+
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 2, true, dfgSubgraph)
442+
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
443+
end
443444
dfgSubgraph = getSubgraph(dfg,[:x1, :x2, :x1x2f1])
444445
# Only returns x1 and x2
445446
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
446447

447-
# DFG issue #201 Test include orphan factors with filtering - should only return x7 with solvable=1
448-
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=0)
449-
@test symdiff([:x7, :x8, :x7x8f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
450-
# Filter - always returns the node you start at but filters around that.
451-
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=1)
452-
@test symdiff([:x7x8f1, :x7], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
453-
448+
@test_broken begin
449+
# DFG issue #201 Test include orphan factors with filtering - should only return x7 with solvable=1
450+
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=0)
451+
@test symdiff([:x7, :x8, :x7x8f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
452+
# Filter - always returns the node you start at but filters around that.
453+
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=1)
454+
@test symdiff([:x7x8f1, :x7], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
455+
end
454456
# DFG issue #95 - confirming that getSubgraphAroundNode retains order
455457
# REF: https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/95
456458
for fId in listVariables(dfg)

test/interfaceTests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,20 @@ end
8282
@testset "Connectivity Test" begin
8383
ConnectivityTest(testDFGAPI)
8484
end
85+
86+
87+
@testset "Copy Functions" begin
88+
89+
fg = testDFGAPI()
90+
addVariable!(fg, DFGVariable(:a, TestSofttype1()))
91+
addVariable!(fg, DFGVariable(:b, TestSofttype1()))
92+
addVariable!(fg, DFGVariable(:c, TestSofttype1()))
93+
addFactor!(fg, DFGFactor(:f1, [:a,:b,:c], GenericFunctionNodeData{TestFunctorInferenceType1, Symbol}()))
94+
95+
fgcopy = testDFGAPI()
96+
DFG._copyIntoGraph!(fg, fgcopy, union(ls(fg), lsf(fg)))
97+
98+
@test getVariableOrder(fg,:f1) == getVariableOrder(fgcopy,:f1)
99+
100+
101+
end

test/testBlocks.jl

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -944,18 +944,21 @@ function GettingNeighbors(testDFGAPI; VARTYPE=DFGVariable, FACTYPE=DFGFactor)
944944
end
945945

946946
function GettingSubgraphs(testDFGAPI; VARTYPE=DFGVariable, FACTYPE=DFGFactor)
947+
947948
# "Getting Subgraphs"
948949
dfg, verts, facs = connectivityTestGraph(testDFGAPI, VARTYPE=VARTYPE, FACTYPE=FACTYPE)
949950
# Subgraphs
950951
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 2)
951952
# Only returns x1 and x2
952953
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
953954
# Test include orphan factors
954-
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 1, true)
955-
@test symdiff([:x1, :x1x2f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
956-
# Test adding to the dfg
957-
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 2, true, dfgSubgraph)
958-
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
955+
@test_broken begin
956+
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 1, true)
957+
@test symdiff([:x1, :x1x2f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
958+
# Test adding to the dfg
959+
dfgSubgraph = getSubgraphAroundNode(dfg, verts[1], 2, true, dfgSubgraph)
960+
@test symdiff([:x1, :x1x2f1, :x2], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
961+
end
959962
#
960963
dfgSubgraph = getSubgraph(dfg,[:x1, :x2, :x1x2f1])
961964
# Only returns x1 and x2
@@ -964,11 +967,13 @@ function GettingSubgraphs(testDFGAPI; VARTYPE=DFGVariable, FACTYPE=DFGFactor)
964967
#TODO if not a LightDFG with and summary or skeleton
965968
if VARTYPE == DFGVariable
966969
# DFG issue #201 Test include orphan factors with filtering - should only return x7 with solvable=1
967-
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=0)
968-
@test symdiff([:x7, :x8, :x7x8f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
969-
# Filter - always returns the node you start at but filters around that.
970-
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=1)
971-
@test symdiff([:x7x8f1, :x7], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
970+
@test_broken begin
971+
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=0)
972+
@test symdiff([:x7, :x8, :x7x8f1], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
973+
# Filter - always returns the node you start at but filters around that.
974+
dfgSubgraph = getSubgraphAroundNode(dfg, getFactor(dfg, :x7x8f1), 1, true, solvable=1)
975+
@test symdiff([:x7x8f1, :x7], [ls(dfgSubgraph)..., lsf(dfgSubgraph)...]) == []
976+
end
972977
# Test for distance = 2, should return orphans
973978
setSolvable!(dfg, :x8x9f1, 0)
974979
dfgSubgraph = getSubgraphAroundNode(dfg, getVariable(dfg, :x8), 2, true, solvable=1)
@@ -985,6 +990,7 @@ function GettingSubgraphs(testDFGAPI; VARTYPE=DFGVariable, FACTYPE=DFGFactor)
985990
@test fact._variableOrderSymbols == getFactor(dfg, fact.label)._variableOrderSymbols
986991
end
987992
end
993+
988994
end
989995

990996
#TODO Summaries and Summary Graphs

0 commit comments

Comments
 (0)