Skip to content

Conversation

@dellaert
Copy link
Member

@dellaert dellaert commented Dec 31, 2025

  • Whiten if a noise model is there
  • Handle constraints derived from NonlinearEquality
  • More general constraints are not handled: that is quite involved and would blow up complexity

Also added burn in timing script. Schur advantage is not so apparent now:

Processing BAL file: /Users/dellaert/git/github/examples/Data/dubrovnik-16-22106-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 0.641586 s
  Standard GTSAM:     1.35091 s
  Speedup:            2.10558x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 0.57023 s
  Standard GTSAM:     1.3083 s
  Speedup:            2.29433x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 0.566681 s
  Standard GTSAM:     1.16493 s
  Speedup:            2.05571x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 0.597309 s
  Standard GTSAM:     1.19801 s
  Speedup:            2.00568x

Processing BAL file: /Users/dellaert/git/github/examples/Data/dubrovnik-88-64298-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 35.3935 s
  Standard GTSAM:     15.9401 s
  Speedup:            0.450367x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 11.8535 s
  Standard GTSAM:     15.1518 s
  Speedup:            1.27826x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 10.8207 s
  Standard GTSAM:     15.2233 s
  Speedup:            1.40687x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 6.41992 s
  Standard GTSAM:     14.8429 s
  Speedup:            2.31201x

Linux benchmarks

A bit disheartening for BAL :-( For chain (large balanced tree) still have speedups > 10, but for these BAL datasets GTSAM and new solver are essentially the same. Puzzling.

With TBB:

Processing BAL file: /home/dellaert/git/gtsam/examples/Data/dubrovnik-16-22106-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 0.52199 s
  Standard GTSAM:     0.591581 s
  Speedup:            1.13332x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 0.427423 s
  Standard GTSAM:     0.607558 s
  Speedup:            1.42144x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 0.405464 s
  Standard GTSAM:     0.576696 s
  Speedup:            1.42231x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 0.466439 s
  Standard GTSAM:     0.587623 s
  Speedup:            1.25981x

Processing BAL file: /home/dellaert/git/gtsam/examples/Data/dubrovnik-88-64298-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 3.68102 s
  Standard GTSAM:     3.19029 s
  Speedup:            0.866687x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 3.03568 s
  Standard GTSAM:     3.21428 s
  Speedup:            1.05883x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 3.02861 s
  Standard GTSAM:     3.04441 s
  Speedup:            1.00522x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 2.97899 s
  Standard GTSAM:     3.06014 s
  Speedup:            1.02724x

Benchmark (T=5000, iterations=1000):
Symbolic cluster structure
  cliques:    4978
  frontals:   max=6 avg=2.00884
  separators: max=4 avg=3.98955
  total dim:  max=6 avg=5.99839
  children:   max=4 avg=0.999799
Clique structure after merge
  cliques:    728
  frontals:   max=22 avg=13.7363
  separators: max=4 avg=3.96154
  total dim:  max=24 avg=17.6978
  children:   max=9 avg=0.998626

Timing results:
  MultifrontalSolver: 0.866464 s
  Standard GTSAM:     9.76246 s
  Speedup:            11.267x

Without TBB:

Processing BAL file: /home/dellaert/git/gtsam/examples/Data/dubrovnik-16-22106-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 0.771404 s
  Standard GTSAM:     0.924484 s
  Speedup:            1.19844x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 0.705401 s
  Standard GTSAM:     0.890044 s
  Speedup:            1.26176x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 0.689904 s
  Standard GTSAM:     0.869505 s
  Speedup:            1.26033x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 0.711992 s
  Standard GTSAM:     0.897607 s
  Speedup:            1.2607x

Processing BAL file: /home/dellaert/git/gtsam/examples/Data/dubrovnik-88-64298-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 8.06685 s
  Standard GTSAM:     5.58751 s
  Speedup:            0.69265x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 7.36221 s
  Standard GTSAM:     5.24252 s
  Speedup:            0.712084x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 7.20498 s
  Standard GTSAM:     5.02448 s
  Speedup:            0.697362x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 7.35469 s
  Standard GTSAM:     4.98342 s
  Speedup:            0.677584x

Benchmark (T=5000, iterations=1000):
Symbolic cluster structure
  cliques:    4978
  frontals:   max=6 avg=2.00884
  separators: max=4 avg=3.98955
  total dim:  max=6 avg=5.99839
  children:   max=4 avg=0.999799
Clique structure after merge
  cliques:    728
  frontals:   max=22 avg=13.7363
  separators: max=4 avg=3.96154
  total dim:  max=24 avg=17.6978
  children:   max=9 avg=0.998626

Timing results:
  MultifrontalSolver: 1.63542 s
  Standard GTSAM:     10.9214 s
  Speedup:            6.67801x

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the handling of nonlinear equality constraints by adding support for noise model whitening and proper handling of constraints derived from NonlinearEquality. The changes migrate from the deprecated NonlinearEquality1 class to the more flexible NonlinearEquality class with an updated API parameter order (key first, then feasible value).

Key changes:

  • Integrated noise model whitening in the multifrontal solver when noise models are present
  • Added constraint handling for unary fully-constrained factors derived from NonlinearEquality
  • Deprecated NonlinearEquality1 in favor of NonlinearEquality with updated parameter ordering

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
gtsam/nonlinear/NonlinearEquality.h Updated documentation, deprecated NonlinearEquality1 class, reformatted evaluateError method, fixed spelling in comments
gtsam/constrained/NonlinearEqualityConstraint.h Fixed spelling error in comment ("equlity" → "equality")
gtsam/linear/MultifrontalClique.h Added fields for constraint handling: blockIndex_ map, fixedFrontals_ set, updated documentation
gtsam/linear/MultifrontalClique.cpp Implemented whitening and constraint handling in fillAb, added markFixedFrontals helper, updated eliminateInPlace to handle fixed frontals
gtsam/linear/tests/testMultifrontalSolver.cpp Added comprehensive tests for constrained factors, weighted measurements, updated existing tests with different noise models
tests/testNonlinearEquality.cpp Migrated from NonlinearEquality1 to NonlinearEquality with updated parameter order (key, value, gain), modernized smart pointers, removed explicit orderings
tests/testBoundingConstraint.cpp Updated UnaryEqualityConstraint calls to new parameter order
tests/simulated2DConstraints.h Changed typedef from NonlinearEquality1 to NonlinearEquality
gtsam/nonlinear/doc/NonlinearEquality.ipynb Removed deprecated NonlinearEquality1 documentation section, reformatted string literals

@dellaert dellaert requested a review from ProfFan January 2, 2026 04:34
@dellaert
Copy link
Member Author

dellaert commented Jan 2, 2026

@ProfFan I merged the PR on this one which should alleviate concern about constraint handling.

@dellaert dellaert merged commit 8493078 into develop Jan 3, 2026
34 checks passed
@dellaert dellaert deleted the fix/constraints branch January 3, 2026 21:02
@ProfFan
Copy link
Collaborator

ProfFan commented Jan 4, 2026

9950X3D with TBB

Processing BAL file: /home/fan/GitHub/gtsam/examples/Data/dubrovnik-16-22106-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 0.560296 s
  Standard GTSAM:     0.797752 s
  Speedup:            1.42381x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 0.523189 s
  Standard GTSAM:     0.804385 s
  Speedup:            1.53746x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 0.488807 s
  Standard GTSAM:     0.76311 s
  Speedup:            1.56117x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 0.575625 s
  Standard GTSAM:     0.813334 s
  Speedup:            1.41296x

Processing BAL file: /home/fan/GitHub/gtsam/examples/Data/dubrovnik-88-64298-pre.txt

BAL Benchmark (Burn, iterations=5):
  MultifrontalSolver: 3.65185 s
  Standard GTSAM:     4.35175 s
  Speedup:            1.19166x

BAL Benchmark (Metis, iterations=5):
  MultifrontalSolver: 3.95923 s
  Standard GTSAM:     4.78248 s
  Speedup:            1.20793x

BAL Benchmark (Schur, iterations=5):
  MultifrontalSolver: 3.30452 s
  Standard GTSAM:     4.16258 s
  Speedup:            1.25966x

BAL Benchmark (Colamd, iterations=5):
  MultifrontalSolver: 3.8899 s
  Standard GTSAM:     4.38464 s
  Speedup:            1.12718x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants