Skip to content

Commit 745f09a

Browse files
committed
add solveCount
1 parent ed9fb94 commit 745f09a

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export InferenceType, PackedInferenceType, FunctorInferenceType, InferenceVariab
2323
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
2424
export getMaxPPE, getMeanPPE, getSuggestedPPE, getVariablePPE, getPPE, getVariablePPEs, getPPEs #, getEstimates
2525
export timestamp # DEPRECATED
26+
export getSolved, isSolved, setSolved!
2627
export label, getTimestamp, setTimestamp!, tags, setTags!, estimates, estimate, data, softtype, solverData, getData, solverDataDict, setSolverData, setSolverData!, internalId, smallData, setSmallData!, bigData
2728
export DFGVariableSummary, DFGFactorSummary, AbstractDFGSummary
2829
export addBigDataEntry!, getBigDataEntry, updateBigDataEntry!, deleteBigDataEntry!, getBigDataEntries, getBigDataKeys

src/entities/DFGVariable.jl

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ mutable struct DFGVariable <: AbstractDFGVariable
150150
smallData::Dict{String, String}
151151
bigData::Dict{Symbol, AbstractBigDataEntry}
152152
solvable::Int
153+
solveCount::Int
153154
_internalId::Int64
154155
end
155156

@@ -166,14 +167,14 @@ function DFGVariable(label::Symbol, _internalId::Int64 = 0) #where {T <:Inferenc
166167
Dict{Symbol, MeanMaxPPE}(),
167168
Dict{Symbol, VariableNodeData{T}}(:default => VariableNodeData()),
168169
Dict{String, String}(),
169-
Dict{Symbol,AbstractBigDataEntry}(), 0, _internalId)
170+
Dict{Symbol,AbstractBigDataEntry}(), 0, 0, _internalId)
170171
end
171172
DFGVariable(label::Symbol, softtype::T, _internalId::Int64 = 0) where {T <: InferenceVariable} =
172173
DFGVariable(label, now(), Symbol[],
173174
Dict{Symbol, MeanMaxPPE}(),
174175
Dict{Symbol, VariableNodeData{T}}(:default => VariableNodeData{T}()),
175176
Dict{String, String}(),
176-
Dict{Symbol,AbstractBigDataEntry}(), 0, _internalId)
177+
Dict{Symbol,AbstractBigDataEntry}(), 0, 0, _internalId)
177178

178179
"""
179180
$(SIGNATURES)
@@ -184,7 +185,7 @@ mutable struct DFGVariableSummary <: AbstractDFGVariable
184185
timestamp::DateTime
185186
tags::Vector{Symbol}
186187
ppeDict::Dict{Symbol, <:AbstractPointParametricEst}
187-
softtypename::Symbol
188+
softtypename::Symbol # should be removed
188189
_internalId::Int64
189190
end
190191

@@ -273,8 +274,38 @@ TODO, DO NOT USE v.softtypename in DFGVariableSummary
273274
"""
274275
getSofttype(v::DFGVariableSummary)::Symbol = v.softtypename
275276

277+
"""
278+
$SIGNATURES
279+
280+
Get the number of times a variable has been inferred -- i.e. `solveCount`.
276281
282+
Related
283+
284+
isSolved, setSolved!
285+
"""
286+
getSolved(v::VariableDataLevel2) = v.solveCount
277287

288+
"""
289+
$SIGNATURES
290+
291+
Boolena on whether the variable has been solved.
292+
293+
Related
294+
295+
getSolved, setSolved!
296+
"""
297+
isSolved(v::VariableDataLevel2)::Bool = 0 < getSolved(v)
298+
299+
"""
300+
$SIGNATURES
301+
302+
Update/set the `solveCount` value.
303+
304+
Related
305+
306+
getSolved, isSolved
307+
"""
308+
setSolved!(v::VariableDataLevel2, val::Int) = v.solveCount = val
278309

279310
"""
280311
$SIGNATURES

0 commit comments

Comments
 (0)