Skip to content
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

fix optimizer writeStep final (if optimization ends for reaching the limit number of iterations) #2387

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ravenframework/Models/Code.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ def evaluateSample(self, myInput, samplerType, kwargs):
sampleDirectory = os.path.join(os.getcwd(),metaData['subDirectory'])
localenv = dict(os.environ)
localenv['PWD'] = str(sampleDirectory)
os.makedirs(os.path.dirname(os.path.join(sampleDirectory,codeLogFile)), exist_ok=True)
outFileObject = open(os.path.join(sampleDirectory,codeLogFile), 'w', bufferSize)

found = False
Expand Down
6 changes: 6 additions & 0 deletions ravenframework/Steps/MultiRun.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ def _localTakeAstepRun(self, inDictionary):
# END while loop that runs the step iterations (collection and submission-for-DET)
# if any collected runs failed, let the sampler treat them appropriately, and any other closing-out actions
sampler.finalizeSampler(self.failedRuns)
for myLambda, outIndex in self._outputCollectionLambda:
if isinstance(outputs[outIndex], OutStreamEntity):
myLambda([None,outputs[outIndex]])
self.raiseAMessage(f'Just collected job {finishedJob.identifier} and sent to output "{inDictionary["Output"][outIndex].name}"')


alfoa marked this conversation as resolved.
Show resolved Hide resolved

def _addNewRuns(self, sampler, model, inputs, outputs, jobHandler, inDictionary, verbose=True):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
The objective variable is ans. The problem in unconstrained, it is a maximization problem, and the sampling is from discrete variables without replacement.
The convergence criterion used is the (p-Average Hausdorff Distance between populations) AHDp.
</description>
<revisions>
<revision author="alfoa" date="2024-10-21">Modified writeSteps to ``final'' to makes sure the Outstream is executed and the final solution is always written. Closes #2386</revision>
alfoa marked this conversation as resolved.
Show resolved Hide resolved
</revisions>
<analytic>
This test uses myLocalSum's analytic objective function.
</analytic>
Expand Down
Loading