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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jwnimmer-tri
Copy link
Collaborator

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

Towards #20967.

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.

This commit introduces a higher-level intermediary between solver back-ends and the program's options. Now SolverOptions are solely a user-facing aspect of defining a program; the solver back-ends never touch SolverOptions anymore. The new SolverBase::DoSolve2 virtual provides the mechanism for back-ends to take advantage of the new API. All solvers have been ported to use it. The old API remains intact for any out-of-tree solvers.

The new API is also designed to improve uniformity of common errors, such as unknown names or wrongly-typed values.

The new API also lays the groundwork for more efficient processing, as future work. It removes the need for the "Merge" (copy) operation in the hot path -- since it only provides a view of the options, it can easily keep track of several dictionaries and query them in order, with no copying.


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"

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.

This commit introduces a higher-level intermediary between solver
back-ends and the program's options. Now SolverOptions are solely a
user-facing aspect of defining a program; the solver back-ends never
touch SolverOptions anymore. The new SolverBase::DoSolve2 virtual
provides the mechanism for back-ends to take advantage of the new API.
All solvers have been ported to use it. The old API remains intact for
any out-of-tree solvers.

The new API is also designed to improve uniformity of common errors,
such as unknown names or wrongly-typed values.

The new API also lays the groundwork for more efficient processing, as
future work. It removes the need for the "Merge" (copy) operation in
the hot path -- since it only provides a *view* of the options, it can
easily keep track of several dictionaries and query them in order,
with no copying.
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 status: do not merge status: do not review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant