Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/build_real.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ touch ~/.config/pip/constraints.txt
pip install .[optview,testing] -v

# move pip constraints file back
mv ~/.config/pip/constraints.txt.bkup ~/.config/pip/constraints.txt
mv ~/.config/pip/constraints.txt.bkup ~/.config/pip/constraints.txt
2 changes: 1 addition & 1 deletion .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
versions: [{python: "3.10", numpy: "1.22"}, {python: "3.11", numpy: "1.25"}, {python: "3.12", numpy: "2.1"}]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.versions.python }}
- name: Install runtime numpy ${{ matrix.versions.numpy }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
syntax: glob

# Ignore ruff and pre-commit config files
.pre-commit-config.yaml

build
doc/_build
*.pyc
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"name": "Joaquim R. R. A. Martins"
}
]
}
}
2 changes: 1 addition & 1 deletion doc/_static/pyOptSparse_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ The following list summarizes some of the changes/improvements made to pyOpt to
* User specification of design variable scaling
* User specification of constraint scaling
* Design variable returns in dictionary format only
* Specification of linear constraints, dense or sparse
* Sparse non-linear Jacobians
* Specification of linear constraints, dense or sparse
* Sparse non-linear Jacobians
* New history file format. Uses SQLite dictionaries.
* Fixed hot start bug where first call to user functions is a gradient. It is now guaranteed, that the first call is to the function evaluation, not the gradient.
* Various bug fixes in SNOPT
Expand Down
4 changes: 2 additions & 2 deletions doc/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Linear constraints in pyOptSparse are defined exclusively by ``jac``, ``lower``,
For linear constraint :math:`g_L \leq Ax + b \leq g_U`, the constraint definition would look like:

.. code-block:: python

optProb.addConGroup("con", num_cons, linear=True, wrt=["xvars"], jac={"xvars": A}, lower=gL - b, upper=gU - b)

Users should not provide the linear constraint values (i.e., :math:`g = Ax + b`) in a user-defined objective/constraint function.
Expand Down Expand Up @@ -310,4 +310,4 @@ See the optimizer-specific documentation page for more details.

Postprocessing
++++++++++++++
The result of the optimization is returned in a :class:`pyoptsparse.pyOpt_solution.Solution` object.
The result of the optimization is returned in a :class:`pyoptsparse.pyOpt_solution.Solution` object.
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Some key features of pyOptSparse include:


pyOptSparse is a fork of `pyOpt <http://www.pyopt.org/>`_.
However, it is not backwards compatible with pyOpt and thus optimization scripts will need to be modified to use pyOptSparse.
However, it is not backwards compatible with pyOpt and thus optimization scripts will need to be modified to use pyOptSparse.

Getting Started
===============
Expand Down
2 changes: 1 addition & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ To install pyOptSparse including those dependencies, run

pip install .[optview]

If you encounter a ``no module named tkinter`` error when trying to run optview, you may need to `install tkinter on your system <https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter>`__.
If you encounter a ``no module named tkinter`` error when trying to run optview, you may need to `install tkinter on your system <https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter>`__.

Testing
-------
Expand Down
1 change: 0 additions & 1 deletion doc/optimizers/CONMIN.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ API

.. autoclass:: CONMIN
:members: __call__

1 change: 0 additions & 1 deletion doc/optimizers/IPOPT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ API

.. autoclass:: IPOPT
:members: __call__

1 change: 0 additions & 1 deletion doc/optimizers/NLPQLP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ API

.. autoclass:: NLPQLP
:members: __call__

1 change: 0 additions & 1 deletion doc/optimizers/NSGA2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ API

.. autoclass:: NSGA2
:members: __call__

1 change: 0 additions & 1 deletion doc/optimizers/PSQP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ API

.. autoclass:: PSQP
:members: __call__

1 change: 0 additions & 1 deletion doc/optimizers/SLSQP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ API

.. autoclass:: SLSQP
:members: __call__

10 changes: 5 additions & 5 deletions doc/optimizers/SLSQP_options.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
ACC:
ACC:
desc: Convergence Accurancy
MAXIT:
MAXIT:
desc: Maximum Iterations
IPRINT:
IPRINT:
desc: Output Level (<0 - None, 0 - Screen, 1 - File)
IOUT:
IOUT:
desc: Output Unit Number
IFILE:
IFILE:
desc: Output File Name
3 changes: 1 addition & 2 deletions doc/optimizers/SNOPT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Installation

Building from source
********************
SNOPT is available for purchase `here
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.x is officially supported.
Expand Down Expand Up @@ -65,4 +65,3 @@ API

.. autoclass:: SNOPT
:members: __call__

2 changes: 1 addition & 1 deletion doc/postprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Requirements
\-axisartist (OptView)
numpy (OptView)

For installation instructions, see :ref:`install_optview`.
For installation instructions, see :ref:`install_optview`.
Although not necessary for most usage, the ``dill`` package is needed if you wish to save an editable version of the graph produced in ``OptView``.
``dill`` can be installed via ``pip`` in a terminal using

Expand Down
2 changes: 1 addition & 1 deletion doc/pyoptsparse.bib
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,4 @@ @article{Lyu2015b
volume = {53},
year = {2015},
keywords = {MACH}
}
}
24 changes: 12 additions & 12 deletions doc/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ For the TP37, the objective function is a simple analytic function:

Notes:

* The ``xdict`` variable is a dictionary whose keys are the names from each
:meth:`~pyoptsparse.pyOpt_optimization.Optimization.addVar` and
* The ``xdict`` variable is a dictionary whose keys are the names from each
:meth:`~pyoptsparse.pyOpt_optimization.Optimization.addVar` and
:meth:`~pyoptsparse.pyOpt_optimization.Optimization.addVarGroup` call. The line

.. code-block:: python

x = xdict["xvars"]

retrieves an array of length 3 which are all the variables for this optimization.
retrieves an array of length 3 which are all the variables for this optimization.

* The line

Expand All @@ -62,7 +62,7 @@ Now the optimization problem can be initialized:
:end-before: # rst begin addVar

This creates an instance of the optimization class with a name and a reference to the objective function.
To complete the setup of the optimization problem, the design variables and constraints need to be defined.
To complete the setup of the optimization problem, the design variables and constraints need to be defined.

Design variables and constraints can be added either one-by-one or as a group.
Adding variables by group is generally recommended for related variables:
Expand All @@ -84,7 +84,7 @@ It is recommended that related constraints are added by group where possible:
:end-before: # rst begin addObj

This call adds two variables with name ``con``.
There is no lower bound for the variables and the upper bound is 0.0.
There is no lower bound for the variables and the upper bound is 0.0.

We must also assign the the key value for the objective using the
:meth:`~pyoptsparse.pyOpt_optimization.Optimization.addObj` call:
Expand Down Expand Up @@ -112,9 +112,9 @@ which produces the following table::

Variables (c - continuous, i - integer, d - discrete)
Index Name Type Lower Bound Value Upper Bound Status
0 xvars_0 c 0.000000E+00 1.000000E+01 4.200000E+01
1 xvars_1 c 0.000000E+00 1.000000E+01 4.200000E+01
2 xvars_2 c 0.000000E+00 1.000000E+01 4.200000E+01
0 xvars_0 c 0.000000E+00 1.000000E+01 4.200000E+01
1 xvars_1 c 0.000000E+00 1.000000E+01 4.200000E+01
2 xvars_2 c 0.000000E+00 1.000000E+01 4.200000E+01

Constraints (i - inequality, e - equality)
Index Name Type Lower Value Upper Status Lagrange Multiplier (N/A)
Expand Down Expand Up @@ -152,7 +152,7 @@ which produces the following output::
================================================================================
Objective Function: objfunc

Solution:
Solution:
--------------------------------------------------------------------------------
Total Time: 0.0062
User Objective Time : 0.0001
Expand All @@ -169,9 +169,9 @@ which produces the following output::

Variables (c - continuous, i - integer, d - discrete)
Index Name Type Lower Bound Value Upper Bound Status
0 xvars_0 c 0.000000E+00 2.399997E+01 4.200000E+01
1 xvars_1 c 0.000000E+00 1.200001E+01 4.200000E+01
2 xvars_2 c 0.000000E+00 1.200000E+01 4.200000E+01
0 xvars_0 c 0.000000E+00 2.399997E+01 4.200000E+01
1 xvars_1 c 0.000000E+00 1.200001E+01 4.200000E+01
2 xvars_2 c 0.000000E+00 1.200000E+01 4.200000E+01

Constraints (i - inequality, e - equality)
Index Name Type Lower Value Upper Status Lagrange Multiplier (N/A)
Expand Down
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx_mdolab_theme>=1.2
sphinx-codeautolink
sphinx-codeautolink
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ else
endif
py3_dep = py3_target.dependency()

subdir('pyoptsparse')
subdir('pyoptsparse')
2 changes: 1 addition & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ option('python_target', type: 'string', value: '',
to be built for is different than the Python installation that is used to run Meson. For example, Meson may be installed
on the user's system which is run using the system Python installation, but the user may want build PyOptSparse for
a Python installation in a virtual environment. Leave as an empty string to build for Python installation running
Meson.''')
Meson.''')
2 changes: 1 addition & 1 deletion paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ At time of writing, the latest released version of pyOptSparse is v2.2.0.
pyOptSparse provides built-in support for several popular proprietary and open-source optimizers.
Each optimizer usually has its own way to specify the problem:
It might require different constraint ordering, have different ways of specifying equality constraints, or use a sparse matrix format to represent the constraint Jacobian.
pyOptSparse provides a common Python interface for the various optimizers that hides these differences from the user.
pyOptSparse provides a common Python interface for the various optimizers that hides these differences from the user.
By isolating the optimization problem definition from the optimizer, the user can easily switch between different optimizers applied to the same optimization problem.
The optimizer can be switched by editing a single line of code.

Expand Down
2 changes: 1 addition & 1 deletion pyoptsparse/postprocessing/assets/base-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,4 @@ there.
@media (min-width: 1000px) {}

/* Larger than Desktop HD */
@media (min-width: 1200px) {}
@media (min-width: 1200px) {}
2 changes: 1 addition & 1 deletion pyoptsparse/postprocessing/assets/custom-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
.plot-container {
height: 90vh;
width: 100vh;
}
}
2 changes: 1 addition & 1 deletion pyoptsparse/postprocessing/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ py3_target.install_sources(
asset_sources,
pure: true,
subdir: 'pyoptsparse/postprocessing/assets'
)
)
20 changes: 10 additions & 10 deletions pyoptsparse/pyALPSO/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ALPSO - Augmented Lagrangian Particle Swarm Optimizer
Copyright (c) 2011, Dr. Ruben E. Perez ([email protected])
and Peter W. Jansen ([email protected])

ALPSO is free software: you can redistribute it and/or modify it
ALPSO is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
Expand All @@ -15,19 +15,19 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Non-free versions of ALPSO are available under terms different
from those of the General Public License. For more information
related to such a license, future developments and/or technical
support, contact Dr. Ruben E. Perez ([email protected]) or
Non-free versions of ALPSO are available under terms different
from those of the General Public License. For more information
related to such a license, future developments and/or technical
support, contact Dr. Ruben E. Perez ([email protected]) or
Peter W. Jansen ([email protected]).

In addition, we kindly ask you to acknowledge the code authors in
any program, application or publication in which you use it. For
In addition, we kindly ask you to acknowledge the code authors in
any program, application or publication in which you use it. For
published works that use ALPSO we suggest referencing:

P. Jansen and R. Perez, "Constrained Structural Design Optimization
via a Parallel Augmented Lagrangian Particle Swarm Optimization
Approach", International Journal of Computers and Structures,
P. Jansen and R. Perez, "Constrained Structural Design Optimization
via a Parallel Augmented Lagrangian Particle Swarm Optimization
Approach", International Journal of Computers and Structures,
Vol. 89, No. 13-14, pp. 1352–1366, 2011.

----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pyoptsparse/pyALPSO/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ py3_target.install_sources(
python_sources,
pure: true,
subdir: 'pyoptsparse/pyALPSO'
)
)
4 changes: 2 additions & 2 deletions pyoptsparse/pyALPSO/pyALPSO.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def _on_setOption(self, name, value):
from . import alpso_ext

self.alpso = alpso_ext
except ImportError:
raise ImportError("pyALPSO: ALPSO EXT shared library failed to import.")
except ImportError as e:
raise ImportError("pyALPSO: ALPSO EXT shared library failed to import.") from e

def _communicateSolution(self, sol):
if sol is not None:
Expand Down
2 changes: 1 addition & 1 deletion pyoptsparse/pyCONMIN/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA.

----------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions pyoptsparse/pyCONMIN/source/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This directory contains the Fortran 77 source for CONMIN
modified for pyOpt interfacing by Dr. Ruben E. Perez,
plus two helper files called openunit.f and closeunit.f
This directory contains the Fortran 77 source for CONMIN
modified for pyOpt interfacing by Dr. Ruben E. Perez,
plus two helper files called openunit.f and closeunit.f
to manipulate Fortran units from Python.
Loading
Loading