Skip to content

WIP [Optapp] Restart Optimization Process#14576

Open
Igarizza wants to merge 5 commits into
masterfrom
optapp/restart
Open

WIP [Optapp] Restart Optimization Process#14576
Igarizza wants to merge 5 commits into
masterfrom
optapp/restart

Conversation

@Igarizza

Copy link
Copy Markdown
Member

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

Igarizza and others added 4 commits July 14, 2026 09:04
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>
@Igarizza
Igarizza requested review from Copilot and sunethwarna July 14, 2026 09:08
@Igarizza Igarizza changed the title [WIP] [Optapp] Restart Optimization Process WIP [Optapp] Restart Optimization Process Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 OptimizationProblem state (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.

@Igarizza Igarizza self-assigned this Jul 15, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants