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

[solvers] Port solver back-ends to use SpecificOptions #21345

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Apr 21, 2024

Towards #20967.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri added status: do not merge priority: medium status: do not review release notes: none This pull request should not be mentioned in the release notes labels Apr 21, 2024
@jwnimmer-tri jwnimmer-tri force-pushed the solver-options-specific branch 3 times, most recently from ea392f0 to ee3a01c Compare April 26, 2024 00:04
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-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 42 of 45 files at r1, 6 of 7 files at r2, 8 of 9 files at r3, all commit messages.
Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers, labeled "do not merge"

Copy link
Contributor

@ggould-tri ggould-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 1 of 45 files at r1, 4 of 30 files at r5, 3 of 3 files at r7, 1 of 4 files at r8, 3 of 3 files at r9, 2 of 11 files at r10, all commit messages.
Reviewable status: 2 unresolved discussions, needs platform reviewer assigned, needs at least two assigned reviewers, labeled "do not merge" (waiting on @jwnimmer-tri)


solvers/specific_options.h line 25 at r10 (raw file):

generic SolverOptions struct into the specific solver's options API.

This class is intended a short-lived helper. It aliases an immutable list of

nit: Ambiguous. "Short-lived" as in "soon to be deprecated" or "short-lived" as in "narrowly scoped in the control flow"?

Code quote:

short-lived

solvers/test/solver_base_test.cc line 165 at r10 (raw file):

  // In SolverBase, we have two flavors of DoSolve to test here. (This is the
  // only test case were testing both is relevant / important.)

typo

Suggestion:

where

@jwnimmer-tri
Copy link
Collaborator Author

For the next feature review, I'll want a fresh set of eyes so removing -@ggould-tri for now.

@jwnimmer-tri jwnimmer-tri force-pushed the solver-options-specific branch from 4a26338 to 14a06ed Compare October 21, 2024 21:48
@jwnimmer-tri jwnimmer-tri marked this pull request as ready for review October 21, 2024 21:49
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-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 1 of 9 files at r3, 1 of 1 files at r4, 29 of 30 files at r5, 2 of 2 files at r6, 3 of 3 files at r7, 4 of 4 files at r8, 3 of 3 files at r9, 11 of 11 files at r10, 5 of 6 files at r11, 6 of 6 files at r13, all commit messages.
Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers

@jwnimmer-tri
Copy link
Collaborator Author

+@hongkai-dai are you available for feature review, please?

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:

Reviewed 13 of 45 files at r1, 1 of 7 files at r2, 2 of 9 files at r3, 14 of 30 files at r5, 3 of 3 files at r7, 3 of 3 files at r9, 7 of 11 files at r10, 2 of 6 files at r11, 6 of 6 files at r13, all commit messages.
Reviewable status: 1 unresolved discussion, needs platform reviewer assigned, needs at least two assigned reviewers


solvers/csdp_solver.cc line 418 at r13 (raw file):

      options->template Pop<int>("drake::RemoveFreeVariableMethod")
          .value_or(static_cast<int>(RemoveFreeVariableMethod::kNullspace));
  if (!(method >= 1 && method <= 3)) {

1 and 3 are magic number here? Maybe document them?

Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

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

+@SeanCurtis-TRI for platform review per schedule, please.

Reviewable status: 1 unresolved discussion, LGTM missing from assignee SeanCurtis-TRI(platform)


solvers/csdp_solver.cc line 418 at r13 (raw file):

Previously, hongkai-dai (Hongkai Dai) wrote…

1 and 3 are magic number here? Maybe document them?

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 2 files at r14.
Reviewable status: LGTM missing from assignee SeanCurtis-TRI(platform)

@jwnimmer-tri jwnimmer-tri added release notes: feature This pull request contains a new feature release notes: none This pull request should not be mentioned in the release notes and removed release notes: none This pull request should not be mentioned in the release notes release notes: feature This pull request contains a new feature labels Oct 24, 2024
Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-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 13 of 45 files at r1, 1 of 7 files at r2, 2 of 9 files at r3, 14 of 30 files at r5, 3 of 3 files at r7, 3 of 3 files at r9, 6 of 11 files at r10, 2 of 6 files at r11, 5 of 6 files at r13, 2 of 2 files at r14, all commit messages.
Reviewable status: 1 unresolved discussion


solvers/nlopt_solver.cc line 336 at r14 (raw file):

}

nlopt::algorithm ParseNloptAlgorithm(const std::string& algorithm) {

BTW Blech....a string called algorithm and a type nlopt::algorithm.

In the near future, we anticipate changing the SolverOptions API in
support of loading and saving (i.e., serialization). That's especially
troublesome for our solver back-ends that consume its information,
given the low-level and hodge-podge ways in which they hunt for and
apply their specific options. In anticipation of that, here we port
all solvers to the new SolverBase::DoSolve2 virtual function that uses
SpecificOptions instead of SolverOptions. The DoSolve API remains
unchanged, for any out-of-tree solvers.
@jwnimmer-tri jwnimmer-tri force-pushed the solver-options-specific branch from 1a7e71d to 5777e3d Compare October 24, 2024 20:03
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-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 r14, 1 of 1 files at r15, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees SeanCurtis-TRI(platform),hongkai-dai


solvers/nlopt_solver.cc line 336 at r14 (raw file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…

BTW Blech....a string called algorithm and a type nlopt::algorithm.

Buffalo buffalo buffalo ...

Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-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 1 of 1 files at r15, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees SeanCurtis-TRI(platform),hongkai-dai


solvers/nlopt_solver.cc line 336 at r14 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

Buffalo buffalo buffalo ...

I didn't even broach the nlopt_algorithm. So, how about that for buffaloes?

@SeanCurtis-TRI SeanCurtis-TRI merged commit 40adf9c into RobotLocomotion:master Oct 24, 2024
9 checks passed
@jwnimmer-tri jwnimmer-tri deleted the solver-options-specific branch October 24, 2024 21:00
RussTedrake pushed a commit to RussTedrake/drake that referenced this pull request Dec 15, 2024
…on#21345)

In the near future, we anticipate changing the SolverOptions API in
support of loading and saving (i.e., serialization). That's especially
troublesome for our solver back-ends that consume its information,
given the low-level and hodge-podge ways in which they hunt for and
apply their specific options. In anticipation of that, here we port
all solvers to the new SolverBase::DoSolve2 virtual function that uses
SpecificOptions instead of SolverOptions. The DoSolve API remains
unchanged, for any out-of-tree solvers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium release notes: none This pull request should not be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants