Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update varValsAll_ref branch with latest master #1715

Merged
merged 9 commits into from
May 24, 2023
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.8'
- '1.9'
os:
- ubuntu-latest
arch:
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
arch:
- x64
version:
- '~1.9.0-0'
- '1.9'
group:
- 'basic_functional_group'
steps:
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
arch:
- x64
version:
- '1.8'
- '1.9'
group:
- 'test_cases_group'
steps:
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
os:
- ubuntu-latest
version:
- '1.8'
- '1.9'
arch:
- x64
group:
Expand Down
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "IncrementalInference"
uuid = "904591bb-b899-562f-9e6f-b8df64c7d480"
keywords = ["MM-iSAMv2", "Bayes tree", "junction tree", "Bayes network", "variable elimination", "graphical models", "SLAM", "inference", "sum-product", "belief-propagation"]
desc = "Implements the Multimodal-iSAMv2 algorithm."
version = "0.33.0"
version = "0.34.0"

[deps]
ApproxManifoldProducts = "9bbbb610-88a1-53cd-9763-118ce10c1f89"
Expand Down Expand Up @@ -31,12 +31,12 @@ NLSolversBase = "d41bc354-129a-5804-8e4c-c37616107c6c"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand All @@ -48,7 +48,7 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[compat]
ApproxManifoldProducts = "0.6.3, 0.7"
ApproxManifoldProducts = "0.7"
BSON = "0.2, 0.3"
Combinatorics = "1.0"
DataStructures = "0.16, 0.17, 0.18"
Expand All @@ -68,13 +68,13 @@ NLSolversBase = "7.6"
NLsolve = "3, 4"
Optim = "1"
OrderedCollections = "1"
PrecompileTools = "1"
ProgressMeter = "1"
RecursiveArrayTools = "2.31.1"
Reexport = "1"
Requires = "1"
PrecompileTools = "1"
StaticArrays = "1"
StatsBase = "0.32, 0.33"
StatsBase = "0.32, 0.33, 0.34"
StructTypes = "1"
TensorCast = "0.3.3, 0.4"
TimeZones = "1.3.1"
Expand Down
2 changes: 1 addition & 1 deletion src/ManifoldsExtentions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,5 @@ function getPointIdentity(
end

function getPointIdentity(G::RealCircleGroup, ::Type{T} = Float64) where {T <: Real}
return zero(T)
return [zero(T)] #FIXME we cannot support scalars yet
end
37 changes: 26 additions & 11 deletions src/services/NumericalCalculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,19 @@ function _solveCCWNumeric!(
islen1 = length(ccwl.partialDims) == 1 || ccwl.partial
# islen1 = length(cpt_.X[:, smpid]) == 1 || ccwl.partial

if ccwl.partial
target = view(ccwl.varValsAll[ccwl.varidx[]][smpid], ccwl.partialDims)
else
target = ccwl.varValsAll[ccwl.varidx[]][smpid];
end
# build the pre-objective function for this sample's hypothesis selection
unrollHypo!, target = _buildCalcFactorLambdaSample(
destVarVals,
ccwl,
smpid,
view(destVarVals, smpid), # SUPER IMPORTANT, this `target` is mem pointer that will be updated by optim library
ccwl.measurement,
_slack,
unrollHypo!, _ = _buildCalcFactorLambdaSample(
destVarVals,
ccwl,
smpid,
target,
# ccwl.measurement,
_slack,
)


Expand All @@ -440,8 +445,7 @@ function _solveCCWNumeric!(

# _hypoObj = (x) -> (target[] = x; unrollHypo!())
function _hypoObj(x)
# for partials we are relying on optim / manopt to not fiddle with unconstrained partial dims (thanks to zero gradients)
target[] = x
copyto!(target, x)
return unrollHypo!()
end

Expand All @@ -450,7 +454,13 @@ function _solveCCWNumeric!(
# target .+= _perturbIfNecessary(getFactorType(ccwl), length(target), perturb)
sfidx = ccwl.varidx[]
# do the parameter search over defined decision variables using Minimization
X = destVarVals[smpid]#[ccwl.partialDims]
if ccwl.partial
X = collect(view(ccwl.varValsAll[sfidx][smpid], ccwl.partialDims))
else
X = ccwl.varValsAll[sfidx][smpid][ccwl.partialDims]
end
# X = destVarVals[smpid]#[ccwl.partialDims]

retval = _solveLambdaNumeric(
getFactorType(ccwl),
_hypoObj,
Expand All @@ -466,7 +476,12 @@ function _solveCCWNumeric!(
end

# insert result back at the correct variable element location
copyto!(destVarVals[smpid][ccwl.partialDims], retval)
if ccwl.partial
ccwl.varValsAll[sfidx][smpid][ccwl.partialDims] .= retval
else
# copyto!(ccwl.varValsAll[sfidx][smpid], retval)
copyto!(destVarVals[smpid][ccwl.partialDims], retval)
end

return nothing
end
Expand Down
5 changes: 4 additions & 1 deletion test/testSpecialEuclidean2Mani.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ end

@testset "test propagateBelief w HeatmapSampler and init for PartialPriorPassThrough w Priors" begin
##

@test_broken begin
fg = initfg()

v0 = addVariable!(fg, :x0, SpecialEuclidean2)
Expand Down Expand Up @@ -426,6 +426,9 @@ saveDFG("/tmp/passthru", fg)
fg_ = loadDFG("/tmp/passthru.tar.gz")
Base.rm("/tmp/passthru.tar.gz")

@error "#FIXME test propagateBelief w HeatmapSampler ... broken on ci but not local"
return true
end

##
end
Expand Down