Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Jun 28, 2023
1 parent fc1d3b2 commit 5516b3e
Show file tree
Hide file tree
Showing 90 changed files with 144,835 additions and 143,746 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions _modules/dymos/phase/analytic_phase.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@

<li class="toctree-l2"><a class="reference internal" href="../../../examples/cart_pole/cart_pole.html">Cart-Pole Optimal Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../examples/brachistochrone/brachistochrone_tandem_phases.html">Brachistochrone with tandem phases</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../examples/cannonball_implicit_duration/cannonball_implicit_duration.html">Cannonball Implicit Duration</a></li>
</ul>
</li>
</ul>
Expand Down
69 changes: 68 additions & 1 deletion _modules/dymos/phase/phase.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@

<li class="toctree-l2"><a class="reference internal" href="../../../examples/cart_pole/cart_pole.html">Cart-Pole Optimal Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../examples/brachistochrone/brachistochrone_tandem_phases.html">Brachistochrone with tandem phases</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../examples/cannonball_implicit_duration/cannonball_implicit_duration.html">Cannonball Implicit Duration</a></li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -1105,7 +1106,7 @@ <h1>Source code for dymos.phase.phase</h1><div class="highlight"><pre>
<span class="n">ref</span><span class="o">=</span><span class="n">_unspecified</span><span class="p">,</span> <span class="n">targets</span><span class="o">=</span><span class="n">_unspecified</span><span class="p">,</span> <span class="n">rate_targets</span><span class="o">=</span><span class="n">_unspecified</span><span class="p">,</span>
<span class="n">rate2_targets</span><span class="o">=</span><span class="n">_unspecified</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="n">_unspecified</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Adds an polynomial control variable to be tied to a parameter in the ODE.</span>
<span class="sd"> Adds a polynomial control variable to be tied to a parameter in the ODE.</span>

<span class="sd"> Polynomial controls are defined by values at the Legendre-Gauss-Lobatto nodes of a</span>
<span class="sd"> single polynomial, defined on [-1, 1] in phase tau space.</span>
Expand Down Expand Up @@ -2102,6 +2103,67 @@ <h1>Source code for dymos.phase.phase</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="n">name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">_unspecified</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">time_options</span><span class="p">[</span><span class="s1">&#39;name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">name</span></div>

<span class="k">def</span> <span class="nf">set_duration_balance</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">val</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">index</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">units</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mult_val</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">normalize</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Adds a condition for the duration of the phase. This is satisfied using a nonlinear solver.</span>

<span class="sd"> Parameters</span>
<span class="sd"> ----------</span>
<span class="sd"> name : str</span>
<span class="sd"> Name of the variable. This should be a state or control variable, the path to an output</span>
<span class="sd"> from the top level of the RHS, or an expression to be evaluated. If an expression,</span>
<span class="sd"> it must be provided in the form of an equation with a left- and right-hand side.</span>
<span class="sd"> val : float</span>
<span class="sd"> The value that the residual must equal at the end point of the phase.</span>
<span class="sd"> index : int, optional</span>
<span class="sd"> If variable is an array at each point in time, this indicates which index is to be</span>
<span class="sd"> used as the objective, assuming C-ordered flattening.</span>
<span class="sd"> units : str, optional</span>
<span class="sd"> The units of the objective function. If None, use the units associated with the target.</span>
<span class="sd"> If provided, must be compatible with the target units.</span>
<span class="sd"> mult_val : float, optional</span>
<span class="sd"> Default value for the LHS multiplier.</span>
<span class="sd"> normalize : bool, optional</span>
<span class="sd"> Specifies whether the resulting residual should be normalized by a quadratic</span>
<span class="sd"> function of the RHS.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_options</span><span class="p">[</span><span class="s1">&#39;fix_duration&#39;</span><span class="p">]:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Cannot implicitly solve for phase duration when fix_duration is True&#39;</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">time_options</span><span class="p">[</span><span class="s1">&#39;input_duration&#39;</span><span class="p">]:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;Cannot implicitly solve for phase duration when input_duration is True&#39;</span><span class="p">)</span>

<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">[</span><span class="s1">&#39;transcription&#39;</span><span class="p">],</span> <span class="n">ExplicitShooting</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s1">&#39;Transcription ExplicitShooting does not implement method setup_duration_balance&#39;</span><span class="p">)</span>

<span class="n">options</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;name&#39;</span><span class="p">:</span> <span class="n">name</span><span class="p">,</span>
<span class="s1">&#39;val&#39;</span><span class="p">:</span> <span class="n">val</span><span class="p">,</span>
<span class="s1">&#39;index&#39;</span><span class="p">:</span> <span class="n">index</span><span class="p">,</span>
<span class="s1">&#39;units&#39;</span><span class="p">:</span> <span class="n">units</span><span class="p">,</span>
<span class="s1">&#39;mult_val&#39;</span><span class="p">:</span> <span class="n">mult_val</span><span class="p">,</span>
<span class="s1">&#39;normalize&#39;</span><span class="p">:</span> <span class="n">normalize</span><span class="p">}</span>

<span class="n">expr_operators</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;(&#39;</span><span class="p">,</span> <span class="s1">&#39;+&#39;</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="s1">&#39;*&#39;</span><span class="p">,</span> <span class="s1">&#39;&amp;&#39;</span><span class="p">,</span> <span class="s1">&#39;%&#39;</span><span class="p">,</span> <span class="s1">&#39;@&#39;</span><span class="p">]</span>
<span class="k">if</span> <span class="s1">&#39;=&#39;</span> <span class="ow">in</span> <span class="n">name</span><span class="p">:</span>
<span class="n">is_expr</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">elif</span> <span class="s1">&#39;=&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">name</span> <span class="ow">and</span> <span class="nb">any</span><span class="p">(</span><span class="n">opr</span> <span class="ow">in</span> <span class="n">name</span> <span class="k">for</span> <span class="n">opr</span> <span class="ow">in</span> <span class="n">expr_operators</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;The expression provided `</span><span class="si">{</span><span class="n">name</span><span class="si">}</span><span class="s1">` has invalid format. &#39;</span>
<span class="s1">&#39;Expression may be a single variable or an equation &#39;</span>
<span class="s1">&#39;of the form `constraint_name = func(vars)`&#39;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">is_expr</span> <span class="o">=</span> <span class="kc">False</span>

<span class="n">balance_name</span> <span class="o">=</span> <span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s1">&#39;=&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="k">if</span> <span class="n">is_expr</span> <span class="k">else</span> <span class="n">name</span>

<span class="n">options</span><span class="p">[</span><span class="s1">&#39;is_expr&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">is_expr</span>
<span class="n">options</span><span class="p">[</span><span class="s1">&#39;balance_name&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">balance_name</span>

<span class="bp">self</span><span class="o">.</span><span class="n">time_options</span><span class="p">[</span><span class="s1">&#39;t_duration_balance_options&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">options</span>

<span class="n">var_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">classify_var</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
<span class="k">if</span> <span class="n">var_type</span> <span class="o">==</span> <span class="s1">&#39;ode&#39;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">balance_name</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_timeseries</span><span class="p">[</span><span class="s1">&#39;timeseries&#39;</span><span class="p">][</span><span class="s1">&#39;outputs&#39;</span><span class="p">]:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add_timeseries_output</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">output_name</span><span class="o">=</span><span class="n">balance_name</span><span class="p">,</span> <span class="n">units</span><span class="o">=</span><span class="n">units</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">classify_var</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">var</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Classifies a variable of the given name or path.</span>
Expand Down Expand Up @@ -2181,6 +2243,9 @@ <h1>Source code for dymos.phase.phase</h1><div class="highlight"><pre>
<span class="n">transcription</span><span class="o">.</span><span class="n">setup_ode</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="n">transcription</span><span class="o">.</span><span class="n">setup_timeseries_outputs</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="n">transcription</span><span class="o">.</span><span class="n">setup_duration_balance</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="n">transcription</span><span class="o">.</span><span class="n">setup_defects</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
<span class="n">transcription</span><span class="o">.</span><span class="n">setup_solvers</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

Expand Down Expand Up @@ -2240,6 +2305,8 @@ <h1>Source code for dymos.phase.phase</h1><div class="highlight"><pre>

<span class="n">transcription</span><span class="o">.</span><span class="n">configure_timeseries_outputs</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="n">transcription</span><span class="o">.</span><span class="n">configure_duration_balance</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="n">transcription</span><span class="o">.</span><span class="n">configure_solvers</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">check_time_options</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
Expand Down
1 change: 1 addition & 0 deletions _modules/dymos/run_problem.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@

<li class="toctree-l2"><a class="reference internal" href="../../examples/cart_pole/cart_pole.html">Cart-Pole Optimal Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../examples/brachistochrone/brachistochrone_tandem_phases.html">Brachistochrone with tandem phases</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../examples/cannonball_implicit_duration/cannonball_implicit_duration.html">Cannonball Implicit Duration</a></li>
</ul>
</li>
</ul>
Expand Down
Loading

0 comments on commit 5516b3e

Please sign in to comment.