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 a Bug in GCS When Passing in a Trivially-Infeasible Upper Bound #22090

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

cohnt
Copy link
Contributor

@cohnt cohnt commented Oct 29, 2024

There was a slight logic error, where we were checking the lower bound instead of the upper bound. The current test cases didn't cover it because they didn't make sure that code path was tested. This PR adds test cases to reveal the bug, and implements the fix.


This change is Reviewable

@cohnt cohnt added the release notes: fix This pull request contains fixes (no new features) label Oct 29, 2024
@cohnt
Copy link
Contributor Author

cohnt commented Oct 30, 2024

+@RussTedrake mind taking this one? Hopefully it should be pretty quick, but I think it ought to merge before #22091.

Copy link
Contributor

@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.

:lgtm: (i had already reviewed it as a part of #22091, but I like that you've separated it out)

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)

Copy link
Contributor

@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.

+@rpoyner-tri for platform review, please.

Reviewable status: LGTM missing from assignee rpoyner-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)

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 2 of 2 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)


geometry/optimization/test/graph_of_convex_sets_test.cc line 1773 at r1 (raw file):

  // trivially-infeasible constraint, so solving should throw an error.
  DRAKE_EXPECT_THROWS_MESSAGE(
      g_.SolveShortestPath(*source_, *target_, options_), ".*inf.*");

minor: this test clause should probably match on a bit more of the expected error text -- we have other throws in the same module with either "inf" for infinity or "infeasible".

@cohnt cohnt force-pushed the gcs-upper-bound-bug branch from 2e2a8c0 to ea3d82f Compare November 5, 2024 21:17
Copy link
Contributor Author

@cohnt cohnt 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: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)


geometry/optimization/test/graph_of_convex_sets_test.cc line 1773 at r1 (raw file):

Previously, rpoyner-tri (Rick Poyner (rico)) wrote…

minor: this test clause should probably match on a bit more of the expected error text -- we have other throws in the same module with either "inf" for infinity or "infeasible".

Done.

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.

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: 1 unresolved discussion, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)


geometry/optimization/test/graph_of_convex_sets_test.cc line 1819 at r3 (raw file):

  DRAKE_EXPECT_THROWS_MESSAGE(
      g_.SolveShortestPath(*source_, *target_, options_),
      ".*trivially-infeasible.*");

nit this is better; thanks. My last question is this: there are two error mesages in the implementation that match this pattern. One is for lower-bound failure, the other for upper-bound failure. Given that we are here fixing a lower-upper bound confusion already, is it worth having the test be able to sense which message actually got thrown?

@cohnt cohnt force-pushed the gcs-upper-bound-bug branch from ea3d82f to 690c954 Compare November 6, 2024 02:09
Copy link
Contributor Author

@cohnt cohnt 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, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)


geometry/optimization/test/graph_of_convex_sets_test.cc line 1819 at r3 (raw file):

Previously, rpoyner-tri (Rick Poyner (rico)) wrote…

nit this is better; thanks. My last question is this: there are two error mesages in the implementation that match this pattern. One is for lower-bound failure, the other for upper-bound failure. Given that we are here fixing a lower-upper bound confusion already, is it worth having the test be able to sense which message actually got thrown?

I made it also match x >= +inf or x <= -inf, so we can tell which case it's hitting.

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.

Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @cohnt)

@cohnt cohnt added the status: squashing now https://drake.mit.edu/reviewable.html#curated-commits label Nov 6, 2024
@cohnt cohnt merged commit 5a820c1 into RobotLocomotion:master Nov 6, 2024
9 checks passed
@cohnt cohnt deleted the gcs-upper-bound-bug branch November 6, 2024 15:19
sammy-tri pushed a commit that referenced this pull request Nov 11, 2024
…ctoryOptimization (#22091)

Adds placeholder variables to subgraphs, that can be used to construct costs and constraints to each vertex or edge.

Note that this includes the fix  Fix a Bug in GCS When Passing in a Trivially-Infeasible Upper Bound #22090, since the conjunctive formula used in a test case creates an instance of this bug.

Co-Authored-By: Russ Tedrake <[email protected]>
RussTedrake added a commit to RussTedrake/drake that referenced this pull request Dec 15, 2024
…ctoryOptimization (RobotLocomotion#22091)

Adds placeholder variables to subgraphs, that can be used to construct costs and constraints to each vertex or edge.

Note that this includes the fix  Fix a Bug in GCS When Passing in a Trivially-Infeasible Upper Bound RobotLocomotion#22090, since the conjunctive formula used in a test case creates an instance of this bug.

Co-Authored-By: Russ Tedrake <[email protected]>
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) status: squashing now https://drake.mit.edu/reviewable.html#curated-commits
Projects
Development

Successfully merging this pull request may close these issues.

3 participants