iwopy 0.1.8__tar.gz → 0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of iwopy might be problematic. Click here for more details.

Files changed (62) hide show
  1. {iwopy-0.1.8/iwopy.egg-info → iwopy-0.2}/PKG-INFO +27 -4
  2. {iwopy-0.1.8 → iwopy-0.2}/README.md +15 -0
  3. iwopy-0.2/iwopy/VERSION +1 -0
  4. {iwopy-0.1.8 → iwopy-0.2}/iwopy/__init__.py +12 -2
  5. iwopy-0.2/iwopy/benchmarks/branin/__init__.py +1 -0
  6. {iwopy-0.1.8/iwopy/benchmarks → iwopy-0.2/iwopy/benchmarks/branin}/branin.py +29 -19
  7. iwopy-0.2/iwopy/benchmarks/rosenbrock/__init__.py +1 -0
  8. {iwopy-0.1.8/iwopy/benchmarks → iwopy-0.2/iwopy/benchmarks/rosenbrock}/rosenbrock.py +35 -27
  9. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/base.py +14 -8
  10. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/constraint.py +20 -14
  11. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/function.py +66 -60
  12. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/function_list.py +51 -45
  13. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/function_subset.py +33 -28
  14. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/memory.py +43 -35
  15. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/objective.py +4 -1
  16. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/opt_results.py +79 -68
  17. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/optimizer.py +15 -9
  18. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/problem.py +116 -104
  19. iwopy-0.2/iwopy/interfaces/pygmo/__init__.py +4 -0
  20. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pygmo/algos.py +5 -2
  21. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pygmo/imports.py +11 -0
  22. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pygmo/optimizer.py +24 -18
  23. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pygmo/problem.py +24 -19
  24. iwopy-0.2/iwopy/interfaces/pymoo/__init__.py +4 -0
  25. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pymoo/factory.py +6 -0
  26. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pymoo/imports.py +11 -0
  27. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/pymoo/optimizer.py +75 -48
  28. iwopy-0.2/iwopy/interfaces/pymoo/problem.py +403 -0
  29. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/scipy/optimizer.py +26 -20
  30. {iwopy-0.1.8 → iwopy-0.2}/iwopy/optimizers/gg.py +41 -35
  31. {iwopy-0.1.8 → iwopy-0.2}/iwopy/utils/discretization.py +107 -101
  32. {iwopy-0.1.8 → iwopy-0.2}/iwopy/utils/stdout.py +2 -0
  33. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/discretize_reg_grid.py +65 -59
  34. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/local_fd.py +40 -34
  35. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/problem_wrapper.py +43 -37
  36. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/simple_constraint.py +47 -41
  37. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/simple_objective.py +42 -36
  38. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/simple_problem.py +40 -34
  39. {iwopy-0.1.8 → iwopy-0.2/iwopy.egg-info}/PKG-INFO +27 -4
  40. {iwopy-0.1.8 → iwopy-0.2}/iwopy.egg-info/SOURCES.txt +4 -2
  41. {iwopy-0.1.8 → iwopy-0.2}/iwopy.egg-info/requires.txt +11 -3
  42. {iwopy-0.1.8 → iwopy-0.2}/setup.cfg +11 -3
  43. iwopy-0.1.8/iwopy/VERSION +0 -1
  44. iwopy-0.1.8/iwopy/interfaces/pygmo/__init__.py +0 -1
  45. iwopy-0.1.8/iwopy/interfaces/pymoo/__init__.py +0 -1
  46. iwopy-0.1.8/iwopy/interfaces/pymoo/problem.py +0 -387
  47. {iwopy-0.1.8 → iwopy-0.2}/LICENSE +0 -0
  48. {iwopy-0.1.8 → iwopy-0.2}/Logo_IWOPY_white.svg +0 -0
  49. {iwopy-0.1.8 → iwopy-0.2}/MANIFEST.in +0 -0
  50. {iwopy-0.1.8 → iwopy-0.2}/iwopy/benchmarks/__init__.py +0 -0
  51. {iwopy-0.1.8 → iwopy-0.2}/iwopy/core/__init__.py +0 -0
  52. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/__init__.py +0 -0
  53. {iwopy-0.1.8 → iwopy-0.2}/iwopy/interfaces/scipy/__init__.py +0 -0
  54. {iwopy-0.1.8 → iwopy-0.2}/iwopy/optimizers/__init__.py +0 -0
  55. {iwopy-0.1.8 → iwopy-0.2}/iwopy/utils/__init__.py +0 -0
  56. {iwopy-0.1.8 → iwopy-0.2}/iwopy/utils/load.py +0 -0
  57. {iwopy-0.1.8 → iwopy-0.2}/iwopy/wrappers/__init__.py +0 -0
  58. {iwopy-0.1.8 → iwopy-0.2}/iwopy.egg-info/dependency_links.txt +0 -0
  59. {iwopy-0.1.8 → iwopy-0.2}/iwopy.egg-info/top_level.txt +0 -0
  60. {iwopy-0.1.8 → iwopy-0.2}/iwopy.egg-info/zip-safe +0 -0
  61. {iwopy-0.1.8 → iwopy-0.2}/pyproject.toml +0 -0
  62. {iwopy-0.1.8 → iwopy-0.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iwopy
3
- Version: 0.1.8
3
+ Version: 0.2
4
4
  Summary: Fraunhofer IWES optimization tools in Python
5
5
  Home-page: https://github.com/FraunhoferIWES/iwopy
6
6
  Author: Fraunhofer IWES
@@ -23,18 +23,26 @@ Requires-Dist: matplotlib
23
23
  Provides-Extra: test
24
24
  Requires-Dist: flake8; extra == "test"
25
25
  Requires-Dist: pytest; extra == "test"
26
- Requires-Dist: pymoo>=0.6; extra == "test"
27
26
  Requires-Dist: pygmo; extra == "test"
27
+ Requires-Dist: pymoo>=0.6; extra == "test"
28
28
  Provides-Extra: doc
29
29
  Requires-Dist: sphinx; extra == "doc"
30
- Requires-Dist: sphinx_rtd_theme; extra == "doc"
31
- Requires-Dist: sphinxcontrib-email; extra == "doc"
30
+ Requires-Dist: sphinx-immaterial; extra == "doc"
32
31
  Requires-Dist: nbsphinx; extra == "doc"
33
32
  Requires-Dist: ipykernel; extra == "doc"
33
+ Requires-Dist: ipywidgets; extra == "doc"
34
34
  Requires-Dist: m2r2; extra == "doc"
35
35
  Provides-Extra: all
36
+ Requires-Dist: flake8; extra == "all"
37
+ Requires-Dist: pytest; extra == "all"
36
38
  Requires-Dist: pygmo; extra == "all"
37
39
  Requires-Dist: pymoo>=0.6; extra == "all"
40
+ Requires-Dist: sphinx; extra == "all"
41
+ Requires-Dist: sphinx-immaterial; extra == "all"
42
+ Requires-Dist: nbsphinx; extra == "all"
43
+ Requires-Dist: ipykernel; extra == "all"
44
+ Requires-Dist: ipywidgets; extra == "all"
45
+ Requires-Dist: m2r2; extra == "all"
38
46
  Provides-Extra: scripts
39
47
 
40
48
  # iwopy
@@ -49,6 +57,7 @@ The `iwopy` package is in fact a meta package that provides interfaces to other
49
57
 
50
58
  - [pymoo](https://pymoo.org/index.html)
51
59
  - [pygmo](https://esa.github.io/pygmo2/index.html)
60
+ - [scipy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html)
52
61
  - (more to come with future versions)
53
62
 
54
63
  `iwopy` can thus be understood as an attempt to provide *the best of all worlds* when it comes to solving optimization problems with Python. This has not yet been achieved, since above list of accessable optimization packages is obviously incomplete, but it's a start. All the credit for implementing the invoked optimizers goes to the original package providers.
@@ -141,6 +150,20 @@ Then you can either install from this directory via
141
150
  pip install -e .
142
151
  ```
143
152
 
153
+ ## Testing
154
+
155
+ For testing, please clone the repository and install the required dependencies:
156
+ ```console
157
+ git clone https://github.com/FraunhoferIWES/iwopy.git
158
+ cd iwopy
159
+ pip install -e .[test]
160
+ ```
161
+
162
+ The tests are then run by
163
+ ```console
164
+ pytest tests
165
+ ```
166
+
144
167
  ## Contributing
145
168
 
146
169
  1. Fork _iwopy_ on _github_.
@@ -10,6 +10,7 @@ The `iwopy` package is in fact a meta package that provides interfaces to other
10
10
 
11
11
  - [pymoo](https://pymoo.org/index.html)
12
12
  - [pygmo](https://esa.github.io/pygmo2/index.html)
13
+ - [scipy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html)
13
14
  - (more to come with future versions)
14
15
 
15
16
  `iwopy` can thus be understood as an attempt to provide *the best of all worlds* when it comes to solving optimization problems with Python. This has not yet been achieved, since above list of accessable optimization packages is obviously incomplete, but it's a start. All the credit for implementing the invoked optimizers goes to the original package providers.
@@ -102,6 +103,20 @@ Then you can either install from this directory via
102
103
  pip install -e .
103
104
  ```
104
105
 
106
+ ## Testing
107
+
108
+ For testing, please clone the repository and install the required dependencies:
109
+ ```console
110
+ git clone https://github.com/FraunhoferIWES/iwopy.git
111
+ cd iwopy
112
+ pip install -e .[test]
113
+ ```
114
+
115
+ The tests are then run by
116
+ ```console
117
+ pytest tests
118
+ ```
119
+
105
120
  ## Contributing
106
121
 
107
122
  1. Fork _iwopy_ on _github_.
@@ -0,0 +1 @@
1
+ 0.2
@@ -1,3 +1,8 @@
1
+ """
2
+ Fraunhofer IWES optimization tools in Python
3
+
4
+ """
5
+
1
6
  from .core import Problem, Objective, Constraint, Memory
2
7
  from .wrappers import (
3
8
  ProblemWrapper,
@@ -13,6 +18,11 @@ from . import interfaces
13
18
  from . import benchmarks
14
19
  from . import optimizers
15
20
 
16
- from importlib.resources import read_text
21
+ try:
22
+ from importlib.resources import files
23
+
24
+ __version__ = files(__package__).joinpath("VERSION").read_text()
25
+ except ImportError:
26
+ from importlib.resources import read_text
17
27
 
18
- __version__ = read_text(__package__, "VERSION")
28
+ __version__ = read_text(__package__, "VERSION")
@@ -0,0 +1 @@
1
+ from .branin import BraninObjective, BraninProblem
@@ -31,21 +31,26 @@ class BraninObjective(SimpleObjective):
31
31
 
32
32
  f(x,y) = 0.397887
33
33
 
34
- Parameters
35
- ----------
36
- problem: iwopy.Problem
37
- The underlying optimization problem
38
- ana_deriv : bool
39
- Switch for analytical derivatives
40
- name: str
41
- The function name
34
+ :group: benchmarks.branin
42
35
 
43
36
  """
44
37
 
45
38
  def __init__(self, problem, ana_deriv=False, name="f"):
39
+ """
40
+ Constructor
41
+
42
+ Parameters
43
+ ----------
44
+ problem: iwopy.Problem
45
+ The underlying optimization problem
46
+ ana_deriv: bool
47
+ Switch for analytical derivatives
48
+ name: str
49
+ The function name
50
+
51
+ """
46
52
  super().__init__(problem, name, n_components=1, has_ana_derivs=ana_deriv)
47
53
 
48
- # Parameters of branin function,
49
54
  # (a, b, c, r, s, t)
50
55
  self._pars = (
51
56
  1,
@@ -82,24 +87,29 @@ class BraninProblem(SimpleProblem):
82
87
  """
83
88
  Problem definition of benchmark function Branin.
84
89
 
85
- Parameters
86
- ----------
87
- name : str
88
- The name of the problem
89
- ana_deriv : bool
90
- Switch for analytical derivatives
91
- initial_values : list of float
92
- The initial values
93
-
94
90
  Attributes
95
91
  ----------
96
- initial_values : list of float
92
+ initial_values: list of float
97
93
  The initial values
98
94
 
95
+ :group: benchmarks.branin
96
+
99
97
  """
100
98
 
101
99
  def __init__(self, name="branin", initial_values=[1.0, 1.0], ana_deriv=False):
100
+ """
101
+ Constructor
102
+
103
+ Parameters
104
+ ----------
105
+ name: str
106
+ The name of the problem
107
+ ana_deriv: bool
108
+ Switch for analytical derivatives
109
+ initial_values: list of float
110
+ The initial values
102
111
 
112
+ """
103
113
  super().__init__(
104
114
  name,
105
115
  float_vars={"x": initial_values[0], "y": initial_values[1]},
@@ -0,0 +1 @@
1
+ from .rosenbrock import RosenbrockObjective, RosenbrockProblem
@@ -1,5 +1,3 @@
1
- import numpy as np
2
-
3
1
  from iwopy import SimpleProblem, SimpleObjective
4
2
 
5
3
 
@@ -25,16 +23,7 @@ class RosenbrockObjective(SimpleObjective):
25
23
 
26
24
  f(x,y) = 0
27
25
 
28
- Parameters
29
- ----------
30
- problem : iwopy.Problem
31
- The underlying optimization problem
32
- pars : tuple
33
- The a, b parameters
34
- ana_deriv : bool
35
- Switch for analytical derivatives
36
- name : str
37
- The function name
26
+ :group: benchmarks.rosenbrock
38
27
 
39
28
  """
40
29
 
@@ -45,9 +34,23 @@ class RosenbrockObjective(SimpleObjective):
45
34
  ana_deriv=False,
46
35
  name="f",
47
36
  ):
37
+ """
38
+ Construtor
39
+
40
+ Parameters
41
+ ----------
42
+ problem: iwopy.Problem
43
+ The underlying optimization problem
44
+ pars: tuple
45
+ The a, b parameters
46
+ ana_deriv: bool
47
+ Switch for analytical derivatives
48
+ name: str
49
+ The function name
50
+
51
+ """
48
52
  super().__init__(problem, name, n_components=1, has_ana_derivs=ana_deriv)
49
53
 
50
- # Parameters of branin function,
51
54
  # (a, b)
52
55
  self._pars = pars
53
56
 
@@ -73,24 +76,13 @@ class RosenbrockProblem(SimpleProblem):
73
76
  """
74
77
  Problem definition of benchmark function Rosenbrock.
75
78
 
76
- Parameters
77
- ----------
78
- lower : list of float
79
- The minimal variable values
80
- upper : list of float
81
- The maximal variable values
82
- initial : list of float
83
- The initial values
84
- ana_deriv : bool
85
- Switch for analytical derivatives
86
- name : str
87
- The name of the problem
88
-
89
79
  Attributes
90
80
  ----------
91
- initial_values : list of float
81
+ initial_values: list of float
92
82
  The initial values
93
83
 
84
+ :group: benchmarks.rosenbrock
85
+
94
86
  """
95
87
 
96
88
  def __init__(
@@ -101,7 +93,23 @@ class RosenbrockProblem(SimpleProblem):
101
93
  ana_deriv=False,
102
94
  name="rosenbrock",
103
95
  ):
96
+ """
97
+ Constructor
98
+
99
+ Parameters
100
+ ----------
101
+ lower: list of float
102
+ The minimal variable values
103
+ upper: list of float
104
+ The maximal variable values
105
+ initial: list of float
106
+ The initial values
107
+ ana_deriv: bool
108
+ Switch for analytical derivatives
109
+ name: str
110
+ The name of the problem
104
111
 
112
+ """
105
113
  super().__init__(
106
114
  name,
107
115
  float_vars={"x": initial[0], "y": initial[1]},
@@ -2,19 +2,25 @@ class Base:
2
2
  """
3
3
  Generic base for various iwopy objects.
4
4
 
5
- Parameters
6
- ----------
7
- name : str
8
- The name
9
-
10
5
  Attributes
11
6
  ----------
12
- name : str
7
+ name: str
13
8
  The name
14
9
 
10
+ :group: core
11
+
15
12
  """
16
13
 
17
14
  def __init__(self, name):
15
+ """
16
+ Constructor
17
+
18
+ Parameters
19
+ ----------
20
+ name: str
21
+ The name
22
+
23
+ """
18
24
  self.name = name
19
25
  self._initialized = False
20
26
  if name is None:
@@ -53,7 +59,7 @@ class Base:
53
59
 
54
60
  Parameters
55
61
  ----------
56
- verbosity : int
62
+ verbosity: int
57
63
  The verbosity level, 0 = silent
58
64
 
59
65
  """
@@ -65,7 +71,7 @@ class Base:
65
71
 
66
72
  Parameters
67
73
  ----------
68
- verbosity : int
74
+ verbosity: int
69
75
  The verbosity level, 0 = silent
70
76
 
71
77
  """
@@ -8,19 +8,25 @@ class Constraint(OptFunction):
8
8
  Abstract base class for optimization
9
9
  constraints.
10
10
 
11
- Parameters
12
- ----------
13
- tol : float
14
- The tolerance for constraint violations
15
-
16
11
  Attributes
17
12
  ----------
18
- tol : float
13
+ tol: float
19
14
  The tolerance for constraint violations
20
15
 
16
+ :group: core
17
+
21
18
  """
22
19
 
23
20
  def __init__(self, *args, tol=1e-5, **kwargs):
21
+ """
22
+ Constructor
23
+
24
+ Parameters
25
+ ----------
26
+ tol: float
27
+ The tolerance for constraint violations
28
+
29
+ """
24
30
  super().__init__(*args, **kwargs)
25
31
  self.tol = tol
26
32
 
@@ -32,9 +38,9 @@ class Constraint(OptFunction):
32
38
 
33
39
  Returns
34
40
  -------
35
- min : np.array
41
+ min: np.array
36
42
  The lower bounds, shape: (n_components,)
37
- max : np.array
43
+ max: np.array
38
44
  The upper bounds, shape: (n_components,)
39
45
 
40
46
  """
@@ -50,13 +56,13 @@ class Constraint(OptFunction):
50
56
 
51
57
  Parameters
52
58
  ----------
53
- constraint_values : np.array
59
+ constraint_values: np.array
54
60
  The constraint values, shape: (n_components,)
55
- verbosity : int
61
+ verbosity: int
56
62
  The verbosity level, 0 = silent
57
63
 
58
64
  Returns
59
- values : np.array
65
+ values: np.array
60
66
  -------
61
67
  The boolean result, shape: (n_components,)
62
68
 
@@ -82,14 +88,14 @@ class Constraint(OptFunction):
82
88
 
83
89
  Parameters
84
90
  ----------
85
- constraint_values : np.array
91
+ constraint_values: np.array
86
92
  The constraint values, shape: (n_pop, n_components,)
87
- verbosity : int
93
+ verbosity: int
88
94
  The verbosity level, 0 = silent
89
95
 
90
96
  Returns
91
97
  -------
92
- values : np.array
98
+ values: np.array
93
99
  The boolean result, shape: (n_pop, n_components)
94
100
 
95
101
  """