Skip to content

Commit

Permalink
seed: call pre and post at the correct place
Browse files Browse the repository at this point in the history
Call pre- and postprocessing at the correct place in SeedMixin,
so only before and after the actaul optimization.
  • Loading branch information
SGeeversAtVortech committed Nov 15, 2024
1 parent 698d354 commit 028e309
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/rtctools/optimization/seed_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,18 @@ def optimize(
postprocessing: bool = True,
log_solver_failure_as_error: bool = True,
) -> bool:
if preprocessing:
self.pre()
self._seed_timeseries = self.seed_options().seed_timeseries
fallback = self.seed_options().fallback
success = super().optimize(preprocessing, postprocessing, log_solver_failure_as_error)
success = super().optimize(
preprocessing=False,
postprocessing=False,
log_solver_failure_as_error=log_solver_failure_as_error,
)
if not success and self._use_seed_timeseries() and fallback:
self._seed_timeseries = None
success = super().optimize(preprocessing, postprocessing, log_solver_failure_as_error)
if postprocessing:
self.post()
return success

0 comments on commit 028e309

Please sign in to comment.