Skip to content

Commit 932abd9

Browse files
committed
depr predictbelief use propagateBelief instead
1 parent 4cac5c3 commit 932abd9

File tree

7 files changed

+33
-17
lines changed

7 files changed

+33
-17
lines changed

src/Deprecated.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,12 @@ end
125125

126126

127127
@deprecate _prepCCW(w...;kw...) _createCCW(w...;kw...)
128-
@deprecate predictbelief(w...;asPartial::Bool=false,kw...) ((bel,ipc)=getPoints(propagateBelief(w...;asPartial,kw...)), (getPoints(bel),ipc))
128+
129+
predictbelief(w...;asPartial::Bool=false,kw...) = begin
130+
@warn("predictbelief is deprecated, use propagateBelief instead")
131+
bel,ipc = propagateBelief(w...;asPartial,kw...)
132+
getPoints(bel), ipc
133+
end
129134

130135
# """
131136
# $SIGNATURES
@@ -270,6 +275,9 @@ function Base.getproperty(ccw::CommonConvWrapper, f::Symbol)
270275
end
271276
end
272277

278+
279+
280+
273281
##==============================================================================
274282
## Deprecate code below before v0.35
275283
##==============================================================================

src/ExportAPI.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export CSMHistory,
153153
getNumPts,
154154
getBWVal,
155155
setBW!,
156+
setBelief!,
156157
setValKDE!,
157158
buildCliqSubgraph,
158159

src/services/EvalFactor.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ function computeAcrossHypothesis!(
159159
activehypo = hyporecipe.activehypo
160160
certainidx = hyporecipe.certainidx
161161

162-
@assert ccwl.certainhypo == hyporecipe.certainidx "expected hyporecipe.certainidx to be the same as cached in ccw"
162+
@assert ccwl.hyporecipe.certainhypo == hyporecipe.certainidx "expected hyporecipe.certainidx to be the same as cached in ccw"
163163
for (hypoidx, vars) in activehypo
164164
count += 1
165165

166166
# now do hypothesis specific
167167
if sfidx in certainidx && hypoidx != 0 || hypoidx in certainidx || hypoidx == sfidx
168168
# hypo case hypoidx, sfidx = $hypoidx, $sfidx
169169
# for i = 1:Threads.nthreads()
170-
resize!(ccwl.activehypo, length(vars))
171-
ccwl.activehypo[:] = vars
170+
resize!(ccwl.hyporecipe.activehypo, length(vars))
171+
ccwl.hyporecipe.activehypo[:] = vars
172172
# end
173173

174174
addEntr = view(destinationVarVals, allelements[count])
@@ -346,7 +346,7 @@ function evalPotentialSpecific(
346346
# nullSurplus see #1517
347347
runnullhypo = maximum((ccwl.nullhypo, nullSurplus))
348348
hyporecipe =
349-
_prepareHypoRecipe!(ccwl.hypotheses, maxlen, sfidx, length(variables), isinit, runnullhypo)
349+
_prepareHypoRecipe!(ccwl.hyporecipe.hypotheses, maxlen, sfidx, length(variables), isinit, runnullhypo)
350350

351351
# get manifold add operations
352352
# TODO, make better use of dispatch, see JuliaRobotics/RoME.jl#244
@@ -358,7 +358,7 @@ function evalPotentialSpecific(
358358

359359
# perform the numeric solutions on the indicated elements
360360
# FIXME consider repeat solve as workaround for inflation off-zero
361-
# NOTE alternate use of ccwl.certainidx to hyporecipe, certainidx = ccwl.certainhypo
361+
# NOTE alternate use of ccwl.certainidx to hyporecipe, certainidx = ccwl.hyporecipe.certainhypo
362362
computeAcrossHypothesis!(
363363
ccwl,
364364
hyporecipe,
@@ -425,7 +425,7 @@ function evalPotentialSpecific(
425425
# nullSurplus see #1517
426426
runnullhypo = maximum((ccwl.nullhypo, nullSurplus))
427427
hyporecipe =
428-
_prepareHypoRecipe!(ccwl.hypotheses, maxlen, sfidx, length(variables), isinit, runnullhypo)
428+
_prepareHypoRecipe!(ccwl.hyporecipe.hypotheses, maxlen, sfidx, length(variables), isinit, runnullhypo)
429429

430430
# get solvefor manifolds, FIXME ON FIRE, upgrade to new Manifolds.jl
431431
mani = getManifold(variables[sfidx])

src/services/FactorGraph.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ function setValKDE!(
282282
return nothing
283283
end
284284

285+
function setBelief!(vari::DFGVariable, bel::ManifoldKernelDensity, setinit::Bool=true,ipc::AbstractVector{<:Real}=[0.0;])
286+
setValKDE!(vari,getPoints(bel),setinit, ipc)
287+
end
288+
285289
"""
286290
$SIGNATURES
287291
@@ -743,7 +747,7 @@ function getDefaultFactorData(
743747
edgeIDs,
744748
ccwl,
745749
multihypo,
746-
ccw.certainhypo,
750+
ccwl.hyporecipe.certainhypo,
747751
nullhypo,
748752
solveInProgress,
749753
inflation,

src/services/GraphProductOperations.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function propagateBelief(
2323
needFreshMeasurements::Bool = true,
2424
dbg::Bool = false,
2525
logger = ConsoleLogger(),
26+
asPartial::Bool=false,
2627
)
2728
#
2829

@@ -44,7 +45,7 @@ function propagateBelief(
4445
varType = getVariableType(destvar)
4546
M = getManifold(varType)
4647
# @info "BUILDING MKD" varType M isPartial.(dens)
47-
48+
4849
# take the product
4950
mkd = AMP.manifoldProduct(
5051
dens,
@@ -74,7 +75,7 @@ function propagateBelief(
7475
end
7576
#
7677

77-
propagateBelief(dfg::AbstractDFG, destlbl::Symbol, ::Colon; kw...) = return propagateBelief(dfg, destlbl, getNeighbors(dfg, destlbl); kw...)
78+
propagateBelief(dfg::AbstractDFG, destlbl::Symbol, ::Colon; kw...) = propagateBelief(dfg, destlbl, getNeighbors(dfg, destlbl); kw...)
7879

7980

8081

src/services/SolveTree.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,19 @@ function doFMCIteration(
6060
vert = DFG.getVariable(fgl, vsym)
6161
if !getSolverData(vert, solveKey).ismargin
6262
# potprod = nothing
63-
densPts, ipc = predictbelief(
63+
dens, ipc = propagateBelief(
6464
fgl,
6565
vsym,
6666
:;
67-
needFreshMeasurements = needFreshMeasurements,
68-
N = N,
69-
dbg = dbg,
70-
logger = logger,
67+
needFreshMeasurements,
68+
N,
69+
dbg,
70+
logger,
7171
)
7272

73-
if 0 < length(densPts)
74-
setValKDE!(vert, densPts, true, ipc)
73+
if 0 < length(getPoints(dens))
74+
setBelief!(vert, dens, true, ipc)
75+
# setValKDE!(vert, densPts, true, ipc)
7576
# TODO perhaps more debugging inside `propagateBelief`?
7677
end
7778
end

test/testMultiHypo3Door.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# load requried packages
2+
# using Revise
23
using IncrementalInference
34
using Test
45

0 commit comments

Comments
 (0)