|
1 |
| -# using Revise |
| 1 | +using Revise |
2 | 2 | using Neo4j # So that DFG initializes the database driver.
|
3 | 3 | using RoME
|
4 | 4 | using DistributedFactorGraphs
|
5 | 5 | using Test, Dates
|
6 |
| - |
7 | 6 | # start with an empty factor graph object
|
8 | 7 | # fg = initfg()
|
9 | 8 | cloudFg = CloudGraphsDFG{SolverParams}("localhost", 7474, "neo4j", "test",
|
|
34 | 33 | # Right, let's copy it into local memory for solving...
|
35 | 34 | localFg = GraphsDFG{SolverParams}(params=SolverParams())
|
36 | 35 | DistributedFactorGraphs._copyIntoGraph!(cloudFg, localFg, union(getVariableIds(cloudFg), getFactorIds(cloudFg)), true)
|
| 36 | +# Duplicate for later |
| 37 | +localFgCopy = deepcopy(localFg) |
| 38 | + |
37 | 39 | # Some checks
|
38 | 40 | @test symdiff(getVariableIds(localFg), getVariableIds(cloudFg)) == []
|
39 | 41 | @test symdiff(getFactorIds(localFg), getFactorIds(cloudFg)) == []
|
40 | 42 | @test isFullyConnected(localFg)
|
41 | 43 | # Show it
|
42 | 44 | toDotFile(localFg, "/tmp/localfg.dot")
|
43 | 45 |
|
44 |
| -tree, smtasks = batchSolve!(localFg, treeinit=true, drawpdf=false, show=false, |
45 |
| - returntasks=true, limititers=50, |
46 |
| - upsolve=true, downsolve=true ) |
| 46 | +tree, smtasks = solveTree!(localFg) |
| 47 | + |
| 48 | +# solveTree!(cloudFg) |
47 | 49 |
|
48 |
| -# Testing writing estimates |
| 50 | +# Checking estimates |
49 | 51 | for variable in getVariables(localFg)
|
50 |
| - means = mean(getData(variable).val, dims=2)[:] |
51 |
| - variable.estimateDict[:default] = Dict{Symbol, VariableEstimate}(:Mean => VariableEstimate(:default, :Mean, means, now())) |
| 52 | + @show variable.label |
| 53 | + @show variable.estimateDict |
| 54 | + |
| 55 | + # means = mean(getData(variable).val, dims=2)[:] |
| 56 | + # variable.estimateDict[:default] = Dict{Symbol, VariableEstimate}(:Mean => VariableEstimate(:default, :Mean, means, now())) |
52 | 57 | end
|
53 | 58 |
|
| 59 | +bel = getKDE(getVariable(localFg, :x0)) |
| 60 | +bel |
| 61 | + |
54 | 62 | # Push updates back to cloud.
|
55 | 63 | updateGraphSolverData!(localFg, cloudFg, ls(localFg))
|
| 64 | + |
| 65 | +# Pull back to local |
| 66 | +updateGraphSolverData!(cloudFg, localFgCopy, ls(cloudFg)) |
0 commit comments