WIP [Optapp] Restart Optimization Process#14576
Open
Igarizza wants to merge 5 commits into
Open
Conversation
Introduces restart input/output processes that serialize and restore optimization problem state, with supporting changes across algorithms, controls, and convergence criteria to make their state restart-safe. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds restart/checkpoint capability to the OptimizationApplication so an optimization run can persist its full in-memory state to disk and later resume without re-initializing algorithm/control/convergence bookkeeping.
Changes:
- Introduces restart input/output processes that snapshot/restore
OptimizationProblemstate (including buffered data and tensor fields). - Makes several controls, projections, and convergence criteria restart-safe by persisting cross-iteration state in unbuffered data.
- Adds a steepest-descent restart regression test and adjusts initialization ordering in
optimization_analysis.py.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/SystemIdentificationApplication/custom_responses/measurement_residual_response_function.cpp | Minor formatting/line-ending adjustment. |
| applications/OptimizationApplication/tests/test_OptimizationApplication.py | Registers the new restart test in the suite. |
| applications/OptimizationApplication/tests/algorithm_tests/analysis_based_tests/algorithm_steepest_descent_restart/test_steepest_descent_restart.py | New end-to-end test validating restart equivalence. |
| applications/OptimizationApplication/tests/algorithm_tests/analysis_based_tests/algorithm_steepest_descent_restart/optimization_parameters.json | New parameters file for the restart test case. |
| applications/OptimizationApplication/python_scripts/utilities/optimization_problem.py | Adds SetStep() to support restore without cycling buffers. |
| applications/OptimizationApplication/python_scripts/utilities/opt_projection.py | Extends projections to accept/store restart data for adaptive state. |
| applications/OptimizationApplication/python_scripts/processes/optimization_problem_vtu_output_process.py | Changes VTU output behavior for sub model parts. |
| applications/OptimizationApplication/python_scripts/processes/optimization_problem_restart_output_process.py | New checkpoint writer process for restart payloads. |
| applications/OptimizationApplication/python_scripts/processes/optimization_problem_restart_input_process.py | New checkpoint reader process to restore problem state. |
| applications/OptimizationApplication/python_scripts/optimization_analysis.py | Moves execution-policy initialization earlier (before processes). |
| applications/OptimizationApplication/python_scripts/convergence_criteria/patience_conv_criterion.py | Persists/re-hydrates evolving state via unbuffered data. |
| applications/OptimizationApplication/python_scripts/convergence_criteria/max_iter_conv_criterion.py | Adjusts validation logic for max_iter. |
| applications/OptimizationApplication/python_scripts/convergence_criteria/magnitude_reduction_conv_criterion.py | Re-hydrates target value on restart. |
| applications/OptimizationApplication/python_scripts/convergence_criteria/l2_conv_criterion.py | Forces scalar float type for stored norm. |
| applications/OptimizationApplication/python_scripts/convergence_criteria/avg_abs_improvement_conv_criterion.py | Persists/re-hydrates evolving state via unbuffered data. |
| applications/OptimizationApplication/python_scripts/controls/thickness/shell_thickness_control.py | Wires projection restart data into thickness control. |
| applications/OptimizationApplication/python_scripts/controls/material/simp_control.py | Wires projection restart data into SIMP control projections. |
| applications/OptimizationApplication/python_scripts/algorithms/standardized_rgp_constraint.py | Persists evolving coefficients in unbuffered data for restart. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or 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
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.
📝 Description
Adds restart capability to the OptimizationApplication: an optimization run can now checkpoint its full in-memory state (problem data, controls, algorithm, convergence-criteria bookkeeping) to disk and resume from it later, continuing at the same step with the same internal state instead of re-initializing from scratch.
Tags: OptimizationApplication, SystemIdentificationApplication
Key changes
New OptimizationProblemRestartOutputProcess / OptimizationProblemRestartInputProcess to checkpoint and reload the OptimizationProblem's state (pickled BufferedDict tree, tensors converted to numpy since TensorAdaptors aren't picklable).
OptimizationProblem.SetStep() to let the restart process set the step counter without cycling the buffer.
Several algorithms/controls/convergence-criteria made restart-safe by persisting cross-iteration state into unbuffered data.
optimization_analysis.py: execution policies now initialize before processes.
A small, seemingly unrelated change in SystemIdentificationApplication/measurement_residual_response_function.cpp (dropped const, added commented-out debug code) — flagged for you to confirm before merge.
Validation
New test_steepest_descent_restart.py: runs to a step, restarts, and checks the resumed run matches an uninterrupted run.
Full text is at /tmp/claude-1000/-home-ihar-Software-Kratos-optapp/b2f4ea9d-756d-4a5f-bfa4-dc6a50995edc/scratchpad/pr_description.md.