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

add definition of constraints #1789

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

yetongumich
Copy link
Contributor

@yetongumich yetongumich commented Aug 6, 2024

First PR in the 4 PRs to implement nonlinear constrained optimization in GTSAM.

  1. Introducing factors representing equality and inequality constraints; refactor existing constraint factors to inherit from it.
  2. Implementation of existing constrained optimization methods that are compatible with the current gtsam framework, including penalty methods, augmented Lagrangian methods, SQP methods (potentially also interior point methods), with a document explaining the math of the implementations.
  3. Constraint manifold optimization that solves problems with equality constraints.
  4. Constraint manifold with corners optimization that solves problems with both equality and inequality constraints.
  5. (potentially 1 additional PR) That solves an equality-constrained factor graph using nonlinear variable elimination (resulting in an behavior identical to iLQR or DDP).

This PR

  • Introduce NonlinearEqualityConstraint and NonlinearInequalityConstraint inheriting from NoiseModelFactor to represent constraints.
  • Refactor the existing classesNonlinearEquality to inherit from NonlinearEqualityConstraint, and BoundingConstraint to inherit from NonlinearInequalityConstraint.

@yetongumich yetongumich requested a review from dellaert August 6, 2024 14:27
@dellaert
Copy link
Member

CI fails. Talking about CI, try to save on CO2 by not pushing every commit, but only after you think CI will pass.

@yetongumich
Copy link
Contributor Author

CI fails. Talking about CI, try to save on CO2 by not pushing every commit, but only after you think CI will pass.

It seems pretty weird that only the Windows CI fails. Unfortunately I do not have a Windows environment to test this on. I was trying to tweak with different changes to see which causes the Windows CI to fail.

@dellaert
Copy link
Member

@yetongatech error is due to a argument type not being recognized:

D:\a\gtsam\gtsam\gtsam/inference/FactorGraph-inst.h(69): error C2664: 'double gtsam::NoiseModelFactor::error(const gtsam::Values &) const': cannot convert argument 1 from 'const gtsam::HybridValues' to 'const gtsam::Values &'

Try figuring out what type you want and somehow being explicit? I just looked at the error above but maybe you can dig deeper.

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

Cool ! Some comments/questions.
Still need to pass CI

gtsam/CMakeLists.txt Outdated Show resolved Hide resolved
gtsam/constraint/InequalityPenaltyFunction.h Outdated Show resolved Hide resolved
gtsam/constraint/InequalityPenaltyFunction.h Outdated Show resolved Hide resolved
gtsam/constraint/InequalityPenaltyFunction.h Outdated Show resolved Hide resolved
gtsam/constraint/NonlinearEqualityConstraint.h Outdated Show resolved Hide resolved
gtsam/nonlinear/NonlinearEquality.h Show resolved Hide resolved
gtsam/slam/BoundingConstraint.h Show resolved Hide resolved
gtsam/slam/BoundingConstraint.h Outdated Show resolved Hide resolved
gtsam/slam/BoundingConstraint.h Outdated Show resolved Hide resolved
gtsam/slam/BoundingConstraint.h Outdated Show resolved Hide resolved
@ProfFan
Copy link
Collaborator

ProfFan commented Sep 26, 2024

I think if you rebase on current develop it should fix stuff

@yetongumich
Copy link
Contributor Author

I think if you rebase on current develop it should fix stuff

Seems still not working

@dellaert
Copy link
Member

@yetongatech you might have to investigate a bit to get past windows issue. None of us have the answers exactly :-)

@dellaert
Copy link
Member

@yetongumich , checks passed, will you address comments (and resolve them when addressed) ?

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.

4 participants