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

Fix ParseConstraint for cases with infs in rhs or lhs. #19903

Merged

Conversation

RussTedrake
Copy link
Contributor

@RussTedrake RussTedrake commented Aug 1, 2023

Previously, cases like

b = [0.12, inf]
ParseConstraint(x <= b)

would fail with

abort: Failure at solvers/create_constraint.cc:88 in ParseConstraint(): condition '!std::isnan(new_lb(i))' failed.

due to an inf - inf situation. Now we handle those cases properly.

+@hongkai-dai for feature review, please.


This change is Reviewable

@RussTedrake RussTedrake added the release notes: fix This pull request contains fixes (no new features) label Aug 1, 2023
@RussTedrake RussTedrake marked this pull request as ready for review August 1, 2023 11:37
@jwnimmer-tri
Copy link
Collaborator

@drake-jenkins-bot mac-arm-ventura-clang-bazel-experimental-release please

(#19335 known flake)

Copy link
Contributor

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

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

:lgtm: +@rpoyner-tri for platform review please, thanks!

Reviewed 2 of 2 files at r1.
Reviewable status: 2 unresolved discussions, LGTM missing from assignee rpoyner-tri(platform)


solvers/create_constraint.cc line 367 at r1 (raw file):

          // -∞ <= lhs - rhs <= 0
          v(k) = lhs - rhs;
          lb(k) = -std::numeric_limits<double>::infinity();

BTW, use -kInf here?


solvers/create_constraint.cc line 398 at r1 (raw file):

          v(k) = lhs - rhs;
          lb(k) = 0.0;
          ub(k) = std::numeric_limits<double>::infinity();

Ditto.

Previously, cases like
```
b = [0.12, inf]
ParseConstraint(x <= b)
```
would fail with
```
abort: Failure at solvers/create_constraint.cc:88 in ParseConstraint(): condition '!std::isnan(new_lb(i))' failed.
```
due to an `inf - inf` situation. Now we handle those cases properly.
@RussTedrake RussTedrake force-pushed the create_constraint_infs branch from 6b559aa to 4f7e527 Compare August 1, 2023 16:21
Copy link
Contributor Author

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 unresolved discussion, LGTM missing from assignee rpoyner-tri(platform)


solvers/create_constraint.cc line 398 at r1 (raw file):

Previously, hongkai-dai (Hongkai Dai) wrote…

Ditto.

Done.

Copy link
Contributor

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2.
Reviewable status: LGTM missing from assignee rpoyner-tri(platform)

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),hongkai-dai

@rpoyner-tri rpoyner-tri merged commit 8a25ef2 into RobotLocomotion:master Aug 1, 2023
@RussTedrake RussTedrake deleted the create_constraint_infs branch August 7, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: fix This pull request contains fixes (no new features)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants