Skip to content

Commit a8a2d28

Browse files
committed
VariableCompute -> VariableDFG
1 parent 93ffb0c commit a8a2d28

19 files changed

Lines changed: 230 additions & 166 deletions

docs/src/DataStructure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Accessible properties for each of the variable structures:
1717
|---------------------|-------|-----------|------|-----------|-----------|----------|-------------|----------|--------------|
1818
| VariableSkeleton | X | | X | | | | | | |
1919
| VariableSummary | X | X | X | X | Symbol | | | | X |
20-
| VariableCompute | X | X | X | X | X | X | X | X | X |
20+
| VariableDFG | X | X | X | X | X | X | X | X | X |
2121

2222
Accessible properties for each of the factor structures:
2323

src/Deprecated.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ end
5858
# isSolvable
5959
# """
6060
function getSolveInProgress(
61-
var::Union{VariableCompute, FactorCompute},
61+
var::Union{VariableDFG, FactorCompute},
6262
solveKey::Symbol = :default,
6363
)
6464
# Variable
65-
if var isa VariableCompute
65+
if var isa VariableDFG
6666
if haskey(refStates(var), solveKey)
6767
return refStates(var)[solveKey].solveInProgress
6868
else
@@ -76,7 +76,7 @@ end
7676
#TODO missing set solveInProgress and graph level accessor
7777

7878
function isSolveInProgress(
79-
node::Union{VariableCompute, FactorCompute},
79+
node::Union{VariableDFG, FactorCompute},
8080
solvekey::Symbol = :default,
8181
)
8282
return getSolveInProgress(node, solvekey) > 0
@@ -321,6 +321,12 @@ function updateBlob!(args...)
321321
return error("updateBlob! is obsolete as blobid=>Blob pairs are immutable.")
322322
end
323323

324+
function setTags!(node, tags::Union{Vector{Symbol}, Set{Symbol}})
325+
Base.depwarn("setTags! is deprecated, use mergeTags! or addTags! instead.", :setTags!)
326+
node.tags !== tags && empty!(node.tags)
327+
return union!(node.tags, tags)
328+
end
329+
324330
## ================================================================================
325331
## Deprecated in v0.28
326332
##=================================================================================

src/DistributedFactorGraphs.jl

Lines changed: 80 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ using Tables
4444
# used for @defStateType
4545
import ManifoldsBase
4646
using ManifoldsBase: AbstractManifold, manifold_dimension
47-
export AbstractManifold, manifold_dimension
47+
export AbstractManifold
4848

4949
using RecursiveArrayTools: ArrayPartition
5050
export ArrayPartition
@@ -64,26 +64,30 @@ export AbstractBlobstore, Blobstore
6464
export AbstractGraphNode, GraphNode
6565
export AbstractGraphVariable, GraphVariable
6666
export AbstractGraphFactor, GraphFactor
67-
export AbstractPackedObservation, PackedObservation
6867
export AbstractObservation, Observation
6968
export AbstractPriorObservation, PriorObservation
7069
export AbstractRelativeObservation, RelativeObservation
7170
export AbstractFactorCache, FactorCache
7271
export AbstractStateType, StateType
73-
export AbstractPackedBelief, PackedBelief
7472

7573
##------------------------------------------------------------------------------
7674
## Types
7775
##------------------------------------------------------------------------------
7876
#TODO types are not yet stable - also, we might not export types such as VariableCompute
7977
# Variables
80-
export VariableCompute, VariableDFG, VariableSummary, VariableSkeleton
78+
export VariableDFG
79+
export VariableSummary
80+
export VariableSkeleton
8181
# Factors
82-
export FactorDFG, FactorSummary, FactorSkeleton
82+
export FactorDFG
83+
export FactorSummary
84+
export FactorSkeleton
8385

86+
#TODO Still pending timestamp field name decision
8487
export Blobentry
8588

8689
export State
90+
export Agent
8791

8892
##------------------------------------------------------------------------------
8993
## Functions
@@ -234,19 +238,15 @@ export GraphsDFG
234238
# export addState!, getState, mergeState!, deleteState!
235239
# export addStates!, getStates, mergeStates!, deleteStates!
236240

237-
# export addBlobentry!, getBlobentry, mergeBlobentry!, deleteBlobentry! # historic for VariableBlobentry
238-
# export addBlobentries!, getBlobentries, mergeBlobentries!, deleteBlobentries!
239241
# export addVariableBlobentry!, getVariableBlobentry, mergeVariableBlobentry!, deleteVariableBlobentry!
240242
# export addVariableBlobentries!, getVariableBlobentries, mergeVariableBlobentries!, deleteVariableBlobentries!
241243
# export addGraphBlobentry!, getGraphBlobentry, mergeGraphBlobentry!, deleteGraphBlobentry!
242244
# export addGraphBlobentries!, getGraphBlobentries, mergeGraphBlobentries!, deleteGraphBlobentries!
243245
# export addAgentBlobentry!, getAgentBlobentry, mergeAgentBlobentry!, deleteAgentBlobentry!
244246
# export addAgentBlobentries!, getAgentBlobentries, mergeAgentBlobentries!, deleteAgentBlobentries!
245-
#TODO blob entries not implemented on factors yet
246247
# export addFactorBlobentry!, getFactorBlobentry, mergeFactorBlobentry!, deleteFactorBlobentry!
247248
# export addFactorBlobentries!, getFactorBlobentries, mergeFactorBlobentries!, deleteFactorBlobentries!
248249

249-
# TODO first pass progress
250250
# export addVariableBloblet!, getVariableBloblet, mergeVariableBloblet!, deleteVariableBloblet!
251251
# export addVariableBloblets!, getVariableBloblets, mergeVariableBloblets!, deleteVariableBloblets!
252252
# export addFactorBloblet!, getFactorBloblet, mergeFactorBloblet!, deleteFactorBloblet!
@@ -257,13 +257,45 @@ export GraphsDFG
257257
# export addGraphBloblets!, getGraphBloblets, mergeGraphBloblets!, deleteGraphBloblets!
258258

259259
## list
260-
# export listVariables, listFactors, listStates, listBlobentries, listFactorBlobEntries, listGraphBlobentries, listAgentBlobentries
261-
# not implemented yet (maybe not for DFG v1.0 yet):
262-
# export listVariableMetadata, listFactorMetadata, listAgentMetadata, listGraphMetadata
263-
# export listVariableBlobentryMetadata, listFactorBlobentryMetadata, listAgentBlobentryMetadata, listGraphBlobentryMetadata
260+
# export listVariables, listFactors, listStates, listVariableBlobentries, listFactorBlobEntries, listGraphBlobentries, listAgentBlobentries
261+
# export listVariableBloblets, listFactorBloblets, listAgentBloblets, listGraphBloblets
262+
263+
# tags
264+
# export listVariableTags, mergeVariableTags!, deleteVariableTags!
265+
# export listFactorTags, mergeFactorTags!, deleteFactorTags!
266+
# export listGraphTags, mergeGraphTags!, deleteGraphTags!
267+
# export listAgentTags, mergeAgentTags!, deleteAgentTags!
268+
269+
# has
270+
# export hasVariable, hasFactor, hasState
271+
# export hasVariableBlobentry, hasFactorBlobentry, hasGraphBlobentry, hasAgentBlobentry
272+
# export hasVariableBloblet, hasFactorBloblet, hasGraphBloblet, hasAgentBloblet
273+
# export hasVariableTags, hasFactorTags, hasGraphTags, hasAgentTags
264274

265275
export deleteVariables!
266276
export deleteFactors!
277+
278+
# Tags
279+
export listVariableTags
280+
export mergeVariableTags!
281+
export deleteVariableTags!
282+
export hasVariableTags
283+
284+
export listFactorTags
285+
export mergeFactorTags!
286+
export deleteFactorTags!
287+
export hasFactorTags
288+
289+
export listGraphTags
290+
export mergeGraphTags!
291+
export deleteGraphTags!
292+
export hasGraphTags
293+
294+
export listAgentTags
295+
export mergeAgentTags!
296+
export deleteAgentTags!
297+
export hasAgentTags
298+
267299
##==============================================================================
268300
## Common Accessors
269301
##==============================================================================
@@ -286,16 +318,6 @@ public FolderStore
286318
##------------------------------------------------------------------------------
287319
# tags is a set: get/list, merge, empty, and remove (we don't have add but merge)
288320

289-
export listVariableTags
290-
export listFactorTags
291-
export listGraphTags
292-
export listAgentTags
293-
294-
export mergeVariableTags!
295-
export mergeFactorTags!
296-
export mergeGraphTags!
297-
export mergeAgentTags!
298-
299321
public listTags
300322
public mergeTags!
301323
public emptyTags!
@@ -313,17 +335,44 @@ export mergeVariableBloblet!
313335
export deleteVariableBloblet!
314336
export listVariableBloblets
315337

338+
export addVariableBloblets!
339+
export getVariableBloblets
340+
export mergeVariableBloblets!
341+
export deleteVariableBloblets!
342+
316343
export getAgentBloblet
317344
export addAgentBloblet!
318345
export mergeAgentBloblet!
319346
export deleteAgentBloblet!
320347
export listAgentBloblets
321348

349+
export addAgentBloblets!
350+
export getAgentBloblets
351+
export mergeAgentBloblets!
352+
export deleteAgentBloblets!
353+
322354
export getGraphBloblet
323355
export addGraphBloblet!
324356
export mergeGraphBloblet!
325357
export deleteGraphBloblet!
326358
export listGraphBloblets
359+
360+
export addGraphBloblets!
361+
export getGraphBloblets
362+
export mergeGraphBloblets!
363+
export deleteGraphBloblets!
364+
365+
export addFactorBloblet!
366+
export getFactorBloblet
367+
export mergeFactorBloblet!
368+
export deleteFactorBloblet!
369+
export listFactorBloblets
370+
371+
export addFactorBloblets!
372+
export getFactorBloblets
373+
export mergeFactorBloblets!
374+
export deleteFactorBloblets!
375+
327376
##------------------------------------------------------------------------------
328377
## FileDFG
329378
##------------------------------------------------------------------------------
@@ -344,9 +393,6 @@ export lsf # alias for listFactors
344393
## Other utility functions
345394
##------------------------------------------------------------------------------
346395

347-
export listNeighborhood
348-
export listNeighbors
349-
350396
## TODO maybe move to DFG from SDK
351397
# addAgent!
352398
# deleteAgent!
@@ -371,7 +417,8 @@ public getStateKind
371417
# list of unstable functions not exported any more
372418
# will move to public or deprecate over time
373419
const unstable_functions::Vector{Symbol} = [
374-
:getTags,
420+
:listNeighborhood,
421+
:listNeighbors,
375422
:InMemoryBlobstore,
376423
:exists,
377424
:compare,
@@ -451,12 +498,17 @@ const unstable_functions::Vector{Symbol} = [
451498
:setSolverParams!,
452499
:setDescription!,
453500
:setSolvable!,
454-
:setTags!,
455501
:setSolvedCount!,
456502
:setMarginalized!,
457503
# no set on these
458504

459505
#deprecated in v0.29
506+
:setTags!,
507+
:VariableCompute,
508+
:AbstractPackedBelief,
509+
:PackedBelief,
510+
:AbstractPackedObservation,
511+
:PackedObservation,
460512
:updateMetadata!,## TODO deprecated or obsolete
461513
:updateBlob!,## TODO deprecated or obsolete
462514
:getFactorState, # FIXME getFactorState were questioned and being reviewed again for name, other than that they are checked.

src/FileDFG/services/FileDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function loadDFG!(
118118
# extract the factor graph from fileDFG folder
119119
variablefiles = readdir(joinpath(loaddir, "variables"); sort = false, join = true)
120120

121-
# type instability on `variables` as either `::Vector{Variable}` or `::Vector{VariableCompute{<:}}` (vector of abstract)
121+
# type instability on `variables` as either `::Vector{Variable}` or `::Vector{VariableDFG{<:}}` (vector of abstract)
122122
variables = @showprogress dt=1 desc = "loading variables" asyncmap(
123123
variablefiles,
124124
) do file

src/GraphsDFG/entities/GraphsDFG.jl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,18 @@ function GraphsDFG{T, V, F}(
8282
return GraphsDFG{T, V, F}(g, solverParams, blobStores, graph, agent)
8383
end
8484

85-
# GraphsDFG{T}(; kwargs...) where T <: AbstractDFGParams = GraphsDFG{T,VariableCompute,FactorDFG}(;kwargs...)
85+
# GraphsDFG{T}(; kwargs...) where T <: AbstractDFGParams = GraphsDFG{T,VariableDFG,FactorDFG}(;kwargs...)
8686
function GraphsDFG{T}(
87-
g::FactorGraph{Int, VariableCompute, FactorDFG} = FactorGraph{
88-
Int,
89-
VariableCompute,
90-
FactorDFG,
91-
}();
87+
g::FactorGraph{Int, VariableDFG, FactorDFG} = FactorGraph{Int, VariableDFG, FactorDFG}();
9288
kwargs...,
9389
) where {T <: AbstractDFGParams}
94-
return GraphsDFG{T, VariableCompute, FactorDFG}(g; kwargs...)
90+
return GraphsDFG{T, VariableDFG, FactorDFG}(g; kwargs...)
9591
end
9692

9793
function GraphsDFG(
98-
g::FactorGraph{Int, VariableCompute, FactorDFG} = FactorGraph{
99-
Int,
100-
VariableCompute,
101-
FactorDFG,
102-
}();
94+
g::FactorGraph{Int, VariableDFG, FactorDFG} = FactorGraph{Int, VariableDFG, FactorDFG}();
10395
solverParams::T = NoSolverParams(),
10496
kwargs...,
10597
) where {T}
106-
return GraphsDFG{T, VariableCompute, FactorDFG}(g; solverParams, kwargs...)
98+
return GraphsDFG{T, VariableDFG, FactorDFG}(g; solverParams, kwargs...)
10799
end

src/GraphsDFG/services/GraphsDFG.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,6 @@ function isConnected(dfg::GraphsDFG)
304304
# return length(Graphs.connected_components(dfg.g)) == 1
305305
end
306306

307-
_isSolvable(dfg::GraphsDFG, label::Symbol, ready::Nothing) = true
308-
309-
function _isSolvable(dfg::GraphsDFG, label::Symbol, ready::Int)
310-
haskey(dfg.g.variables, label) && (return dfg.g.variables[label].solvable[] >= ready)
311-
haskey(dfg.g.factors, label) && (return dfg.g.factors[label].solvable[] >= ready)
312-
throw(LabelNotFoundError(label))
313-
end
314-
315307
function listNeighbors(
316308
dfg::GraphsDFG,
317309
node::AbstractGraphNode;

src/entities/DFGVariable.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ end
327327
## Conversion constructors
328328
##==============================================================================
329329

330-
function VariableSummary(v::VariableCompute{T}) where {T}
330+
function VariableSummary(v::VariableDFG{T}) where {T}
331331
return VariableSummary(
332332
v.label,
333333
v.timestamp,

src/services/AbstractDFG.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,14 @@ function hasFactor end
144144

145145
"""
146146
$(SIGNATURES)
147-
Add a VariableCompute to a DFG.
147+
Add a VariableDFG to a DFG.
148148
Implement `addVariable!(dfg::AbstractDFG, variable::AbstractGraphVariable)`
149149
"""
150150
function addVariable! end
151151

152152
"""
153153
$(SIGNATURES)
154-
Add a Vector{VariableCompute} to a DFG.
154+
Add a Vector{VariableDFG} to a DFG.
155155
Implement `addVariables!(dfg::AbstractDFG, variables::Vector{<:AbstractGraphVariable})`
156156
"""
157157
function addVariables!(dfg::AbstractDFG, variables::Vector{<:AbstractGraphVariable})
@@ -179,7 +179,7 @@ end
179179

180180
"""
181181
$(SIGNATURES)
182-
Get a VariableCompute from a DFG using its label.
182+
Get a VariableDFG from a DFG using its label.
183183
Implement `getVariable(dfg::AbstractDFG, label::Symbol)`
184184
"""
185185
function getVariable end
@@ -259,7 +259,7 @@ end
259259

260260
"""
261261
$(SIGNATURES)
262-
Delete a VariableCompute from the DFG.
262+
Delete a VariableDFG from the DFG.
263263
Implement `deleteVariable!(dfg::AbstractDFG, label::Symbol)`
264264
"""
265265
function deleteVariable! end
@@ -315,7 +315,7 @@ end
315315
316316
Return whether `sym::Symbol` represents a variable vertex in the graph DFG.
317317
Checks whether it both exists in the graph and is a variable.
318-
(If you rather want a quick for type, just do node isa VariableCompute)
318+
(If you rather want a quick for type, just do node isa VariableDFG)
319319
Implement `isVariable(dfg::AbstractDFG, label::Symbol)`
320320
"""
321321
function isVariable end
@@ -358,7 +358,7 @@ function listNeighbors end
358358
#TODO should this signiture be standardized or removed?
359359
"""
360360
$(SIGNATURES)
361-
Get a VariableCompute with a specific solver key.
361+
Get a VariableDFG with a specific solver key.
362362
In memory types still return a reference, other types returns a variable with only solveKey.
363363
"""
364364
function getVariable(dfg::AbstractDFG, label::Symbol, solveKey::Symbol)

src/services/CompareUtils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ end
246246
Compare that all fields are the same in a `::FactorGraph` variable.
247247
"""
248248
function compareVariable(
249-
A::VariableCompute,
250-
B::VariableCompute;
249+
A::VariableDFG,
250+
B::VariableDFG;
251251
skip::Vector{Symbol} = Symbol[],
252252
show::Bool = true,
253253
skipsamples::Bool = true,

0 commit comments

Comments
 (0)