Skip to content

Commit

Permalink
Merge pull request #547 from JuliaRobotics/master
Browse files Browse the repository at this point in the history
v0.8.4-rc1
  • Loading branch information
dehann authored Jan 17, 2020
2 parents cab8298 + 240b522 commit 1c70672
Show file tree
Hide file tree
Showing 38 changed files with 1,472 additions and 602 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CompatHelper

on:
schedule:
- cron: '20 00 * * *'
issues:
types: [opened, reopened]

jobs:
CompatHelper:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1.2.0]
julia-arch: [x86]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia -e 'using CompatHelper; CompatHelper.main()'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ test/tmp/*.dot
test/tmp/*.tex

Manifest.toml

dev
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ arch:

julia:
- 1.0
- 1.1
- 1.2
- 1.3
- nightly
Expand All @@ -35,7 +34,7 @@ addons:
- dot2tex

before_script:
- pip install dot2tex
- if [ `arch` == x86_64 ]; then pip install dot2tex; fi

# script:
# - julia --color=yes -e 'using Pkg; Pkg.build()'
Expand Down
12 changes: 8 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name = "IncrementalInference"
uuid = "904591bb-b899-562f-9e6f-b8df64c7d480"
keywords = ["mm-iSAM", "SLAM", "inference", "sum-product", "belief-propagation"]
desc = "Implements the multimodal iSAM algorithm."
version = "0.8.3"
version = "0.8.4"

[deps]
ApproxManifoldProducts = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Expand All @@ -20,6 +21,7 @@ JSON2 = "2535ab7d-5cd8-5a07-80ac-9b1792aadce3"
KernelDensityEstimate = "2472808a-b354-52ea-a80e-1658a3c6056d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Expand All @@ -33,17 +35,19 @@ SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"

[compat]
ApproxManifoldProducts = "0.1, 0.2"
DistributedFactorGraphs = "0.5.2"
Combinatorics = "1.0"
DistributedFactorGraphs = "0.5.3"
Distributions = "0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25, 1"
DocStringExtensions = "0.7, 0.8, 0.9, 0.10, 1"
DocStringExtensions = "0.8, 0.9, 0.10, 1"
FileIO = "1.0.2, 1.1, 1.2"
FunctionalStateMachine = "0.1, 0.2"
Graphs = "0.10.2, 0.11, 1"
JLD2 = "0.1, 0.2, 0.3, 1.0"
JSON2 = "0.3, 0.4, 0.5, 0.6, 0.7, 1"
KernelDensityEstimate = "0.5.1, 0.6"
MetaGraphs = "0.6.4"
NLsolve = "3, 4"
Optim = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23 1"
Optim = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 1"
ProgressMeter = "0.6, 0.7, 0.8, 0.9, 1"
Reexport = "0.2, 0.3, 0.4, 0.5, 1"
Requires = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10, 1"
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# IncrementalInference.jl

[![Build Status](https://travis-ci.org/JuliaRobotics/IncrementalInference.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/IncrementalInference.jl)
[![codecov.io](https://codecov.io/github/JuliaRobotics/IncrementalInference.jl/coverage.svg?branch=master)](https://codecov.io/github/JuliaRobotics/IncrementalInference.jl?branch=master)
> Click on badges to follow links
Stable | Dev | Coverage | Documentation
-------|-----|----------|--------------
[![Build Status](https://travis-ci.org/JuliaRobotics/IncrementalInference.jl.svg?branch=master)](https://travis-ci.org/JuliaRobotics/IncrementalInference.jl) | [![Build Status](https://travis-ci.org/JuliaRobotics/IncrementalInference.jl.svg?branch=release/v0.8)](https://travis-ci.org/JuliaRobotics/IncrementalInference.jl) | [![codecov.io](https://codecov.io/github/JuliaRobotics/IncrementalInference.jl/coverage.svg?branch=master)](https://codecov.io/github/JuliaRobotics/IncrementalInference.jl?branch=master) | [![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/Caesar.jl/latest/)

Optimization routines for incremental non-parametric and parametric solutions based on factor graphs and the Bayes (Junction) tree implemented in the [Julia language](http://www.julialang.org/) (and [JuliaPro](http://www.juliacomputing.com)).

Expand All @@ -11,10 +14,6 @@ Optimization routines for incremental non-parametric and parametric solutions ba

This package furthermore forms a cardinal piece of the [Caesar.jl](https://github.com/JuliaRobotics/Caesar.jl) robotics toolkit, including 3D visualization and database interaction, which can serve as a base station for a robotic platform. A standalone [Robot Motion Estimate](https://github.com/JuliaRobotics/RoME.jl) package is also available.

# Documentation

Please see the [common Caesar.jl documentation](http://juliarobotics.github.io/Caesar.jl/latest/):
[![docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://juliarobotics.github.io/Caesar.jl/latest/)

Introduction
------------
Expand Down
98 changes: 98 additions & 0 deletions examples/TreeAnalysis.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Showcasing the available analysis tools for the Bayes (Junction) tree.
# using Revise

using IncrementalInference
using DistributedFactorGraphs # For `isSolvable` function.
using Combinatorics # For creating the variable ordering `permutations`.
using SuiteSparse.CHOLMOD: SuiteSparse_long # For CCOLAMD constraints.
using Gadfly # For histogram and scatter plots.
Gadfly.set_default_plot_size(35cm,25cm)


latex_fonts = Theme(major_label_font="CMU Serif", major_label_font_size=16pt,
minor_label_font="CMU Serif", minor_label_font_size=14pt,
key_title_font="CMU Serif", key_title_font_size=12pt,
key_label_font="CMU Serif", key_label_font_size=10pt)
Gadfly.push_theme(latex_fonts)

# Get tree for each variable ordering in a factor graph.
fg = generateCanonicalFG_Kaess(graphinit=false)
all_trees = getAllTrees(deepcopy(fg))

# scores stores: (tree key ID, nnz, cost fxn 1, cost fxn 2).
unsorted_scores = Vector{Tuple{Int, Float64, Float64, Float64}}()
for key in keys(all_trees)
e = all_trees[key] # (Bayes tree, var order, nnz
tree = e[1] # Get the Bayes tree.
cost1 = getTreeCost_01(tree)
cost2 = getTreeCost_02(tree)
push!(unsorted_scores, (key, e[3], cost1, cost2))
end

# Sort them to make sure the keys are in order.
scores = sort(unsorted_scores)

# Separate scores into vectors for plotting.
all_nnzs = (x->(x[2])).(scores)
costs_01 = (x->(x[3])).(scores)
costs_02 = (x->(x[4])).(scores)

min_ids_02 = findall(x->x == minimum(costs_02), costs_02)
max_ids_02 = findall(x->x == maximum(costs_02), costs_02)

min_ids_nnz = findall(x->x == minimum(all_nnzs), all_nnzs)
max_ids_nnz = findall(x->x == maximum(all_nnzs), all_nnzs)

# Find the intersection between best on both rubrics (lower left quadrant).
best_ids = findall(x->x in min_ids_02, min_ids_nnz)
# Find good factorizations but bad trees (upper left quadrant).
bad_trees_good_mats_ids = findall(x->x in max_ids_02, min_ids_nnz)
# Find good trees with bad matrix factorizations (lower right quadrant).
good_trees_bad_mats_ids = min_ids_02[findall(x->x == maximum(all_nnzs[min_ids_02]), all_nnzs[min_ids_02])]

# Get AMDs variable ordering.
amd_ordering = getEliminationOrder(fg)
amd_tree = buildTreeFromOrdering!(deepcopy(fg), amd_ordering)
amd_tree_nnz = nnzTree(amd_tree)
amd_tree_cost02 = getTreeCost_02(amd_tree)

# Get CCOLAMD variable ordering. First bring in CCOLAMD.
include(normpath(Base.find_package("IncrementalInference"), "..", "ccolamd.jl"))
A, varsym, fctsym = getAdjacencyMatrixSparse(fg)
colamd_ordering = varsym[Ccolamd.ccolamd(A)]
colamd_tree = buildTreeFromOrdering!(deepcopy(fg), colamd_ordering)
colamd_tree_nnz = nnzTree(colamd_tree)
colamd_tree_cost02 = getTreeCost_02(colamd_tree)

# Now add the iSAM2 constraint.
cons = zeros(SuiteSparse_long, length(A.colptr) - 1)
cons[findall(x->x == :x3, varsym)[1]] = 1 # NOTE(tonioteran) hardcoded for Kaess' example.
ccolamd_ordering = varsym[Ccolamd.ccolamd(A, cons)]
ccolamd_tree = buildTreeFromOrdering!(deepcopy(fg), ccolamd_ordering)
ccolamd_tree_nnz = nnzTree(ccolamd_tree)
ccolamd_tree_cost02 = getTreeCost_02(ccolamd_tree)

# Plot data points and underlying histogram.
bincnt = 20
layers = []
push!(layers, Gadfly.layer(x=[amd_tree_nnz],
y=[amd_tree_cost02],
Theme(default_color=colorant"green")))
push!(layers, Gadfly.layer(x=[colamd_tree_nnz],
y=[colamd_tree_cost02],
Theme(default_color=colorant"blue")))
push!(layers, Gadfly.layer(x=[ccolamd_tree_nnz],
y=[ccolamd_tree_cost02],
Theme(default_color=colorant"red")))
push!(layers, Gadfly.layer(x=all_nnzs,
y=costs_02,
Geom.hexbin(xbincount=bincnt, ybincount=bincnt)))
pl = Gadfly.plot(layers...,
Guide.xlabel("Number of non zeros [int]"),
Guide.ylabel("Tree cost [cfxn2]"),
Guide.manual_color_key("",
["AMD", "COLAMD", "iSAM2"],
["green", "blue", "red"]))

img = SVG("vo_cost_canon_kaess.svg", 6inch, 6inch)
Gadfly.draw(img, pl)
6 changes: 3 additions & 3 deletions src/AdditionalUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Related
drawGraphCliq, spyCliqMat, drawTree, buildCliqSubgraphUp, buildSubgraphFromLabels!
"""
function drawCliqSubgraphUpMocking(fgl::G,
treel::BayesTree,
treel::AbstractBayesTree,
frontalSym::Symbol;
show::Bool=true,
filepath::String="/tmp/cliq_sfg.pdf",
Expand Down Expand Up @@ -57,7 +57,7 @@ drawCliqSubgraphUpMocking, drawGraph, drawTree
"""
function drawGraphCliq(hists::Dict{Int, <: Tuple},
step::Int,
tree::BayesTree,
tree::AbstractBayesTree,
frontal::Symbol;
show::Bool=true )
#
Expand All @@ -77,7 +77,7 @@ Related
printCliqHistorySummary
"""
function printCliqSummary(dfg::G,
cliq::Graphs.ExVertex,
cliq::TreeClique,
logger=ConsoleLogger() ) where G <: AbstractDFG
#
frtl = getCliqFrontalVarIds(cliq)
Expand Down
Loading

0 comments on commit 1c70672

Please sign in to comment.