-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1894 from PaulTalbot-INL/workshop_opt_2022
Workshop 2022: Grad Desc Opt
- Loading branch information
Showing
29 changed files
with
470 additions
and
605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<Simulation verbosity="debug" color="true"> | ||
<TestInfo> | ||
<name>doc/workshop/optimizer/Inputs.GradDesc</name> | ||
<author>talbpw</author> | ||
<created>2022-07-13</created> | ||
<classesTested>Samplers.Optimizer</classesTested> | ||
<description>Workshop exercise for gradient descent with projectile</description> | ||
</TestInfo> | ||
|
||
<RunInfo> | ||
<WorkingDir>GradDesc</WorkingDir> | ||
<Sequence>optimize,print</Sequence> | ||
</RunInfo> | ||
|
||
<Steps> | ||
<MultiRun name="optimize"> | ||
<Optimizer class="Optimizers" type="FiniteDifference">opter</Optimizer> | ||
<Input class="DataObjects" type="PointSet">placeholder</Input> | ||
<Model class="Models" type="ExternalModel">projectile</Model> | ||
<SolutionExport class="DataObjects" type="PointSet">search_path</SolutionExport> | ||
<Output class="DataObjects" type="PointSet">results</Output> | ||
</MultiRun> | ||
<IOStep name="print"> | ||
<Input class="DataObjects" type="PointSet">search_path</Input> | ||
<Output class="OutStreams" type="Print">opt_search</Output> | ||
<Output class="OutStreams" type="Plot">path</Output> | ||
</IOStep> | ||
</Steps> | ||
|
||
<Models> | ||
<ExternalModel ModuleToLoad="../../../../tests/framework/AnalyticModels/projectile.py" name="projectile" subType=""> | ||
<inputs>v0,y0,angle</inputs> | ||
<outputs>r,t,ymax</outputs> | ||
</ExternalModel> | ||
</Models> | ||
|
||
<Optimizers> | ||
<GradientDescent name="opter"> | ||
<objective>r</objective> | ||
<variable name="v0"> | ||
<distribution>v0_dist</distribution> | ||
<initial>15</initial> | ||
</variable> | ||
<variable name="angle"> | ||
<distribution>ang_dist</distribution> | ||
<initial>70</initial> | ||
</variable> | ||
<constant name="y0">0</constant> | ||
<constant name="timeOption">1</constant> | ||
<samplerInit> | ||
<limit>1000</limit> | ||
<initialSeed>42</initialSeed> | ||
<type>max</type> | ||
<writeSteps>every</writeSteps> | ||
</samplerInit> | ||
<gradient><FiniteDifference/></gradient> | ||
<stepSize> | ||
<GradientHistory> | ||
<growthFactor>1.1</growthFactor> | ||
<shrinkFactor>1.1</shrinkFactor> | ||
<initialStepScale>0.9</initialStepScale> | ||
</GradientHistory> | ||
</stepSize> | ||
<convergence> | ||
<gradient>1e-2</gradient> | ||
<objective>1e-1</objective> | ||
</convergence> | ||
<acceptance><Strict/></acceptance> | ||
<TargetEvaluation class="DataObjects" type="PointSet">results</TargetEvaluation> | ||
</GradientDescent> | ||
</Optimizers> | ||
|
||
<Distributions> | ||
<Uniform name='v0_dist'> | ||
<lowerBound>10</lowerBound> | ||
<upperBound>170</upperBound> | ||
</Uniform> | ||
<Uniform name='ang_dist'> | ||
<lowerBound>10</lowerBound> | ||
<upperBound>80</upperBound> | ||
</Uniform> | ||
</Distributions> | ||
|
||
<DataObjects> | ||
<PointSet name="placeholder"> | ||
<Input>v0,angle</Input> | ||
</PointSet> | ||
<PointSet name="results"> | ||
<Input>v0,angle</Input> | ||
<Output>r,t,ymax</Output> | ||
</PointSet> | ||
<PointSet name="search_path"> | ||
<Input>trajID</Input> | ||
<Output>iteration,accepted,v0,angle,ymax,r</Output> | ||
</PointSet> | ||
</DataObjects> | ||
|
||
<OutStreams> | ||
<Print name="opt_search"> | ||
<type>csv</type> | ||
<source>search_path</source> | ||
<clusterLabel>trajID</clusterLabel> | ||
</Print> | ||
<Plot name="path" subType="OptPath"> | ||
<source>search_path</source> | ||
<vars>v0,angle,ymax,r</vars> | ||
</Plot> | ||
</OutStreams> | ||
|
||
</Simulation> |
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
doc/workshop/optimizer/Inputs/gold/GradDesc/opt_search_0.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
iteration,accepted,v0,angle,ymax,r | ||
0.0,first,15.0,70.0,10.1367346863,14.7578787938 | ||
1.0,accepted,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
2.0,rejected,170.0,10.0,44.4613076349,1008.61042266 | ||
3.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
4.0,rejected,170.0,13.9894478388,86.1688459615,1383.50288229 | ||
5.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
6.0,rejected,170.0,16.4786446152,118.64015279,1604.2853054 | ||
7.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
8.0,rejected,170.0,20.404332355,179.227012862,1927.26159917 | ||
9.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
10.0,rejected,170.0,25.0022770774,263.397903877,2259.20009124 | ||
11.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
12.0,rejected,170.0,28.0438357285,325.918501952,2447.33531994 | ||
13.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
14.0,rejected,170.0,30.1036423604,370.934723779,2559.20892733 | ||
15.0,rerun,170.0,58.8502986362,1079.95412904,2610.99344312 | ||
16.0,accepted,170.0,33.3396713702,445.386886331,2708.05890812 | ||
17.0,rejected,170.0,58.3001803453,1067.35715087,2636.8342839 | ||
18.0,rerun,170.0,33.3396713702,445.386886331,2708.05890812 | ||
19.0,accepted,170.0,55.3741697451,998.424177569,2757.72492746 | ||
19.0,final,170.0,55.3741697451,998.424177569,2757.72492746 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.