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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ALPSO, CONMIN, IPOPT, NLPQLP, NSGA2, PSQP, SLSQP, ParOpt and SNOPT are currently

We do not provide the source code for SNOPT and NLPQLP, due to their restrictive license requirements.
Please contact the authors of the respective optimizers if you wish to obtain them.
Furthermore, ParOpt and IPOPT are available as a open source package but must be installed separately.
Furthermore, ParOpt and IPOPT are available as open source packages but must be installed separately.
Please see the documentation page of each optimizer for purchase and installation instructions.

## Integration into other frameworks
Expand Down
1 change: 0 additions & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pyOptSparse has the following dependencies:
We recommend ``gcc`` and ``gfortran`` which can be installed via the package manager for your operating system.

Please make sure these are installed and available for use.
In order to use NSGA2, SWIG (v1.3+) is also required, which can be installed via the package manager.
Python dependencies are automatically handled by ``pip``, so they do not need to be installed separately.

.. note::
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.13.1"
__version__ = "2.13.2"

from .pyOpt_history import History
from .pyOpt_variable import Variable
Expand Down
66 changes: 31 additions & 35 deletions pyoptsparse/pyNSGA2/meson.build
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
swig = find_program('swig', required: false)
swig = find_program('swig', required: true)

if swig.found()
nsga2_source = custom_target('nsga2_wrap.c',
input : ['source/swig/nsga2.i'],
output : ['nsga2_wrap.c'],
command: ['swig', '-o', 'pyoptsparse/pyNSGA2/nsga2_wrap.c', '-python', '-interface', 'nsga2', '@INPUT@']
)
nsga2_source = custom_target('nsga2_wrap.c',
input : ['source/swig/nsga2.i'],
output : ['nsga2_wrap.c'],
command: ['swig', '-o', 'pyoptsparse/pyNSGA2/nsga2_wrap.c', '-python', '-interface', 'nsga2', '@INPUT@']
)

py3_target.extension_module('nsga2',
'source/allocate.c',
'source/auxiliary.c',
'source/crossover.c',
'source/crowddist.c',
'source/decode.c',
'source/dominance.c',
'source/eval.c',
'source/fillnds.c',
'source/initialize.c',
'source/list.c',
'source/merge.c',
'source/mutation.c',
'source/nsga2.c',
'source/rand.c',
'source/rank.c',
'source/report.c',
'source/sort.c',
'source/tourselect.c',
nsga2_source,
include_directories: 'source',
dependencies : py3_dep,
subdir: 'pyoptsparse/pyNSGA2',
link_language: 'c',
install : false)
else
message('SWIG was not found, therefore NSGA2 will not be built.')
endif
py3_target.extension_module('nsga2',
'source/allocate.c',
'source/auxiliary.c',
'source/crossover.c',
'source/crowddist.c',
'source/decode.c',
'source/dominance.c',
'source/eval.c',
'source/fillnds.c',
'source/initialize.c',
'source/list.c',
'source/merge.c',
'source/mutation.c',
'source/nsga2.c',
'source/rand.c',
'source/rank.c',
'source/report.c',
'source/sort.c',
'source/tourselect.c',
nsga2_source,
include_directories: 'source',
dependencies : py3_dep,
subdir: 'pyoptsparse/pyNSGA2',
link_language: 'c',
install : false)

#python_sources = [
# '__init__.py',
Expand Down
2 changes: 1 addition & 1 deletion pyoptsparse/pyNSGA2/pyNSGA2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# import the compiled module
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
nsga2 = try_import_compiled_module_from_path("nsga2", THIS_DIR)
nsga2 = try_import_compiled_module_from_path("nsga2", THIS_DIR, raise_warning=True)


class NSGA2(Optimizer):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=42", "meson>=0.60.0", "ninja", "numpy>=2.0"]
requires = ["setuptools>=42", "meson>=0.60.0", "ninja", "numpy>=2.0", "swig"]
build-backend = "setuptools.build_meta"
9 changes: 1 addition & 8 deletions tests/test_nsga2_multi_objective.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Test NSGA2."""
"""Test NSGA2."""

# Standard Python modules
import unittest
Expand All @@ -19,13 +19,6 @@ class TestNSGA2(OptTest):
optName = "NSGA2"
histFileName = None

def setUp(self):
try:
# First party modules
from pyoptsparse.pyNSGA2 import nsga2 # noqa: F401
except ImportError:
raise unittest.SkipTest("Optimizer not available: NSGA2")

def objfunc(self, xdict):
x = xdict["x"]
y = xdict["y"]
Expand Down
2 changes: 1 addition & 1 deletion tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_dict_distance(d, d2):
}

# these are optimizers which are installed by default
DEFAULT_OPTIMIZERS = {"SLSQP", "PSQP", "CONMIN", "ALPSO"}
DEFAULT_OPTIMIZERS = {"SLSQP", "PSQP", "CONMIN", "ALPSO", "NSGA2"}

# Define gradient-based optimizers
GRAD_BASED_OPTIMIZERS = {"CONMIN", "IPOPT", "NLPQLP", "ParOpt", "PSQP", "SLSQP", "SNOPT"}
Expand Down