raven icon indicating copy to clipboard operation
raven copied to clipboard

[DEFECT] Mismatch in MultiRun "type" for GradientDescent Optimizer

Open PaulTalbot-INL opened this issue 2 years ago • 2 comments

Thank you for the defect report

Defect Description

This is a bookkeeping issue, not a performance issue.

In the Optimizers block after #1163 was merged, the various a-la-carte features were collected into the GradientDescent header, such as:

<Optimizers>
  <GradientDescent name="opter">
  ...

However, the mapping to the type in the MultiRun.Optimizer was not updated, and still requires it to be SPSA, FiniteDifference, or ConjugateGradient, such as

<MultiRun name="opt">
  <Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
  ...

The MultiRun fails if you use type="GradientDescent".

This underscores the futility of the type in MultiRun as a hard mapping defined in Models. At minimum, the mapping should be updated with the new terminology, and a conversion script supplied.

Steps to Reproduce

Change the type in the basic test for GradientDescent Optimizers from SPSA to GradientDescent.

Expected Behavior

Use current types, or more intelligent typing system.

Screenshots and Input Files

Traceback (most recent call last):
  File "/Users/talbpw/projects/raven/raven_framework.py", line 26, in <module>
    sys.exit(main(True))
  File "/Users/talbpw/projects/raven/ravenframework/Driver.py", line 147, in main
    simulation.XMLread(root,runInfoSkip=set(["DefaultInputFile"]),xmlFilename=inputFile)
  File "/Users/talbpw/projects/raven/ravenframework/Simulation.py", line 379, in XMLread
    self.instantiateEntities(xmlNode, runInfoSkip, xmlFilename)
  File "/Users/talbpw/projects/raven/ravenframework/Simulation.py", line 492, in instantiateEntities
    entity.readXML(block, varGroups, globalAttributes=globalAttributes)
  File "/Users/talbpw/projects/raven/ravenframework/BaseClasses/BaseEntity.py", line 99, in readXML
    self._readMoreXML(xmlNode)
  File "/Users/talbpw/projects/raven/ravenframework/Steps/Step.py", line 148, in _readMoreXML
    self._handleInput(paramInput)
  File "/Users/talbpw/projects/raven/ravenframework/Steps/Step.py", line 195, in _handleInput
    self._localInputAndCheckParam(paramInput)
  File "/Users/talbpw/projects/raven/ravenframework/Steps/MultiRun.py", line 59, in _localInputAndCheckParam
    SingleRun._localInputAndCheckParam(self,paramInput)
  File "/Users/talbpw/projects/raven/ravenframework/Steps/SingleRun.py", line 99, in _localInputAndCheckParam
    Models.validate(self.parList[modelIndex][2], role, toBeTested[role])
  File "/Users/talbpw/projects/raven/ravenframework/Models/Factory.py", line 49, in validate
    return factory.returnClass(className).localValidateMethod(role, what)
  File "/Users/talbpw/projects/raven/ravenframework/Models/Model.py", line 188, in localValidateMethod
    raise IOError('The number of times class = '+str(tester['class'])+' type= ' +str(tester['type'])+' is used as '+str(who)+' is improper. Number of allowable times is '+str(tester['multiplicity'])+'.Got '+str(tester['tempCounter']))
OSError: The number of times class = Optimizers type= ['SPSA', 'FiniteDifference', 'ConjugateGradient', 'SimulatedAnnealing', 'GeneticAlgorithm'] is used as Optimizer is improper. Number of allowable times is 1.Got 0

OS

MacOS

OS Version

No response

Dependency Manager

CONDA

For Change Control Board: Issue Review

  • [ ] Is it tagged with a type: defect or task?
  • [ ] Is it tagged with a priority: critical, normal or minor?
  • [ ] If it will impact requirements or requirements tests, is it tagged with requirements?
  • [ ] If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users.
  • [ ] Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)

For Change Control Board: Issue Closure

  • [ ] If the issue is a defect, is the defect fixed?
  • [ ] If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)
  • [ ] If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?
  • [ ] If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?
  • [ ] If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?

PaulTalbot-INL avatar Jul 13 '22 17:07 PaulTalbot-INL

@PaulTalbot-INL Could you address this issue in the next couple of weeks?

wangcj05 avatar Jul 29 '22 15:07 wangcj05

With this being the end of the intern season and the start of the EOFY activities, I find it unlikely that I can spend much time on this soon. I have it on my backlog, though.

PaulTalbot-INL avatar Aug 01 '22 14:08 PaulTalbot-INL