Skip to content

Commit f3485f9

Browse files
committed
WIP on cleanup (note - tests need a lot of TLC)
1 parent 7b12c3e commit f3485f9

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

docs/src/BuildingGraphs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Variables are added using IncrementalInference's `addVariable!` function. To cre
6464
- The variable's label (e.g. :x1 or :a)
6565
- The variable inference type (aka soft type), which is a subtype of InferenceVariable
6666

67-
**Note**: Once variables are initialized to a specific soft type, all variable node data (solver data) must use that type.
67+
**NOTE**: Once variables are initialized to a specific soft type, variable node data (solver data) is templated to that type.
6868

6969
In addition, the following optional parameters are provided:
7070
- Additional labels for the variable (in DFG these are referred to as tags)

docs/src/GraphData.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ There are three fundamental types of data in DFG:
1111

1212
The following is a guideline to using these parameters.
1313

14-
> Note: Some functions are direct accessors to the internal parameters, others are derived functions (e.g. getLabel(v) = v.label). In other cases the accessors are simplified ways to interact with the structures. We recommend using the accessors as the internal structure may change over time.
14+
**NOTE**: Some functions are direct accessors to the internal parameters, others are derived functions (e.g. getLabel(v) = v.label). In other cases the accessors are simplified ways to interact with the structures. We recommend using the accessors as the internal structure may change over time.
1515

16-
> Note: Adds in general throw an error if the element already exists. Update will update the element if it exists, otherwise it will add it.
16+
**NOTE**: Adds in general throw an error if the element already exists. Update will update the element if it exists, otherwise it will add it.
1717

18-
> Note: In general these functions will return an error if the respective element is not found. This is to avoid returning, say, nothing, which will be horribly confusing if you tried `getVariableSolverData(dfg, :a, :b)` and it returned nothing - which was missing, :a or :b, or was there a communication issue? We recommend coding defensively and trapping errors in critical portions of your user code.
18+
**NOTE**: In general these functions will return an error if the respective element is not found. This is to avoid returning, say, nothing, which will be horribly confusing if you tried `getVariableSolverData(dfg, :a, :b)` and it returned nothing - which was missing, :a or :b, or was there a communication issue? We recommend coding defensively and trapping errors in critical portions of your user code.
1919

20-
> Note: All data is passed by reference, so if you update the returned structure it will update in the graph. The database driver is an exception, and once the variable or factor is updated you need to call update* to persist the changes to the graph.
20+
**NOTE**: All data is passed by reference, so if you update the returned structure it will update in the graph. The database driver is an exception, and once the variable or factor is updated you need to call update* to persist the changes to the graph.
2121

2222
The following examples make use this data:
2323

@@ -87,9 +87,16 @@ getSofttype
8787

8888
#### Packed Parametric Estimates
8989

90-
Solved graphs contain estimates for the variables, which are keyed by the solution (the default is saved as :default).
90+
Solved graphs contain packed parametric estimates for the variables, which are keyed by the solution (the default is saved as :default).
9191

9292
```@docs
93+
getMaxPPE
94+
getMeanPPE
95+
getSuggestedPPE
96+
getVariablePPE
97+
getPPE
98+
getVariablePPEs
99+
getPPEs
93100
```
94101

95102
#### Solver Data
File renamed without changes.

test/fileDFGTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#TODO fix this to use accessors
1414
verts[7].solvable = 1
1515
verts[8].solvable = 0
16-
solverData(verts[8]).solveInProgress = 1
16+
getSolverData(verts[8]).solveInProgress = 1
1717
#call update to set it on cloud
1818
updateVariable!(dfg, verts[7])
1919
updateVariable!(dfg, verts[8])

test/interfaceTests.jl

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,31 @@ end
158158

159159
@test getVariablePPEs(v1) == v1.ppeDict
160160
@test getVariablePPE(v1, :notfound) == nothing
161-
@test solverData(v1) === v1.solverDataDict[:default]
161+
@test getSolverData(v1) === v1.solverDataDict[:default]
162162
@test getData(v1) === v1.solverDataDict[:default]
163163
@test solverData(v1, :default) === v1.solverDataDict[:default]
164164
@test getSolverDataDict(v1) == v1.solverDataDict
165165
@test getInternalId(v1) == v1._internalId
166166

167+
# Add new VND of type ContinuousScalar to :x0
168+
# Could also do VariableNodeData(ContinuousScalar())
169+
vnd = VariableNodeData{ContinuousScalar}()
170+
addVariableSolverData!(dfg, :a, vnd, :parametric)
171+
@show listVariableSolverData(dfg, :a)
172+
# Get the data back - note that this is a reference to above.
173+
vndBack = getVariableSolverData(dfg, :a, :parametric)
174+
# Delete it
175+
deleteVariableSolverData!(dfg, :a, :parametric)
176+
# Update add it
177+
updateVariableSolverData!(dfg, :a, vnd, :parametric)
178+
# Update update it
179+
updateVariableSolverData!(dfg, :a, vnd, :parametric)
180+
# Bulk copy update x0 and x1
181+
updateVariableSolverData!(dfg, [v1, v2], :default)
182+
# Delete parametric from v1
183+
deleteVariableSolverData!(dfg, :a, :parametric)
184+
185+
167186
#TODO I don't know what is supposed to happen to softtype
168187
@test getSofttype(v1) == st1
169188
@test getSofttype(v2) == st2

0 commit comments

Comments
 (0)