Skip to content

Commit

Permalink
Update for SNOPT v7.7.5 (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
ewu63 authored Nov 12, 2020
1 parent a00327c commit 80ef569
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
3 changes: 2 additions & 1 deletion doc/optimizers/pysnopt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ Installation
SNOPT is available for purchase `here
<http://www.sbsi-sol-optimize.com/asp/sol_snopt.htm>`_. Upon purchase, you should receive a zip file. Within the zip file, there is a folder called ``src``. To use SNOPT with pyoptsparse, paste all files from ``src`` except snopth.f into ``pyoptsparse/pySNOPT/source``.

From v2.0 onwards, only SNOPT v7.7 is officially supported.
From v2.0 onwards, only SNOPT v7.7.x is officially supported.
To use pyOptSparse with previous versions of SNOPT, please checkout release v1.2.
The current version of SNOPT being tested is v7.7.5, although v7.7.1 is also expected to work.


Options
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.2.2"
__version__ = "2.3.0"

from .pyOpt_history import History
from .pyOpt_variable import Variable
Expand Down
2 changes: 0 additions & 2 deletions pyoptsparse/pyIPOPT/pyIPOPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,6 @@ def _set_ipopt_options(self, nlp):
def _on_setOption(self, name, value):
"""
Set Optimizer Option Value (Optimizer Specific Routine)
Documentation last updated: May. 07, 2008 - Ruben E. Perez
"""

self.set_options.append([name, value])
Expand Down
2 changes: 1 addition & 1 deletion pyoptsparse/pyOpt_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def setOption(self, name, value=None):
self.options[name] = [type(value), value]
else:
raise Error(
"Value type for option {} was incorrect. It was expecting type '{}' by received type '{}'".format(
"Value type for option {} was incorrect. It was expecting type '{}' but received type '{}'".format(
name, self.options["defaults"][name][0], type(value)
)
)
Expand Down
20 changes: 7 additions & 13 deletions pyoptsparse/pySNOPT/pySNOPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def __init__(self, raiseError=True, *args, **kwargs):
# SNOPT Other Tolerances Options
"Crash tolerance": [float, 0.1],
"Linesearch tolerance": [float, 0.9], # smaller for more accurate search
"Backoff factor": [float, 0.1], # backtracking factor for failed evaluations
"Pivot tolerance": [float, 3.7e-11], # epsilon^(2/3)
# SNOPT QP subproblems Options
"QPSolver": [str, "Cholesky"], # Default: Cholesky
Expand All @@ -88,6 +89,7 @@ def __init__(self, raiseError=True, *args, **kwargs):
# SNOPT SQP method Options
"Major iterations limit": [int, 1000], # or ncons if that is more
"Minor iterations limit": [int, 500], # or 3*ncons if that is more
"Proximal iterations limit": [int, 200], # for solving the proximal point problem
"Major step limit": [float, 2.0],
"Superbasics limit": [int, None], # (n1 + 1, n1 = number of nonlinear variables)
"Derivative level": [int, 3], # (NOT ALLOWED IN snOptA)
Expand Down Expand Up @@ -224,7 +226,10 @@ def __init__(self, raiseError=True, *args, **kwargs):
if raiseError:
raise Error("There was an error importing the compiled snopt module")

self.set_options = []
# any default options modified by pySNOPT goes here
self.set_options = [
["Proximal iterations limit", 10000], # very large # to solve proximal point problem to optimality
]
Optimizer.__init__(self, name, category, self.defOpts, self.informs, *args, **kwargs)

# SNOPT need Jacobians in csc format
Expand Down Expand Up @@ -663,10 +668,7 @@ def _set_snopt_options(self, iPrint, iSumm, cw, iw, rw):
# Set Options from the local options dictionary
# ---------------------------------------------
inform = np.array([-1], np.intc)
for item in self.set_options:
name = item[0]
value = item[1]

for name, value in self.set_options:
if name == "iPrint" or name == "iSumm":
continue

Expand Down Expand Up @@ -701,17 +703,13 @@ def _set_snopt_options(self, iPrint, iSumm, cw, iw, rw):
def _on_setOption(self, name, value):
"""
Set Optimizer Option Value (Optimizer Specific Routine)
Documentation last updated: May. 07, 2008 - Ruben E. Perez
"""

self.set_options.append([name, value])

def _on_getOption(self, name):
"""
Get Optimizer Option Value (Optimizer Specific Routine)
Documentation last updated: May. 07, 2008 - Ruben E. Perez
"""

pass
Expand All @@ -723,8 +721,6 @@ def _on_getInform(self, infocode):
Keyword arguments:
-----------------
id -> STRING: Option Name
Documentation last updated: May. 07, 2008 - Ruben E. Perez
"""

#
Expand All @@ -741,8 +737,6 @@ def _on_getInform(self, infocode):
def _on_flushFiles(self):
"""
Flush the Output Files (Optimizer Specific Routine)
Documentation last updated: August. 09, 2009 - Ruben E. Perez
"""

#
Expand Down

0 comments on commit 80ef569

Please sign in to comment.