iSAM2 Updates to Support riSAM Implementation#2408
Merged
dellaert merged 17 commits intoborglab:developfrom Mar 2, 2026
Merged
iSAM2 Updates to Support riSAM Implementation#2408dellaert merged 17 commits intoborglab:developfrom
dellaert merged 17 commits intoborglab:developfrom
Conversation
This commit includes - Adding Dogleg Line Search (DLLS) - Adding Bayes Tree Traversal - Adding one-step-look ahead to ISAM2
The sequence of actions in isam2.update could cause there to be a structural miss-match between the steepest descent direction vector and the gauss-newton decent direction vector which are required to have the same structure in DoglegOptimizerImpl::ComputeBlend.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates iSAM2 to support riSAM integration by adding update-structure prediction utilities, introducing a Dogleg Line Search trust-region strategy, and fixing a delta-structure mismatch that could crash Dogleg blending.
Changes:
- Added
ISAM2::predictUpdateInfoandBayesTree::traverseTopto enable one-step look-ahead for Bayes tree contamination. - Introduced Dogleg Line Search optimization support (params + implementation) and added tests to exercise it.
- Fixed delta structure alignment during dogleg computations and reduced redundant
updateDeltacalls.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testGaussianISAM2.cpp | Adds iSAM2 integration tests for DoglegLineSearch and predictUpdateInfo. |
| tests/testDoglegOptimizer.cpp | Adds unit tests for DoglegLineSearch iteration and a regression test for ComputeBlend crash. |
| gtsam/symbolic/tests/testSymbolicBayesTree.cpp | Adds tests for new traverseTop helper. |
| gtsam/nonlinear/nonlinear.i | Exposes DoglegLineSearch params + predictUpdateInfo to the Python (SWIG) interface. |
| gtsam/nonlinear/ISAM2Params.h | Adds ISAM2DoglegLineSearchParams and extends ISAM2Params optimization variant. |
| gtsam/nonlinear/ISAM2.h | Adds predictUpdateInfo API to iSAM2. |
| gtsam/nonlinear/ISAM2.cpp | Implements DoglegLineSearch branch, delta structure fix, redundant updateDelta skip, and predictUpdateInfo. |
| gtsam/nonlinear/DoglegOptimizerImpl.h | Implements DoglegLineSearch algorithm. |
| gtsam/inference/BayesTree.h | Declares traverseTop and traversal helpers. |
| gtsam/inference/BayesTree-inst.h | Implements traverseTop and traversal helpers. |
Member
|
See some comments from co-pilot above. |
dellaert
reviewed
Feb 25, 2026
Member
dellaert
left a comment
There was a problem hiding this comment.
Sorry for the delay, I was busy with class assignments, etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first of 3 PRs that support the integration of riSAM into GTSAM. This PR is focused on updating iSAM2 with some additional functionality to support riSAM's implementation, and also fixes issue #2405 as the bug significantly affected the new DoglegLineSearch optimizer. Below are details on the changes:
Feature 1 - One Step Look Ahead
riSAM relies on predicting the effect of an update on the bayes tree structure to identify which factors to re-convexify. To support this this PR adds
predictUpdateInfoto the iSAM2 interface and a helper functiontraverseTopto the BayesTree interface. Tests can be found intestGaussianISAM2andtestSymbolicBayesTreeFeature 2 - DoglegLineSearch
In riSAM, factors are routinely re-convexified, causing the region of trust (a-la Dogleg) to be uncorrelated between time-steps. At the same time we require a trust region optimizer to ensure wild steps are not taken. DoglegLineSearch functions as a line-search along the dog-leg arc. The search is performed independently for each optimziation step supporting cases like riSAM where the underlying cost function is changing significantly between optimization steps. While this was motivated by riSAM, I think there are additional scenarios where this could be useful (e.g. using smart-factors to significantly change the cost function on updates).
While testing this feature I ran across the same bug identified in #2405 as DoglegLineSearch runs compute blend often. The cause is just as identified by @william-swarmbotics, adding variables in
ISAM2::updatebefore the bayes tree is actually updated causes a dimensionality mis-match between the the gradient and newton directions. This was fixed inupdateDeltaby ensuring the vectors match structure.Feature 3 - Skip redundant
updateDeltaIn
iSAM2::update,deltais updated, but the check to identify when updates are needed ignores thedeltaReplaceMaskthis causes redundantupdateDeltacalls especially in the case thatrelinearizationSkip = 1(which is used for riSAM). To avoid this redundent work I added a check for thedeltaReplaceMask. Though It may be better to move this check intorelinarizationNeeded, let me know if there is a preference on the location of this check.Final Notes
All functionality is tested, and I believe tests have full coverage. Notably I also added a test that is able to deterministically recreate the error in #2405 in
TEST(DogLegOptimizer, ComputeBlend). Additionally, the python interface file is updated (though not tested locally due to a cmake version issue. I am trusting the CI to catch any issues there)