|
1 | 1 | using DistributedFactorGraphs
|
2 |
| -using IncrementalInference |
| 2 | +struct TestInferenceVariable1 <: InferenceVariable end |
| 3 | +a = DFGVariable(:a, TestInferenceVariable1()) |
| 4 | +b = copy(a) |
3 | 5 |
|
4 |
| -numNodes = 10 |
| 6 | +d1 = getSolverData(a) |
| 7 | +pop!(solverDataDict(a), :default) |
| 8 | +d2 = getSolverData(b) |
5 | 9 |
|
6 |
| -# dfg = LightDFG{SolverParams}() |
7 |
| -dfg = GraphsDFG{SolverParams}() |
8 |
| - |
9 |
| - |
10 |
| -#change ready and solvable for x7,x8 for improved tests on x7x8f1 |
11 |
| -verts = map(n -> addVariable!(dfg, Symbol("x$n"), ContinuousScalar, labels = [:POSE]), 1:numNodes) |
12 |
| -#TODO fix this to use accessors |
13 |
| -verts[7].solvable = 1 |
14 |
| -verts[8].solvable = 0 |
15 |
| -getSolverData(verts[8]).solveInProgress = 1 |
16 |
| -setSolvedCount!(verts[1], 5) |
17 |
| -#call update to set it on cloud |
18 |
| -updateVariable!(dfg, verts[7]) |
19 |
| -updateVariable!(dfg, verts[8]) |
20 |
| - |
21 |
| -# Add some bigData to x1, x2 |
22 |
| -addBigDataEntry!(verts[1], GeneralBigDataEntry(:testing, :testing; mimeType="application/nuthin!")) |
23 |
| -addBigDataEntry!(verts[2], FileBigDataEntry(:testing2, "/dev/null")) |
24 |
| -#call update to set it on cloud |
25 |
| -updateVariable!(dfg, verts[1]) |
26 |
| -updateVariable!(dfg, verts[2]) |
27 |
| - |
28 |
| -facts = map(n -> addFactor!(dfg, [verts[n], verts[n+1]], LinearConditional(Normal(50.0,2.0))), 1:(numNodes-1)) |
29 |
| - |
30 |
| -# Save and load the graph to test. |
31 |
| -filename = "/tmp/test123.tar.gz" |
32 |
| -saveDFG(dfg, filename) |
33 |
| - |
34 |
| -filename = "/tmp/test123.tar.gz" |
35 |
| -copyDfg = DistributedFactorGraphs._getDuplicatedEmptyDFG(dfg) |
36 |
| -@info "Going to load $filename" |
37 |
| -retDFG = loadDFG("/tmp/test1.tar.gz", Main, copyDfg) |
38 |
| - |
39 |
| -x2 = getVariable(dfg, :x2) |
40 |
| - |
41 |
| - |
42 |
| - |
43 |
| - |
44 |
| - |
45 |
| - |
46 |
| - |
47 |
| -x2ret = getVariable(retDFG, :x2) |
48 |
| -setSolvable!(x2ret, 0) |
49 |
| - |
50 |
| -x2 == x2ret |
51 |
| - |
52 |
| - |
53 |
| -using Test |
54 |
| -for var in ls(dfg) |
55 |
| - @test getVariable(dfg, var) == getVariable(retDFG, var) |
56 |
| -end |
57 |
| -for fact in lsf(dfg) |
58 |
| - @test getFactor(dfg, fact) == getFactor(retDFG, fact) |
59 |
| -end |
| 10 | +d1.dims = 6 |
| 11 | +d2.dims |
0 commit comments