iwopy 0.1.8__py3-none-any.whl → 0.2__py3-none-any.whl

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 (43) hide show
  1. iwopy/VERSION +1 -1
  2. iwopy/__init__.py +12 -2
  3. iwopy/benchmarks/branin/__init__.py +1 -0
  4. iwopy/benchmarks/{branin.py → branin/branin.py} +29 -19
  5. iwopy/benchmarks/rosenbrock/__init__.py +1 -0
  6. iwopy/benchmarks/{rosenbrock.py → rosenbrock/rosenbrock.py} +35 -27
  7. iwopy/core/base.py +14 -8
  8. iwopy/core/constraint.py +20 -14
  9. iwopy/core/function.py +66 -60
  10. iwopy/core/function_list.py +51 -45
  11. iwopy/core/function_subset.py +33 -28
  12. iwopy/core/memory.py +43 -35
  13. iwopy/core/objective.py +4 -1
  14. iwopy/core/opt_results.py +79 -68
  15. iwopy/core/optimizer.py +15 -9
  16. iwopy/core/problem.py +116 -104
  17. iwopy/interfaces/pygmo/__init__.py +3 -0
  18. iwopy/interfaces/pygmo/algos.py +5 -2
  19. iwopy/interfaces/pygmo/imports.py +11 -0
  20. iwopy/interfaces/pygmo/optimizer.py +24 -18
  21. iwopy/interfaces/pygmo/problem.py +24 -19
  22. iwopy/interfaces/pymoo/__init__.py +4 -1
  23. iwopy/interfaces/pymoo/factory.py +6 -0
  24. iwopy/interfaces/pymoo/imports.py +11 -0
  25. iwopy/interfaces/pymoo/optimizer.py +75 -48
  26. iwopy/interfaces/pymoo/problem.py +330 -314
  27. iwopy/interfaces/scipy/optimizer.py +26 -20
  28. iwopy/optimizers/gg.py +41 -35
  29. iwopy/utils/discretization.py +107 -101
  30. iwopy/utils/stdout.py +2 -0
  31. iwopy/wrappers/discretize_reg_grid.py +65 -59
  32. iwopy/wrappers/local_fd.py +40 -34
  33. iwopy/wrappers/problem_wrapper.py +43 -37
  34. iwopy/wrappers/simple_constraint.py +47 -41
  35. iwopy/wrappers/simple_objective.py +42 -36
  36. iwopy/wrappers/simple_problem.py +40 -34
  37. {iwopy-0.1.8.dist-info → iwopy-0.2.dist-info}/METADATA +27 -4
  38. iwopy-0.2.dist-info/RECORD +50 -0
  39. iwopy-0.1.8.dist-info/RECORD +0 -48
  40. {iwopy-0.1.8.dist-info → iwopy-0.2.dist-info}/LICENSE +0 -0
  41. {iwopy-0.1.8.dist-info → iwopy-0.2.dist-info}/WHEEL +0 -0
  42. {iwopy-0.1.8.dist-info → iwopy-0.2.dist-info}/top_level.txt +0 -0
  43. {iwopy-0.1.8.dist-info → iwopy-0.2.dist-info}/zip-safe +0 -0
@@ -11,42 +11,19 @@ class DiscretizeRegGrid(LocalFD):
11
11
  differentiation on a regular grid for
12
12
  selected or all problem float variables.
13
13
 
14
- Parameters
15
- ----------
16
- base_problem : iwopy.Problem
17
- The underlying concrete problem
18
- deltas : dict
19
- The step sizes. Key: variable name str,
20
- Value: step size. Will be adjusted to the
21
- variable bounds if necessary.
22
- fd_order : dict or int
23
- Finite difference order. Either a dict with
24
- key: variable name str, value: order int, or
25
- a global integer order for all variables.
26
- 1 = forward, -1 = backward, 2 = centre
27
- fd_bounds_order : dict or int
28
- Finite difference order of boundary points.
29
- Either a dict with key: variable name str,
30
- value: order int, or a global integer order
31
- for all variables. Default is same as fd_order
32
- mem_size : int, optional
33
- The memory size, default no memory
34
- name : str, optional
35
- The problem name
36
- dpars : dict, optional
37
- Additional parameters for `RegularDiscretizationGrid`
38
-
39
14
  Attributes
40
15
  ----------
41
- grid : iwopy.tools.RegularDiscretizationGrid
16
+ grid: iwopy.tools.RegularDiscretizationGrid
42
17
  The discretization grid
43
- order : dict
18
+ order: dict
44
19
  Finite difference order. Key: variable name
45
20
  str, value: 1 = forward, -1 = backward, 2 = centre
46
- orderb : dict or int
21
+ orderb: dict or int
47
22
  Finite difference order of boundary points.
48
23
  Key: variable name str, value: order int
49
24
 
25
+ :group: wrappers
26
+
50
27
  """
51
28
 
52
29
  def __init__(
@@ -59,6 +36,35 @@ class DiscretizeRegGrid(LocalFD):
59
36
  name=None,
60
37
  **dpars,
61
38
  ):
39
+ """
40
+ Constructor
41
+
42
+ Parameters
43
+ ----------
44
+ base_problem: iwopy.Problem
45
+ The underlying concrete problem
46
+ deltas: dict
47
+ The step sizes. Key: variable name str,
48
+ Value: step size. Will be adjusted to the
49
+ variable bounds if necessary.
50
+ fd_order: dict or int
51
+ Finite difference order. Either a dict with
52
+ key: variable name str, value: order int, or
53
+ a global integer order for all variables.
54
+ 1 = forward, -1 = backward, 2 = centre
55
+ fd_bounds_order: dict or int
56
+ Finite difference order of boundary points.
57
+ Either a dict with key: variable name str,
58
+ value: order int, or a global integer order
59
+ for all variables. Default is same as fd_order
60
+ mem_size: int, optional
61
+ The memory size, default no memory
62
+ name: str, optional
63
+ The problem name
64
+ dpars: dict, optional
65
+ Additional parameters for `RegularDiscretizationGrid`
66
+
67
+ """
62
68
  name = base_problem.name + "_grid" if name is None else name
63
69
  super().__init__(base_problem, deltas, fd_order, fd_bounds_order, name)
64
70
 
@@ -72,7 +78,7 @@ class DiscretizeRegGrid(LocalFD):
72
78
 
73
79
  Parameters
74
80
  ----------
75
- verbosity : int
81
+ verbosity: int
76
82
  The verbosity level, 0 = silent
77
83
 
78
84
  """
@@ -141,14 +147,14 @@ class DiscretizeRegGrid(LocalFD):
141
147
 
142
148
  Parameters
143
149
  ----------
144
- vars_int : np.array
150
+ vars_int: np.array
145
151
  The integer variable values, shape: (n_vars_int,)
146
- vars_float : np.array
152
+ vars_float: np.array
147
153
  The float variable values, shape: (n_vars_float,)
148
154
 
149
155
  Returns
150
156
  -------
151
- problem_results : Any
157
+ problem_results: Any
152
158
  The results of the variable application
153
159
  to the problem
154
160
 
@@ -167,14 +173,14 @@ class DiscretizeRegGrid(LocalFD):
167
173
 
168
174
  Parameters
169
175
  ----------
170
- vars_int : np.array
176
+ vars_int: np.array
171
177
  The integer variable values, shape: (n_pop, n_vars_int)
172
- vars_float : np.array
178
+ vars_float: np.array
173
179
  The float variable values, shape: (n_pop, n_vars_float)
174
180
 
175
181
  Returns
176
182
  -------
177
- problem_results : Any
183
+ problem_results: Any
178
184
  The results of the variable application
179
185
  to the problem
180
186
 
@@ -192,20 +198,20 @@ class DiscretizeRegGrid(LocalFD):
192
198
 
193
199
  Parameters
194
200
  ----------
195
- vars_int : np.array
201
+ vars_int: np.array
196
202
  The integer variable values, shape: (n_vars_int,)
197
- vars_float : np.array
203
+ vars_float: np.array
198
204
  The float variable values, shape: (n_vars_float,)
199
- ret_prob_res : bool
205
+ ret_prob_res: bool
200
206
  Flag for additionally returning of problem results
201
207
 
202
208
  Returns
203
209
  -------
204
- objs : np.array
210
+ objs: np.array
205
211
  The objective function values, shape: (n_objectives,)
206
- con : np.array
212
+ con: np.array
207
213
  The constraints values, shape: (n_constraints,)
208
- prob_res : object, optional
214
+ prob_res: object, optional
209
215
  The problem results
210
216
 
211
217
  """
@@ -251,20 +257,20 @@ class DiscretizeRegGrid(LocalFD):
251
257
 
252
258
  Parameters
253
259
  ----------
254
- vars_int : np.array
260
+ vars_int: np.array
255
261
  The integer variable values, shape: (n_pop, n_vars_int)
256
- vars_float : np.array
262
+ vars_float: np.array
257
263
  The float variable values, shape: (n_pop, n_vars_float)
258
- ret_prob_res : bool
264
+ ret_prob_res: bool
259
265
  Flag for additionally returning of problem results
260
266
 
261
267
  Returns
262
268
  -------
263
- objs : np.array
269
+ objs: np.array
264
270
  The objective function values, shape: (n_pop, n_objectives)
265
- cons : np.array
271
+ cons: np.array
266
272
  The constraints values, shape: (n_pop, n_constraints)
267
- prob_res : object, optional
273
+ prob_res: object, optional
268
274
  The problem results
269
275
 
270
276
  """
@@ -367,21 +373,21 @@ class DiscretizeRegGrid(LocalFD):
367
373
 
368
374
  Parameters
369
375
  ----------
370
- vars_int : np.array
376
+ vars_int: np.array
371
377
  The optimal integer variable values, shape: (n_vars_int,)
372
- vars_float : np.array
378
+ vars_float: np.array
373
379
  The optimal float variable values, shape: (n_vars_float,)
374
- verbosity : int
380
+ verbosity: int
375
381
  The verbosity level, 0 = silent
376
382
 
377
383
  Returns
378
384
  -------
379
- problem_results : Any
385
+ problem_results: Any
380
386
  The results of the variable application
381
387
  to the problem
382
- objs : np.array
388
+ objs: np.array
383
389
  The objective function values, shape: (n_objectives,)
384
- cons : np.array
390
+ cons: np.array
385
391
  The constraints values, shape: (n_constraints,)
386
392
 
387
393
  """
@@ -395,23 +401,23 @@ class DiscretizeRegGrid(LocalFD):
395
401
 
396
402
  Parameters
397
403
  ----------
398
- vars_int : np.array
404
+ vars_int: np.array
399
405
  The integer variable values of the final
400
406
  generation, shape: (n_pop, n_vars_int)
401
- vars_float : np.array
407
+ vars_float: np.array
402
408
  The float variable values of the final
403
409
  generation, shape: (n_pop, n_vars_float)
404
- verbosity : int
410
+ verbosity: int
405
411
  The verbosity level, 0 = silent
406
412
 
407
413
  Returns
408
414
  -------
409
- problem_results : Any
415
+ problem_results: Any
410
416
  The results of the variable application
411
417
  to the problem
412
- objs : np.array
418
+ objs: np.array
413
419
  The final objective function values, shape: (n_pop, n_components)
414
- cons : np.array
420
+ cons: np.array
415
421
  The final constraint values, shape: (n_pop, n_constraints)
416
422
 
417
423
  """
@@ -9,36 +9,17 @@ class LocalFD(ProblemWrapper):
9
9
  A wrapper that provides finite distance
10
10
  differentiation by local stepwise evaluation.
11
11
 
12
- Parameters
13
- ----------
14
- base_problem : iwopy.Problem
15
- The underlying concrete problem
16
- deltas : dict
17
- The step sizes. Key: variable name str,
18
- Value: step size. Will be adjusted to the
19
- variable bounds if necessary.
20
- fd_order : dict or int
21
- Finite difference order. Either a dict with
22
- key: variable name str, value: order int, or
23
- a global integer order for all variables.
24
- 1 = forward, -1 = backward, 2 = centre
25
- fd_bounds_order : dict or int
26
- Finite difference order of boundary points.
27
- Either a dict with key: variable name str,
28
- value: order int, or a global integer order
29
- for all variables. Default is same as fd_order
30
- name : str, optional
31
- The problem name
32
-
33
12
  Attributes
34
13
  ----------
35
- order : dict
14
+ order: dict
36
15
  Finite difference order. Key: variable name
37
16
  str, value: 1 = forward, -1 = backward, 2 = centre
38
- orderb : dict or int
17
+ orderb: dict or int
39
18
  Finite difference order of boundary points.
40
19
  Key: variable name str, value: order int
41
20
 
21
+ :group: wrappers
22
+
42
23
  """
43
24
 
44
25
  def __init__(
@@ -49,6 +30,31 @@ class LocalFD(ProblemWrapper):
49
30
  fd_bounds_order=None,
50
31
  name=None,
51
32
  ):
33
+ """
34
+ Constructor
35
+
36
+ Parameters
37
+ ----------
38
+ base_problem: iwopy.Problem
39
+ The underlying concrete problem
40
+ deltas: dict
41
+ The step sizes. Key: variable name str,
42
+ Value: step size. Will be adjusted to the
43
+ variable bounds if necessary.
44
+ fd_order: dict or int
45
+ Finite difference order. Either a dict with
46
+ key: variable name str, value: order int, or
47
+ a global integer order for all variables.
48
+ 1 = forward, -1 = backward, 2 = centre
49
+ fd_bounds_order: dict or int
50
+ Finite difference order of boundary points.
51
+ Either a dict with key: variable name str,
52
+ value: order int, or a global integer order
53
+ for all variables. Default is same as fd_order
54
+ name: str, optional
55
+ The problem name
56
+
57
+ """
52
58
  name = base_problem.name + "_fd" if name is None else name
53
59
  super().__init__(base_problem, name)
54
60
 
@@ -84,7 +90,7 @@ class LocalFD(ProblemWrapper):
84
90
 
85
91
  Parameters
86
92
  ----------
87
- verbosity : int
93
+ verbosity: int
88
94
  The verbosity level, 0 = silent
89
95
 
90
96
  """
@@ -244,31 +250,31 @@ class LocalFD(ProblemWrapper):
244
250
 
245
251
  Parameters
246
252
  ----------
247
- vars_int : np.array
253
+ vars_int: np.array
248
254
  The integer variable values, shape: (n_vars_int,)
249
- vars_float : np.array
255
+ vars_float: np.array
250
256
  The float variable values, shape: (n_vars_float,)
251
- func : iwopy.core.OptFunctionList, optional
257
+ func: iwopy.core.OptFunctionList, optional
252
258
  The functions to be differentiated, or None
253
259
  for a list of all objectives and all constraints
254
260
  (in that order)
255
- components : list of int, optional
261
+ components: list of int, optional
256
262
  The function's component selection, or None for all
257
- ivars : list of int
263
+ ivars: list of int
258
264
  The indices of the function int variables in the problem
259
- fvars : list of int
265
+ fvars: list of int
260
266
  The indices of the function float variables in the problem
261
- vrs : list of int
267
+ vrs: list of int
262
268
  The function float variable indices wrt which the
263
269
  derivatives are to be calculated
264
- pop : bool
270
+ pop: bool
265
271
  Flag for vectorizing calculations via population
266
- verbosity : int
272
+ verbosity: int
267
273
  The verbosity level, 0 = silent
268
274
 
269
275
  Returns
270
276
  -------
271
- gradients : numpy.ndarray
277
+ gradients: numpy.ndarray
272
278
  The gradients of the functions, shape:
273
279
  (n_components, n_vrs)
274
280
 
@@ -5,23 +5,29 @@ class ProblemWrapper(Problem):
5
5
  """
6
6
  Generic abstract problem wrapper class.
7
7
 
8
- Parameters
9
- ----------
10
- base_problem : iwopy.Problem
11
- The underlying concrete problem
12
- name : str
13
- The problem name
14
- kwargs : dict, optional
15
- Additional parameters for the Problem class
16
-
17
8
  Attributes
18
9
  ----------
19
- base_problem : iwopy.Problem
10
+ base_problem: iwopy.Problem
20
11
  The underlying concrete problem
21
12
 
13
+ :group: wrappers
14
+
22
15
  """
23
16
 
24
17
  def __init__(self, base_problem, name, **kwargs):
18
+ """
19
+ Constructor
20
+
21
+ Parameters
22
+ ----------
23
+ base_problem: iwopy.Problem
24
+ The underlying concrete problem
25
+ name: str
26
+ The problem name
27
+ kwargs: dict, optional
28
+ Additional parameters for the Problem class
29
+
30
+ """
25
31
  super().__init__(name, **kwargs)
26
32
  self.base_problem = base_problem
27
33
 
@@ -34,7 +40,7 @@ class ProblemWrapper(Problem):
34
40
 
35
41
  Returns
36
42
  -------
37
- names : list of str
43
+ names: list of str
38
44
  The names of the integer variables
39
45
 
40
46
  """
@@ -46,7 +52,7 @@ class ProblemWrapper(Problem):
46
52
 
47
53
  Returns
48
54
  -------
49
- values : numpy.ndarray
55
+ values: numpy.ndarray
50
56
  Initial int values, shape: (n_vars_int,)
51
57
 
52
58
  """
@@ -60,7 +66,7 @@ class ProblemWrapper(Problem):
60
66
 
61
67
  Returns
62
68
  -------
63
- values : numpy.ndarray
69
+ values: numpy.ndarray
64
70
  Minimal int values, shape: (n_vars_int,)
65
71
 
66
72
  """
@@ -74,7 +80,7 @@ class ProblemWrapper(Problem):
74
80
 
75
81
  Returns
76
82
  -------
77
- values : numpy.ndarray
83
+ values: numpy.ndarray
78
84
  Maximal int values, shape: (n_vars_int,)
79
85
 
80
86
  """
@@ -86,7 +92,7 @@ class ProblemWrapper(Problem):
86
92
 
87
93
  Returns
88
94
  -------
89
- names : list of str
95
+ names: list of str
90
96
  The names of the float variables
91
97
 
92
98
  """
@@ -98,7 +104,7 @@ class ProblemWrapper(Problem):
98
104
 
99
105
  Returns
100
106
  -------
101
- values : numpy.ndarray
107
+ values: numpy.ndarray
102
108
  Initial float values, shape: (n_vars_float,)
103
109
 
104
110
  """
@@ -112,7 +118,7 @@ class ProblemWrapper(Problem):
112
118
 
113
119
  Returns
114
120
  -------
115
- values : numpy.ndarray
121
+ values: numpy.ndarray
116
122
  Minimal float values, shape: (n_vars_float,)
117
123
 
118
124
  """
@@ -126,7 +132,7 @@ class ProblemWrapper(Problem):
126
132
 
127
133
  Returns
128
134
  -------
129
- values : numpy.ndarray
135
+ values: numpy.ndarray
130
136
  Maximal float values, shape: (n_vars_float,)
131
137
 
132
138
  """
@@ -138,7 +144,7 @@ class ProblemWrapper(Problem):
138
144
 
139
145
  Parameters
140
146
  ----------
141
- verbosity : int
147
+ verbosity: int
142
148
  The verbosity level, 0 = silent
143
149
 
144
150
  """
@@ -164,14 +170,14 @@ class ProblemWrapper(Problem):
164
170
 
165
171
  Parameters
166
172
  ----------
167
- vars_int : np.array
173
+ vars_int: np.array
168
174
  The integer variable values, shape: (n_vars_int,)
169
- vars_float : np.array
175
+ vars_float: np.array
170
176
  The float variable values, shape: (n_vars_float,)
171
177
 
172
178
  Returns
173
179
  -------
174
- problem_results : Any
180
+ problem_results: Any
175
181
  The results of the variable application
176
182
  to the problem
177
183
 
@@ -185,14 +191,14 @@ class ProblemWrapper(Problem):
185
191
 
186
192
  Parameters
187
193
  ----------
188
- vars_int : np.array
194
+ vars_int: np.array
189
195
  The integer variable values, shape: (n_pop, n_vars_int)
190
- vars_float : np.array
196
+ vars_float: np.array
191
197
  The float variable values, shape: (n_pop, n_vars_float)
192
198
 
193
199
  Returns
194
200
  -------
195
- problem_results : Any
201
+ problem_results: Any
196
202
  The results of the variable application
197
203
  to the problem
198
204
 
@@ -205,21 +211,21 @@ class ProblemWrapper(Problem):
205
211
 
206
212
  Parameters
207
213
  ----------
208
- vars_int : np.array
214
+ vars_int: np.array
209
215
  The optimal integer variable values, shape: (n_vars_int,)
210
- vars_float : np.array
216
+ vars_float: np.array
211
217
  The optimal float variable values, shape: (n_vars_float,)
212
- verbosity : int
218
+ verbosity: int
213
219
  The verbosity level, 0 = silent
214
220
 
215
221
  Returns
216
222
  -------
217
- problem_results : Any
223
+ problem_results: Any
218
224
  The results of the variable application
219
225
  to the problem
220
- objs : np.array
226
+ objs: np.array
221
227
  The objective function values, shape: (n_objectives,)
222
- cons : np.array
228
+ cons: np.array
223
229
  The constraints values, shape: (n_constraints,)
224
230
 
225
231
  """
@@ -231,23 +237,23 @@ class ProblemWrapper(Problem):
231
237
 
232
238
  Parameters
233
239
  ----------
234
- vars_int : np.array
240
+ vars_int: np.array
235
241
  The integer variable values of the final
236
242
  generation, shape: (n_pop, n_vars_int)
237
- vars_float : np.array
243
+ vars_float: np.array
238
244
  The float variable values of the final
239
245
  generation, shape: (n_pop, n_vars_float)
240
- verbosity : int
246
+ verbosity: int
241
247
  The verbosity level, 0 = silent
242
248
 
243
249
  Returns
244
250
  -------
245
- problem_results : Any
251
+ problem_results: Any
246
252
  The results of the variable application
247
253
  to the problem
248
- objs : np.array
254
+ objs: np.array
249
255
  The final objective function values, shape: (n_pop, n_components)
250
- cons : np.array
256
+ cons: np.array
251
257
  The final constraint values, shape: (n_pop, n_constraints)
252
258
 
253
259
  """