Skip to content

Commit

Permalink
Fix GradientDescent Opt to not require FiniteDiff type (#2177)
Browse files Browse the repository at this point in the history
* Fix GradientDescent Opt to not require FiniteDiff type

* Modify CodeInterface Opt Test

* Add back in SimulatedAnnealing

* Fix Workshop Optimizer Test
  • Loading branch information
dylanjm authored Sep 9, 2023
1 parent 2b16e7a commit b684200
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion doc/workshop/optimizer/Inputs/1_grad_desc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<Steps>
<MultiRun name="optimize">
<Optimizer class="Optimizers" type="FiniteDifference">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">projectile</Model>
<SolutionExport class="DataObjects" type="PointSet">search_path</SolutionExport>
Expand Down
6 changes: 2 additions & 4 deletions ravenframework/Models/Model.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,9 @@ class cls.
validateDict['Optimizer'][0]['class' ] ='Optimizers'
validateDict['Optimizer'][0]['required' ] = False
validateDict['Optimizer'][0]['multiplicity'] = 1
validateDict['Optimizer'][0]['type'] = ['SPSA',
'FiniteDifference',
'ConjugateGradient',
'SimulatedAnnealing',
validateDict['Optimizer'][0]['type'] = ['GradientDescent',
'GeneticAlgorithm',
'SimulatedAnnealing',
'BayesianOptimizer']

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/CodeInterfaceTests/RAVEN/optimizer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Input class="Files" type="raven">inner_input</Input>
<Model class="Models" type="Code">raven</Model>
<!-- <Sampler class="Samplers" type="Grid">grid</Sampler> -->
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">outer_samples</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@
<MultiRun name="optimize_fd">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter_fd</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter_fd</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export_fd</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut_fd</Output>
</MultiRun>
<MultiRun name="optimize_cd">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter_cd</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter_cd</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export_cd</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut_cd</Output>
</MultiRun>
<MultiRun name="optimize_spsa">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter_spsa</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter_spsa</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export_spsa</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut_spsa</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/basic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">slant</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">goal</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/fd_conjgrad.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/max.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/minimal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/multitraj.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/spsa.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">goal</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
<Output class="OutStreams" type="Print">opt_export</Output>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/valley.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">valley</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/Optimizers/GradientDescent/write_final.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">dummyIN</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<MultiRun name="testMetamodelHeatTransfer">
<Input class="DataObjects" type="PointSet">inputHolder</Input>
<Model class="Models" type="EnsembleModel">heatTransferEnsembleModel</Model>
<Optimizer class="Optimizers" type="SPSA">opt_smp</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opt_smp</Optimizer>
<SolutionExport class="DataObjects" type="PointSet">optData</SolutionExport>
<Output class="DataObjects" type="PointSet">metaModelOutputTest</Output>
<Output class="DataObjects" type="PointSet">optOutput</Output>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/user_guide/optimizing/constrain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="HistorySet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="HistorySet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/user_guide/optimizing/simple.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="HistorySet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/user_guide/optimizing/step_size.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<MultiRun name="optimize">
<Input class="DataObjects" type="PointSet">placeholder</Input>
<Model class="Models" type="ExternalModel">beale</Model>
<Optimizer class="Optimizers" type="SPSA">opter</Optimizer>
<Optimizer class="Optimizers" type="GradientDescent">opter</Optimizer>
<SolutionExport class="DataObjects" type="HistorySet">opt_export</SolutionExport>
<Output class="DataObjects" type="PointSet">optOut</Output>
</MultiRun>
Expand Down

0 comments on commit b684200

Please sign in to comment.