Skip to content

Commit

Permalink
Updated Advanced Features section (#246)
Browse files Browse the repository at this point in the history
Co-authored-by: Neil Wu <[email protected]>
  • Loading branch information
marcomangano and ewu63 authored Apr 30, 2021
1 parent b7b707b commit 781643d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
33 changes: 29 additions & 4 deletions doc/advancedFeatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@ Advanced Features
.. Parallel Execution
.. ------------------
.. Storing Optimization History
.. ----------------------------
Storing Optimization History
----------------------------
pyOptSparse includes an :ref:`history` class that stores all the relevant optimization information an SQL database.
This database is updated at every optimization iteration, and can be accessed via both the API described in the linked section, and via :ref:`optview`.
By default, the history file is NOT written.
To turn the history recording on, use the ``storeHistory`` attribute when invoking the optimization run, e.g.:

.. code-block:: python
sol = opt(optProb, sens=sens, storedHistory="<your-history-file-name>.hst", ...)
Hot start
---------
Expand Down Expand Up @@ -39,8 +48,24 @@ Because the hot start process will store all the previous "restarted" iterations



.. Time limit
.. ----------
Time limit (for SNOPT only)
---------------------------
The :ref:`optimizer` class in pyOptSparse has an attribute used to set the maximum allowable wall time for optimizations using SNOPT.
The code will exit gracefully when such time limit is reached.
This feature is particularly useful when running a time-constrained job, as in the case of most HPC systems.
To enable this feature, use the ``timeLimit`` option when invoking the optimizer, as shown below:

.. code-block:: python
sol = opt(optProb, sens=sens, timeLimit=<int>,...)
Note that the attribute takes the maximum wall time *in seconds* as an integer number.

.. note::

pyOptSparse will verify that the computational time is not exceeded before proceeding to the next iteration.
It will NOT interrupt an ongoing function or sensitivity evaluation.
If your function evaluations are expensive, you should be more conservative when setting the ``timeLimit`` option for it to be effective.

.. Clean Optimization Termination
.. ------------------------------
2 changes: 2 additions & 0 deletions doc/postprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ There are three post-processing utilities that are provided with pyOptSparse.
- OptView-Dash is a `Dash <https://plotly.com/dash/>`_ implementation of OptView
- ``History`` is a Python class that can be used to read in the history file, and provide API for programmatically extracting data.

.. _optview:

OptView
-------
Requirements
Expand Down
2 changes: 1 addition & 1 deletion pyoptsparse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.6.0"
__version__ = "2.6.1"

from .pyOpt_history import History
from .pyOpt_variable import Variable
Expand Down

0 comments on commit 781643d

Please sign in to comment.