当前位置:网站首页>isam2运行流程
isam2运行流程
2022-07-06 05:58:00 【瞻邈】
1. 算法流程
2. update函数运行流程
- updateDelta: Update delta if we need it to check relinearization later
- update.pushBackFactors: Add any new factors
- 为每一个新的factor产生一个索引,把新factor装入nonlinearFactors中
- 把需要移除的factor从nonlinearFactors和linearFactors中同时移除,把从nonlinearFactors中移除的factor移入removedFactors
- Remove removed factors from the variable index so we do not attempt to relinearize them
- computeUnusedKeys: 计算无用的key
Get keys from removed factors and new factors, and compute unused keys, i.e., keys that are empty now and do not appear in the new factors.
- 统计被移除的因子关联的key,如果这个key不存在于成员变量variableIndex_中,则记录下来。为什么会不存在于variableIndex_中?
- 统计新因子关系的key
- 第一步获得的集合与第二步获得的集合取差集,即无用的key的集合,记为unusedKeys
- addVariables: Initialize any new variables
- 把新变量放到成员变量theta_中,初始化为0
- 在detail中标记哪些变量是新的
- update.error: Calculate nonlinear error
- gatherInvolvedKeys: 收集相关key
- 收集新因子和移除的因子相关的key
- 收集需要重新线性化的因子
- Also, keys that were not observed in existing factors, but whose affected keys have been extended now (e.g. smart factors)
- 把这些key一起返回,作为相关key,记为markedKeys
- updateKeys:
- 遍历markedKeys
- 在detail中把相关key标记为isObserved
- 如果相关key不存在于unusedKeys中,也就是说它不是无用key,则把它复制到已观测的key中,记为observedKeys
- 收集需要重线性化的变量
- gatherRelinearizeKeys: 标记变化量大于阈值的变量,记为relinKeys
- 在detail中把它们标记成isAboveRelinThreshold和isRelinearized
- update.findFluid: Mark cliques that involve marked variables and ancestors.
- 从成员变量roots_的元素中递归寻找,其元素是团
- Does the separator contain any of the relinKeys?
- If it is true then add this clique to markedKeys
- 在detail中进行标记
- UpdateImpl::ExpmapMasked: Update linearization point for marked variables
- update.linearizeNewFactors: Linearize new factors
- update.augmentVariableIndex:
- Augment the variable index with the new factors
- Augment it with existing factors which now affect to more variables
- Recalculate: Redo top of Bayes tree and update data structures
- removeTop: Remove top of Bayes tree and convert to a factor graph: (a) For each affected variable, remove the corresponding clique and all parents up to the root. (b) Store orphaned sub-trees of removed cliques to variable orphans. 对于markedKeys中的每一个key,如果存在于成员变量nodes_中,则该节点从贝叶斯树中移除,存入贝叶斯网affectedBayesNet中,生成的孤儿放在orphans中
- 把贝叶斯网affectedBayesNet中的所有key存入affectedKeys中
- recalculateBatch: Do a batch step - reorder and relinearize all variables
- recalculateIncremental: 增量更新,首次update就使用增量更新
- 在detail中标记根团变量
- 把affectedKeysSet中的key存入deltaReplacedMask_中
- removeVariables: 移除未使用的变量,所有存在于unusedKeys中的变量都从delta_, theta_等成员变量中移除
- update.error: Calculate nonlinear error再做一次
3. recalculateIncremental函数运行流程
- Add the new factors into the resulting factor graph
- 把affectedKeys和observedKeys装入affectedAndNewKeys中
- relinearizeAffectedFactors: 根据affectedAndNewKeys对nonlinearFactors_中对应的因子进行重新线性化,返回线性化的得到的线性因子,存入factors中
- detail中对应的变量标记为isReeliminated
- GetCachedBoundaryFactors: Add the cached intermediate results from the boundary of the orphans,存入factors中
- Add the orphaned subtrees 为啥加两遍?
- 把markedKeys中的key和affectedKeys中的key放入affectedKeysSet中
- 用因子图factors初始化VariableIndex类型变量affectedFactorsVarIndex
- Re-order and eliminate the factor graph into a Bayes net (Algorithm [alg:eliminate]), and re-assemble into a new Bayes tree (Algorithm [alg:BayesTree])
- create a partial reordering for the new and contaminated factors result->markedKeys are passed in: those variables will be forced to the end in the ordering, Create ordering constraints,constraintGroups即updateParams.constrainedKeys
- Remove unaffected keys from the constraints,如果某key存在于unusedKeys中,即它未被使用,或者它不存在于affectedKeysSet中,即它未被影响,则把它从constraintGroups中删除,即不参与重排序
- Ordering::ColamdConstrained 对affectedFactorsVarIndex依据constraintGroups进行重排序
- Do elimination
- 构建高斯消元数GaussianEliminationTree
- 构建联合树ISAM2JunctionTree
- 联合树消元,根据参数调用对应的消元函数,消元得到贝叶斯树和剩余因子图
- 把贝叶斯树的根放入成员变量roots_中,把节点放入成员变量nodes_中
4. EliminatableClusterTree::eliminate函数运行流程
- 构造EliminationData::EliminationPostOrderVisitor类,这个构造函数也是比较简单的,就是用形参来初始化成员变量
- 运行treeTraversal::DepthFirstForest函数,进行深度优先搜索
- 该函数不会改变传入的第一个实参*this的任何内容
- 用EliminatableClusterTree的所有根团构造TraversalNode对象,并依次入栈,这些TraversalNode对象的父节点都是EliminationData
- 不断从栈顶取元素,直到栈为空
- 把所有有根节点收集起来,放入result->roots_中
- 把所有的remaining收集起来
- 二者组成pair,返回
5. recalculateBatch函数运行流程
6. marginalizeLeaves函数运行流程
这个函数写得不太好,一个函数有太多行;
函数首先是定义变量,初始化变量,定义一个lambda表达式等简单工作,然后才开始正式的工作
- 定义trackingRemoveSubtree,这是一个lambda表达式,供后面使用
- 输入为根团subtreeRoot,输出为被移除的团removedCliques
- 调用BayesTree::removeSubtree函数把subtreeRoot及其后代从nodes_中移除
- 对leafKeys中的每一个key,如果已经存在于leafKeysRemoved中了,表示已经处理过了,则跳过,没有处理过的,才进行下一步处理
- 通过nodes_找到这个key对应的clique
- 不断地去寻找clique的父节点(有比较难以理解的判断条件)并把父节点赋值给clique,这个判断条件有待深入理解,为何只用团中第一个key去判断
- 如果clique的frontals()都在leafKeys中,则标记为删除整个团
- 如果标记为删除整个团,则调用trackingRemoveSubtree删除cliquee及其后代,并把边缘化因子存入到marginalFactors中
- 如果未标记为删除整个团,待补充
- At this point we have updated the BayesTree, now update the remaining iSAM2 data structures
- 把边缘化产生的因子装进nonlinearFactors_,linearFactors_和variableIndex_中
- variableIndex_,delta_,nodes_,theta_删除无用的变量
边栏推荐
- 【论文代码】SML部分代码阅读
- H3C S5820V2_5830V2交换机IRF2堆叠后升级方法
- 查询生产订单中某个(些)工作中心对应的标准文本码
- 授予渔,从0开始搭建一个自己想要的网页
- Demander le Code de texte standard correspondant à un centre de travail dans l'ordre de production
- Station B, Mr. Liu Er - multiple logistic regression, structure 7
- [Thesis code] SML part code reading
- High quality coding tool clion
- Pay attention to the details of pytoch code, and it is easy to make mistakes
- Detailed explanation of BF and KMP
猜你喜欢
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Download, install and use NVM of node, and related use of node and NRM
Analysis report on development trends and investment planning of China's methanol industry from 2022 to 2028
A master in the field of software architecture -- Reading Notes of the beauty of Architecture
[untitled]
网络协议模型
Station B Liu Erden - linear regression and gradient descent
Is it difficult for an information system project manager?
华为路由器如何配置静态路由
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
随机推荐
Jushan database appears again in the gold fair to jointly build a new era of digital economy
Redis message queue
A complete collection of necessary learning websites for office programmers
进程和线程
Processes and threads
Auto. JS learning notes 17: basic listening events and UI simple click event operations
B站刘二大人-线性回归及梯度下降
[leetcode] day96 - the first unique character & ransom letter & letter ectopic word
【无标题】
[Jiudu OJ 07] folding basket
Embedded interview questions (I: process and thread)
Report on the competition status and investment decision recommendations of Guangxi hospital industry in China from 2022 to 2028
Configuring OSPF GR features for Huawei devices
B站刘二大人-Softmx分类器及MNIST实现-Lecture 9
Practice sharing: how to safely and quickly migrate from CentOS to openeuler
[experience] install Visio on win11
The difference and usage between continue and break
Luogu [Beginner Level 4] array p1427 number game of small fish
嵌入式面试题(四、常见算法)
通讯录管理系统链表实现