From a7988b28e214a5f0065c669a7d68d0e237a37718 Mon Sep 17 00:00:00 2001 From: "Paul W. Talbot" Date: Mon, 19 Jul 2021 13:50:19 -0600 Subject: [PATCH 1/2] added check for a None soln export --- framework/Samplers/AdaptiveSampler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/Samplers/AdaptiveSampler.py b/framework/Samplers/AdaptiveSampler.py index 20aac89d10..be90bbe832 100644 --- a/framework/Samplers/AdaptiveSampler.py +++ b/framework/Samplers/AdaptiveSampler.py @@ -76,6 +76,8 @@ def initialize(self, externalSeeding=None, solutionExport=None): @ Out, None """ self._targetEvaluation = self.assemblerDict['TargetEvaluation'][0][3] + if solutionExport is None: + self.raiseAnError('No found this step! Required for adaptive sampling.') self._solutionExport = solutionExport Sampler.initialize(self, externalSeeding=externalSeeding, solutionExport=solutionExport) self._validateSolutionExportVariables(solutionExport) From 03013447c5d133122b381f377d6cc54d9a35a625 Mon Sep 17 00:00:00 2001 From: "Paul W. Talbot" Date: Mon, 19 Jul 2021 17:48:13 -0600 Subject: [PATCH 2/2] moved to Optimizer req --- framework/Optimizers/Optimizer.py | 1 + framework/Samplers/AdaptiveSampler.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/Optimizers/Optimizer.py b/framework/Optimizers/Optimizer.py index 625357986c..53455d477c 100644 --- a/framework/Optimizers/Optimizer.py +++ b/framework/Optimizers/Optimizer.py @@ -172,6 +172,7 @@ def __init__(self): self._initSampler = None # sampler to use for picking initial seeds self._constraintFunctions = [] # list of constraint functions self._impConstraintFunctions = [] # list of implicit constraint functions + self._requireSolnExport = True # optimizers only produce result in solution export # __private # additional methods self.addAssemblerObject('Constraint', InputData.Quantity.zero_to_infinity) # Explicit (input-based) constraints diff --git a/framework/Samplers/AdaptiveSampler.py b/framework/Samplers/AdaptiveSampler.py index be90bbe832..5ab6d90ff1 100644 --- a/framework/Samplers/AdaptiveSampler.py +++ b/framework/Samplers/AdaptiveSampler.py @@ -63,6 +63,7 @@ def __init__(self): self._inputIdentifiers = {} # identifiers for a single realization self._targetEvaluation = None # data object with feedback from sample realizations self._solutionExport = None # data object for solution printing + self._requireSolnExport = False # if this object requires a solution export # NOTE TargetEvaluations consider all the Step DataObjects as candidates, so requiring # exactly one TargetEvaluation forces only having one DataObject in AdaptiveSampling # MultiRun Steps. For now, we leave it as "n". @@ -76,8 +77,8 @@ def initialize(self, externalSeeding=None, solutionExport=None): @ Out, None """ self._targetEvaluation = self.assemblerDict['TargetEvaluation'][0][3] - if solutionExport is None: - self.raiseAnError('No found this step! Required for adaptive sampling.') + if self._requireSolnExport and solutionExport is None: + self.raiseAnError(IOError, 'No found this step! Required for this sampling strategy.') self._solutionExport = solutionExport Sampler.initialize(self, externalSeeding=externalSeeding, solutionExport=solutionExport) self._validateSolutionExportVariables(solutionExport)