-
Notifications
You must be signed in to change notification settings - Fork 48
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
Improvements for solver.System #887
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch replaces the --break-system-packages introduced in d4a856d by locally installed Python interpretors to fix Github actions.
gertjanvanzwieten
force-pushed
the
solver
branch
2 times, most recently
from
October 21, 2024 13:19
47132c9
to
f7b34e8
Compare
joostvanzwieten
requested changes
Oct 22, 2024
This patch adds the functions evaluable.assert_equal and evaluable.assert_equal_tuple, which instantiate AssertEqual only if the two arguments are different. This is important because the shape attribute is not in simplified form if it is generated by the evaluable, and therefore is prone to stack up with potentially detrimental effects.
This patch improves AssertEqual._simplified by composing a list of unique items that are compared in the AssertEqual tree, and composing a new tree (if any) from the results. This allows `AssertEqual(a, AssertEqual(a, b))` to be simplified to `AssertEqual(a, b)`, which was not formerly the case.
This patch changes the string representation of solver.Minimize from 'newton' to 'minimize'.
This patch changes System.assemble method to return None for the value of a non symmetric system, rather than NaN. The old approach was problematic as it did not completely rule out that the value would be used, and it ignored the system's dtype.
This patch replaces the trial arguments in a linear system's residual vector and function value by zeros for cheaper evaluation. The difference is accounted for in the assemble method with the use of the jacobian matrix.
gertjanvanzwieten
force-pushed
the
solver
branch
from
October 22, 2024 15:18
f019677
to
5a93ba3
Compare
This patch avoids a second evaluation of a linear system if the matrix, vector and value are all constant. Formerly only the matrix was cached, but the changes of commit b7cdff3 imply that the the entire evaluable may become constant, in which case the residual vector and function value can be reused as well. A new flag is introduced to differentiate between the situation that all items are constant (`is_constant`) or only the matrix (`is_constant_matrix`).
This patch changes the behaviour of System.optimize but having it return, in addition to the solution arrays for self.trials, the existing values of the constraints parameter rather than arguments. This is to accommodate the main application of optimize, which is to form constraints for subsequent invocations of solve. The new behaviour allows for constraint stacking by feeding existing constraints as the constraints argument of subsequent optimizations.
This patch changes some SolverError exceptions to ValueError when the reason of the error is directly apparent from checking the parameters, leaving the use of SolverError exclusively for errors that occur _during_ the solution process, for instance due to convergence issues. This fixes System.step's time halving logic, which spsecifically catches SolverError and MatrixError, that would repeat forever if the cause of the issue is independent of the timestep.
This patch restores optimize's log entry that counts the number of degrees of freedom that were constrained. Different from the old log entry is that this patch separates the counts by trial argument.
This patch lifts the restriction that System.optimize only applies to symmetric problems, as none of the internal logic actually requires it.
gertjanvanzwieten
force-pushed
the
solver
branch
from
October 22, 2024 15:20
5a93ba3
to
7c0913e
Compare
This patch renames System.optimize to solve_constraints to reflect that the method is not limited to symmetric problems, and that its sole purpose is the establishment of Dirichlet constraints.
This patch removes the reference to solver.optimize from the docstring of the cahnhilliard example, which switched to using System.solve instead.
This patch adds unit tests solver.System that inspect the behaviour of the System object directly for combinations of linear and nonlinear, symmetric and non-symmetric, constant and matrix-constant inputs.
This patch removes rowsupp in System.solve_constraints and replaces it with a local implementation for column support. Aside from preparing for the imminent deprecation of rowsupp, switching to a column-based support test is more appropriate now that solve_constraints is no longer limited to symmetric systems, as the columns relate to the trial dofs that are being constrained. When in future row constraints will be better supported then the local test can be extended with a row test for non-symmetric systems.
gertjanvanzwieten
force-pushed
the
solver
branch
from
October 22, 2024 18:43
af610aa
to
0d4dbad
Compare
joostvanzwieten
approved these changes
Oct 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.