iwopy 0.1.9__py3-none-any.whl → 0.2.3__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.
- iwopy/VERSION +1 -1
- iwopy/__init__.py +6 -1
- iwopy/benchmarks/branin/__init__.py +1 -0
- iwopy/benchmarks/{branin.py → branin/branin.py} +29 -19
- iwopy/benchmarks/rosenbrock/__init__.py +1 -0
- iwopy/benchmarks/{rosenbrock.py → rosenbrock/rosenbrock.py} +35 -27
- iwopy/core/base.py +14 -8
- iwopy/core/constraint.py +20 -14
- iwopy/core/function.py +66 -60
- iwopy/core/function_list.py +51 -45
- iwopy/core/function_subset.py +33 -28
- iwopy/core/memory.py +43 -35
- iwopy/core/objective.py +4 -1
- iwopy/core/opt_results.py +79 -68
- iwopy/core/optimizer.py +15 -9
- iwopy/core/problem.py +116 -104
- iwopy/interfaces/pygmo/__init__.py +3 -0
- iwopy/interfaces/pygmo/algos.py +5 -2
- iwopy/interfaces/pygmo/imports.py +11 -0
- iwopy/interfaces/pygmo/optimizer.py +24 -18
- iwopy/interfaces/pygmo/problem.py +24 -19
- iwopy/interfaces/pymoo/__init__.py +4 -1
- iwopy/interfaces/pymoo/factory.py +6 -0
- iwopy/interfaces/pymoo/imports.py +11 -0
- iwopy/interfaces/pymoo/optimizer.py +75 -48
- iwopy/interfaces/pymoo/problem.py +330 -314
- iwopy/interfaces/scipy/optimizer.py +26 -20
- iwopy/optimizers/gg.py +41 -35
- iwopy/utils/discretization.py +106 -100
- iwopy/utils/stdout.py +2 -0
- iwopy/wrappers/discretize_reg_grid.py +65 -59
- iwopy/wrappers/local_fd.py +40 -34
- iwopy/wrappers/problem_wrapper.py +43 -37
- iwopy/wrappers/simple_constraint.py +47 -41
- iwopy/wrappers/simple_objective.py +42 -36
- iwopy/wrappers/simple_problem.py +40 -34
- {iwopy-0.1.9.dist-info → iwopy-0.2.3.dist-info}/METADATA +108 -21
- iwopy-0.2.3.dist-info/RECORD +50 -0
- {iwopy-0.1.9.dist-info → iwopy-0.2.3.dist-info}/WHEEL +1 -1
- iwopy-0.1.9.dist-info/RECORD +0 -48
- {iwopy-0.1.9.dist-info → iwopy-0.2.3.dist-info}/LICENSE +0 -0
- {iwopy-0.1.9.dist-info → iwopy-0.2.3.dist-info}/top_level.txt +0 -0
- {iwopy-0.1.9.dist-info → iwopy-0.2.3.dist-info}/zip-safe +0 -0
iwopy/core/opt_results.py
CHANGED
|
@@ -7,48 +7,33 @@ class SingleObjOptResults:
|
|
|
7
7
|
Container for optimization results for single objective
|
|
8
8
|
problems.
|
|
9
9
|
|
|
10
|
-
Parameters
|
|
11
|
-
----------
|
|
12
|
-
problem : iwopy.core.Problem
|
|
13
|
-
The problem
|
|
14
|
-
success : bool
|
|
15
|
-
Optimization success
|
|
16
|
-
vars_int : np.array
|
|
17
|
-
Optimal variables, shape: (n_vars_int,)
|
|
18
|
-
vars_float : np.array
|
|
19
|
-
Optimal variables, shape: (n_vars_float,)
|
|
20
|
-
objs : float
|
|
21
|
-
Optimal objective function value
|
|
22
|
-
cons : np.array
|
|
23
|
-
Constraint values, shape: (n_constraints,)
|
|
24
|
-
problem_results : Object
|
|
25
|
-
The results of the variable application to the problem
|
|
26
|
-
|
|
27
10
|
Attributes
|
|
28
11
|
----------
|
|
29
|
-
success
|
|
12
|
+
success: bool
|
|
30
13
|
Optimization success
|
|
31
|
-
vars_int
|
|
14
|
+
vars_int: np.array
|
|
32
15
|
Optimal variables, shape: (n_vars_int,)
|
|
33
|
-
vars_float
|
|
16
|
+
vars_float: np.array
|
|
34
17
|
Optimal variables, shape: (n_vars_float,)
|
|
35
|
-
objs
|
|
18
|
+
objs: float
|
|
36
19
|
Optimal objective function value
|
|
37
|
-
cons
|
|
20
|
+
cons: np.array
|
|
38
21
|
Constraint values, shape: (n_constraints,)
|
|
39
|
-
problem_results
|
|
22
|
+
problem_results: Object
|
|
40
23
|
The results of the variable application to the problem
|
|
41
|
-
pname
|
|
24
|
+
pname: str
|
|
42
25
|
The problem's name
|
|
43
|
-
vnames_int
|
|
26
|
+
vnames_int: list of str
|
|
44
27
|
The int variable names
|
|
45
|
-
vnames_float
|
|
28
|
+
vnames_float: list of str
|
|
46
29
|
The float variable names
|
|
47
|
-
onames
|
|
30
|
+
onames: list of str
|
|
48
31
|
The names of objectives
|
|
49
|
-
cnames
|
|
32
|
+
cnames: list of str
|
|
50
33
|
The names of constraints
|
|
51
34
|
|
|
35
|
+
:group: core
|
|
36
|
+
|
|
52
37
|
"""
|
|
53
38
|
|
|
54
39
|
def __init__(
|
|
@@ -61,6 +46,27 @@ class SingleObjOptResults:
|
|
|
61
46
|
cons,
|
|
62
47
|
problem_results,
|
|
63
48
|
):
|
|
49
|
+
"""
|
|
50
|
+
Constructor
|
|
51
|
+
|
|
52
|
+
Parameters
|
|
53
|
+
----------
|
|
54
|
+
problem: iwopy.core.Problem
|
|
55
|
+
The problem
|
|
56
|
+
success: bool
|
|
57
|
+
Optimization success
|
|
58
|
+
vars_int: np.array
|
|
59
|
+
Optimal variables, shape: (n_vars_int,)
|
|
60
|
+
vars_float: np.array
|
|
61
|
+
Optimal variables, shape: (n_vars_float,)
|
|
62
|
+
objs: float
|
|
63
|
+
Optimal objective function value
|
|
64
|
+
cons: np.array
|
|
65
|
+
Constraint values, shape: (n_constraints,)
|
|
66
|
+
problem_results: Object
|
|
67
|
+
The results of the variable application to the problem
|
|
68
|
+
|
|
69
|
+
"""
|
|
64
70
|
|
|
65
71
|
self.success = success
|
|
66
72
|
self.vars_int = vars_int
|
|
@@ -120,48 +126,33 @@ class MultiObjOptResults:
|
|
|
120
126
|
Container for optimization results for multi objective
|
|
121
127
|
problems.
|
|
122
128
|
|
|
123
|
-
Parameters
|
|
124
|
-
----------
|
|
125
|
-
problem : iwopy.core.Problem
|
|
126
|
-
The problem
|
|
127
|
-
success : bool
|
|
128
|
-
Optimization success
|
|
129
|
-
vars_int : np.array
|
|
130
|
-
Pareto-optimal variables, shape: (n_pop, n_vars_int)
|
|
131
|
-
vars_float : np.array
|
|
132
|
-
Pareto-optimal variables, shape: (n_pop, n_vars_float)
|
|
133
|
-
objs : np.array
|
|
134
|
-
Pareto front objective function values, shape: (n_pop, n_objectives)
|
|
135
|
-
cons : np.array
|
|
136
|
-
Parteo front Constraint values, shape: (n_pop, n_constraints)
|
|
137
|
-
problem_results : Object
|
|
138
|
-
The results of the variable application to the problem
|
|
139
|
-
|
|
140
129
|
Attributes
|
|
141
130
|
----------
|
|
142
|
-
success
|
|
131
|
+
success: bool
|
|
143
132
|
Optimization success
|
|
144
|
-
vars_int
|
|
133
|
+
vars_int: np.array
|
|
145
134
|
Pareto-optimal variables, shape: (n_pop, n_vars_int)
|
|
146
|
-
vars_float
|
|
135
|
+
vars_float: np.array
|
|
147
136
|
Pareto-optimal variables, shape: (n_pop, n_vars_float)
|
|
148
|
-
objs
|
|
137
|
+
objs: np.array
|
|
149
138
|
Pareto front objective function values, shape: (n_pop, n_objectives)
|
|
150
|
-
cons
|
|
139
|
+
cons: np.array
|
|
151
140
|
Parteo front Constraint values, shape: (n_pop, n_constraints)
|
|
152
|
-
problem_results
|
|
141
|
+
problem_results: Object
|
|
153
142
|
The results of the variable application to the problem
|
|
154
|
-
pname
|
|
143
|
+
pname: str
|
|
155
144
|
The problem's name
|
|
156
|
-
vnames_int
|
|
145
|
+
vnames_int: list of str
|
|
157
146
|
The int variable names
|
|
158
|
-
vnames_float
|
|
147
|
+
vnames_float: list of str
|
|
159
148
|
The float variable names
|
|
160
|
-
onames
|
|
149
|
+
onames: list of str
|
|
161
150
|
The names of objectives
|
|
162
|
-
cnames
|
|
151
|
+
cnames: list of str
|
|
163
152
|
The names of constraints
|
|
164
153
|
|
|
154
|
+
:group: core
|
|
155
|
+
|
|
165
156
|
"""
|
|
166
157
|
|
|
167
158
|
def __init__(
|
|
@@ -174,7 +165,27 @@ class MultiObjOptResults:
|
|
|
174
165
|
cons,
|
|
175
166
|
problem_results,
|
|
176
167
|
):
|
|
168
|
+
"""
|
|
169
|
+
Constructor
|
|
177
170
|
|
|
171
|
+
Parameters
|
|
172
|
+
----------
|
|
173
|
+
problem: iwopy.core.Problem
|
|
174
|
+
The problem
|
|
175
|
+
success: bool
|
|
176
|
+
Optimization success
|
|
177
|
+
vars_int: np.array
|
|
178
|
+
Pareto-optimal variables, shape: (n_pop, n_vars_int)
|
|
179
|
+
vars_float: np.array
|
|
180
|
+
Pareto-optimal variables, shape: (n_pop, n_vars_float)
|
|
181
|
+
objs: np.array
|
|
182
|
+
Pareto front objective function values, shape: (n_pop, n_objectives)
|
|
183
|
+
cons: np.array
|
|
184
|
+
Parteo front Constraint values, shape: (n_pop, n_constraints)
|
|
185
|
+
problem_results: Object
|
|
186
|
+
The results of the variable application to the problem
|
|
187
|
+
|
|
188
|
+
"""
|
|
178
189
|
self.success = success
|
|
179
190
|
self.vars_int = vars_int
|
|
180
191
|
self.vars_float = vars_float
|
|
@@ -248,26 +259,26 @@ class MultiObjOptResults:
|
|
|
248
259
|
|
|
249
260
|
Parameters
|
|
250
261
|
----------
|
|
251
|
-
obj_0
|
|
262
|
+
obj_0: int
|
|
252
263
|
The objective on the x axis
|
|
253
|
-
obj_1
|
|
264
|
+
obj_1: int
|
|
254
265
|
The objective on the y axis
|
|
255
|
-
ax
|
|
266
|
+
ax: pyplot.Axis, optional
|
|
256
267
|
The axis to plot on
|
|
257
|
-
figsize
|
|
268
|
+
figsize: tuple
|
|
258
269
|
The figure size, if ax is not given
|
|
259
|
-
s
|
|
270
|
+
s: float
|
|
260
271
|
Scatter point size
|
|
261
|
-
color_val
|
|
272
|
+
color_val: str
|
|
262
273
|
Color choice for valid points
|
|
263
|
-
color_ival
|
|
274
|
+
color_ival: str
|
|
264
275
|
Color choice for invalid points
|
|
265
|
-
title
|
|
276
|
+
title: str, optional
|
|
266
277
|
The plot title
|
|
267
278
|
|
|
268
279
|
Returns
|
|
269
280
|
-------
|
|
270
|
-
ax
|
|
281
|
+
ax: pyplot.axis
|
|
271
282
|
The plot axis
|
|
272
283
|
|
|
273
284
|
"""
|
|
@@ -308,15 +319,15 @@ class MultiObjOptResults:
|
|
|
308
319
|
|
|
309
320
|
Paramters
|
|
310
321
|
---------
|
|
311
|
-
obj_weights
|
|
322
|
+
obj_weights: list of float
|
|
312
323
|
The weights of the objectives
|
|
313
|
-
max
|
|
324
|
+
max: bool
|
|
314
325
|
Find the maximal value of the weighted result
|
|
315
326
|
(otherwise find the minimal value)
|
|
316
327
|
|
|
317
328
|
Returns
|
|
318
329
|
-------
|
|
319
|
-
index
|
|
330
|
+
index: int
|
|
320
331
|
The index in the pareto front results
|
|
321
332
|
|
|
322
333
|
"""
|
iwopy/core/optimizer.py
CHANGED
|
@@ -8,13 +8,6 @@ class Optimizer(Base, metaclass=ABCMeta):
|
|
|
8
8
|
"""
|
|
9
9
|
Abstract base class for optimization solvers.
|
|
10
10
|
|
|
11
|
-
Parameters
|
|
12
|
-
----------
|
|
13
|
-
problem: iwopy.Problem
|
|
14
|
-
The problem to optimize
|
|
15
|
-
name: str
|
|
16
|
-
The name
|
|
17
|
-
|
|
18
11
|
Attributes
|
|
19
12
|
----------
|
|
20
13
|
problem: iwopy.Problem
|
|
@@ -22,9 +15,22 @@ class Optimizer(Base, metaclass=ABCMeta):
|
|
|
22
15
|
name: str
|
|
23
16
|
The name
|
|
24
17
|
|
|
18
|
+
:group: core
|
|
19
|
+
|
|
25
20
|
"""
|
|
26
21
|
|
|
27
22
|
def __init__(self, problem, name="optimizer"):
|
|
23
|
+
"""
|
|
24
|
+
Constructor
|
|
25
|
+
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
problem: iwopy.Problem
|
|
29
|
+
The problem to optimize
|
|
30
|
+
name: str
|
|
31
|
+
The name
|
|
32
|
+
|
|
33
|
+
"""
|
|
28
34
|
super().__init__(name)
|
|
29
35
|
self.problem = problem
|
|
30
36
|
self.name = name
|
|
@@ -42,7 +48,7 @@ class Optimizer(Base, metaclass=ABCMeta):
|
|
|
42
48
|
|
|
43
49
|
Parameters
|
|
44
50
|
----------
|
|
45
|
-
verbosity
|
|
51
|
+
verbosity: int
|
|
46
52
|
The verbosity level, 0 = silent
|
|
47
53
|
|
|
48
54
|
Returns
|
|
@@ -77,7 +83,7 @@ class Optimizer(Base, metaclass=ABCMeta):
|
|
|
77
83
|
----------
|
|
78
84
|
opt_results: iwopy.OptResults
|
|
79
85
|
The optimization results object
|
|
80
|
-
verbosity
|
|
86
|
+
verbosity: int
|
|
81
87
|
The verbosity level, 0 = silent
|
|
82
88
|
|
|
83
89
|
"""
|