Skip to content

Commit

Permalink
working skeleton dfg variables and factors.
Browse files Browse the repository at this point in the history
label, tags and order
  • Loading branch information
Affie committed Oct 2, 2019
1 parent 3c44f92 commit 1e11bc0
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/DistributedFactorGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include("entities/AbstractDFGSummary.jl")

export AbstractDFG
export AbstractParams, NoSolverParams
export DFGNode, DFGVariable, DFGFactor
export DFGNode, DFGVariable, DFGFactor, AbstractDFGVariable, AbstractDFGFactor
export InferenceType, PackedInferenceType, FunctorInferenceType, InferenceVariable, ConvolutionObject
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
export label, timestamp, tags, estimates, estimate, data, solverData, getData, solverDataDict, setSolverData, internalId, smallData, bigData
Expand Down Expand Up @@ -81,4 +81,6 @@ end
# To be moved as necessary.
include("Common.jl")

#experimental skeleton
include("SkeletonDFGDev.jl")
end
9 changes: 6 additions & 3 deletions src/LightDFG/services/LightDFG.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ function addFactor!(dfg::LightDFG{<:AbstractParams, V, F}, variables::Vector{V},

variableLabels = map(v->v.label, variables)

factor._variableOrderSymbols = copy(variableLabels)

resize!(factor._variableOrderSymbols, length(variableLabels))
factor._variableOrderSymbols .= variableLabels
# factor._variableOrderSymbols = copy(variableLabels)

return FactorGraphs.addFactor!(dfg.g, variableLabels, factor)
end
Expand All @@ -88,7 +89,9 @@ function addFactor!(dfg::LightDFG{<:AbstractParams, <:AbstractDFGVariable, F}, v
error("Factor '$(factor.label)' already exists in the factor graph")
end

factor._variableOrderSymbols = variableLabels
resize!(factor._variableOrderSymbols, length(variableLabels))
factor._variableOrderSymbols .= variableLabels
# factor._variableOrderSymbols = copy(variableLabels)

return FactorGraphs.addFactor!(dfg.g, variableLabels, factor)
end
Expand Down
29 changes: 29 additions & 0 deletions src/SkeletonDFGDev.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
$(TYPEDEF)
Skeleton variable with essentials.
"""
struct SkeletonDFGVariable <: AbstractDFGVariable
label::Symbol
tags::Vector{Symbol}
end

SkeletonDFGVariable(label::Symbol) = SkeletonDFGVariable(label, Symbol[])

label(v::SkeletonDFGVariable) = v.label
tags(v::SkeletonDFGVariable) = v.tags

"""
$(TYPEDEF)
Skeleton factor with essentials.
"""
struct SkeletonDFGFactor <: AbstractDFGFactor
label::Symbol
tags::Vector{Symbol}
_variableOrderSymbols::Vector{Symbol}
#TODO consider changing this to a NTyple with parameter N:
# _variableOrderSymbols::NTuple{N,Symbol}
end
SkeletonDFGFactor(label::Symbol) = SkeletonDFGFactor(label, Symbol[], Symbol[])

label(f::SkeletonDFGFactor) = f.label
tags(f::SkeletonDFGFactor) = f.tags

0 comments on commit 1e11bc0

Please sign in to comment.