iwopy 0.1.9__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.
- 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.dist-info}/METADATA +12 -3
- iwopy-0.2.dist-info/RECORD +50 -0
- iwopy-0.1.9.dist-info/RECORD +0 -48
- {iwopy-0.1.9.dist-info → iwopy-0.2.dist-info}/LICENSE +0 -0
- {iwopy-0.1.9.dist-info → iwopy-0.2.dist-info}/WHEEL +0 -0
- {iwopy-0.1.9.dist-info → iwopy-0.2.dist-info}/top_level.txt +0 -0
- {iwopy-0.1.9.dist-info → iwopy-0.2.dist-info}/zip-safe +0 -0
iwopy/core/problem.py
CHANGED
|
@@ -12,30 +12,36 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
12
12
|
"""
|
|
13
13
|
Abstract base class for optimization problems.
|
|
14
14
|
|
|
15
|
-
Parameters
|
|
16
|
-
----------
|
|
17
|
-
name: str
|
|
18
|
-
The problem's name
|
|
19
|
-
mem_size : int, optional
|
|
20
|
-
The memory size, default no memory
|
|
21
|
-
mem_keyf : Function, optional
|
|
22
|
-
The memory key function. Parameters:
|
|
23
|
-
(vars_int, vars_float), returns key Object
|
|
24
|
-
|
|
25
15
|
Attributes
|
|
26
16
|
----------
|
|
27
|
-
objs
|
|
17
|
+
objs: iwopy.core.OptFunctionList
|
|
28
18
|
The objective functions
|
|
29
|
-
cons
|
|
19
|
+
cons: iwopy.core.OptFunctionList
|
|
30
20
|
The constraints
|
|
31
|
-
memory
|
|
21
|
+
memory: iwopy.core.Memory
|
|
32
22
|
The memory, or None
|
|
33
23
|
|
|
24
|
+
:group: core
|
|
25
|
+
|
|
34
26
|
"""
|
|
35
27
|
|
|
36
28
|
INT_INF = RegularDiscretizationGrid.INT_INF
|
|
37
29
|
|
|
38
30
|
def __init__(self, name, mem_size=None, mem_keyf=None):
|
|
31
|
+
"""
|
|
32
|
+
Constructor
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
name: str
|
|
37
|
+
The problem's name
|
|
38
|
+
mem_size: int, optional
|
|
39
|
+
The memory size, default no memory
|
|
40
|
+
mem_keyf: Function, optional
|
|
41
|
+
The memory key function. Parameters:
|
|
42
|
+
(vars_int, vars_float), returns key Object
|
|
43
|
+
|
|
44
|
+
"""
|
|
39
45
|
super().__init__(name)
|
|
40
46
|
|
|
41
47
|
self.objs = OptFunctionList(self, "objs")
|
|
@@ -55,7 +61,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
55
61
|
|
|
56
62
|
Returns
|
|
57
63
|
-------
|
|
58
|
-
names
|
|
64
|
+
names: list of str
|
|
59
65
|
The names of the integer variables
|
|
60
66
|
|
|
61
67
|
"""
|
|
@@ -67,7 +73,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
67
73
|
|
|
68
74
|
Returns
|
|
69
75
|
-------
|
|
70
|
-
values
|
|
76
|
+
values: numpy.ndarray
|
|
71
77
|
Initial int values, shape: (n_vars_int,)
|
|
72
78
|
|
|
73
79
|
"""
|
|
@@ -81,7 +87,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
81
87
|
|
|
82
88
|
Returns
|
|
83
89
|
-------
|
|
84
|
-
values
|
|
90
|
+
values: numpy.ndarray
|
|
85
91
|
Minimal int values, shape: (n_vars_int,)
|
|
86
92
|
|
|
87
93
|
"""
|
|
@@ -95,7 +101,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
95
101
|
|
|
96
102
|
Returns
|
|
97
103
|
-------
|
|
98
|
-
values
|
|
104
|
+
values: numpy.ndarray
|
|
99
105
|
Maximal int values, shape: (n_vars_int,)
|
|
100
106
|
|
|
101
107
|
"""
|
|
@@ -108,7 +114,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
108
114
|
|
|
109
115
|
Returns
|
|
110
116
|
-------
|
|
111
|
-
n
|
|
117
|
+
n: int
|
|
112
118
|
The number of int variables
|
|
113
119
|
|
|
114
120
|
"""
|
|
@@ -120,7 +126,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
120
126
|
|
|
121
127
|
Returns
|
|
122
128
|
-------
|
|
123
|
-
names
|
|
129
|
+
names: list of str
|
|
124
130
|
The names of the float variables
|
|
125
131
|
|
|
126
132
|
"""
|
|
@@ -132,7 +138,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
132
138
|
|
|
133
139
|
Returns
|
|
134
140
|
-------
|
|
135
|
-
values
|
|
141
|
+
values: numpy.ndarray
|
|
136
142
|
Initial float values, shape: (n_vars_float,)
|
|
137
143
|
|
|
138
144
|
"""
|
|
@@ -146,7 +152,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
146
152
|
|
|
147
153
|
Returns
|
|
148
154
|
-------
|
|
149
|
-
values
|
|
155
|
+
values: numpy.ndarray
|
|
150
156
|
Minimal float values, shape: (n_vars_float,)
|
|
151
157
|
|
|
152
158
|
"""
|
|
@@ -160,7 +166,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
160
166
|
|
|
161
167
|
Returns
|
|
162
168
|
-------
|
|
163
|
-
values
|
|
169
|
+
values: numpy.ndarray
|
|
164
170
|
Maximal float values, shape: (n_vars_float,)
|
|
165
171
|
|
|
166
172
|
"""
|
|
@@ -173,7 +179,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
173
179
|
|
|
174
180
|
Returns
|
|
175
181
|
-------
|
|
176
|
-
n
|
|
182
|
+
n: int
|
|
177
183
|
The number of float variables
|
|
178
184
|
|
|
179
185
|
"""
|
|
@@ -235,7 +241,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
235
241
|
|
|
236
242
|
Parameters
|
|
237
243
|
----------
|
|
238
|
-
objective
|
|
244
|
+
objective: iwopy.Objective
|
|
239
245
|
The objective
|
|
240
246
|
varmap_int: dict, optional
|
|
241
247
|
Mapping from objective variables to
|
|
@@ -245,7 +251,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
245
251
|
Mapping from objective variables to
|
|
246
252
|
problem variables. Key: str or int,
|
|
247
253
|
value: str or int
|
|
248
|
-
verbosity
|
|
254
|
+
verbosity: int
|
|
249
255
|
The verbosity level, 0 = silent
|
|
250
256
|
|
|
251
257
|
"""
|
|
@@ -267,7 +273,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
267
273
|
|
|
268
274
|
Parameters
|
|
269
275
|
----------
|
|
270
|
-
constraint
|
|
276
|
+
constraint: iwopy.Constraint
|
|
271
277
|
The constraint
|
|
272
278
|
varmap_int: dict, optional
|
|
273
279
|
Mapping from objective variables to
|
|
@@ -277,7 +283,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
277
283
|
Mapping from objective variables to
|
|
278
284
|
problem variables. Key: str or int,
|
|
279
285
|
value: str or int
|
|
280
|
-
verbosity
|
|
286
|
+
verbosity: int
|
|
281
287
|
The verbosity level, 0 = silent
|
|
282
288
|
|
|
283
289
|
"""
|
|
@@ -306,7 +312,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
306
312
|
|
|
307
313
|
Returns
|
|
308
314
|
-------
|
|
309
|
-
cmi
|
|
315
|
+
cmi: numpy.ndarray
|
|
310
316
|
The minimal constraint values, shape: (n_constraints,)
|
|
311
317
|
|
|
312
318
|
"""
|
|
@@ -319,7 +325,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
319
325
|
|
|
320
326
|
Returns
|
|
321
327
|
-------
|
|
322
|
-
cma
|
|
328
|
+
cma: numpy.ndarray
|
|
323
329
|
The maximal constraint values, shape: (n_constraints,)
|
|
324
330
|
|
|
325
331
|
"""
|
|
@@ -332,7 +338,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
332
338
|
|
|
333
339
|
Returns
|
|
334
340
|
-------
|
|
335
|
-
ctol
|
|
341
|
+
ctol: numpy.ndarray
|
|
336
342
|
The constraint tolerance values, shape: (n_constraints,)
|
|
337
343
|
|
|
338
344
|
"""
|
|
@@ -346,7 +352,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
346
352
|
|
|
347
353
|
Returns
|
|
348
354
|
-------
|
|
349
|
-
n_obj
|
|
355
|
+
n_obj: int
|
|
350
356
|
The total number of objective
|
|
351
357
|
functions
|
|
352
358
|
|
|
@@ -361,7 +367,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
361
367
|
|
|
362
368
|
Returns
|
|
363
369
|
-------
|
|
364
|
-
n_con
|
|
370
|
+
n_con: int
|
|
365
371
|
The total number of constraint
|
|
366
372
|
functions
|
|
367
373
|
|
|
@@ -434,31 +440,31 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
434
440
|
|
|
435
441
|
Parameters
|
|
436
442
|
----------
|
|
437
|
-
vars_int
|
|
443
|
+
vars_int: np.array
|
|
438
444
|
The integer variable values, shape: (n_vars_int,)
|
|
439
|
-
vars_float
|
|
445
|
+
vars_float: np.array
|
|
440
446
|
The float variable values, shape: (n_vars_float,)
|
|
441
|
-
func
|
|
447
|
+
func: iwopy.core.OptFunctionList, optional
|
|
442
448
|
The functions to be differentiated, or None
|
|
443
449
|
for a list of all objectives and all constraints
|
|
444
450
|
(in that order)
|
|
445
|
-
components
|
|
451
|
+
components: list of int, optional
|
|
446
452
|
The function's component selection, or None for all
|
|
447
|
-
ivars
|
|
453
|
+
ivars: list of int
|
|
448
454
|
The indices of the function int variables in the problem
|
|
449
|
-
fvars
|
|
455
|
+
fvars: list of int
|
|
450
456
|
The indices of the function float variables in the problem
|
|
451
|
-
vrs
|
|
457
|
+
vrs: list of int
|
|
452
458
|
The function float variable indices wrt which the
|
|
453
459
|
derivatives are to be calculated
|
|
454
|
-
pop
|
|
460
|
+
pop: bool
|
|
455
461
|
Flag for vectorizing calculations via population
|
|
456
|
-
verbosity
|
|
462
|
+
verbosity: int
|
|
457
463
|
The verbosity level, 0 = silent
|
|
458
464
|
|
|
459
465
|
Returns
|
|
460
466
|
-------
|
|
461
|
-
gradients
|
|
467
|
+
gradients: numpy.ndarray
|
|
462
468
|
The gradients of the functions, shape:
|
|
463
469
|
(n_components, n_vrs)
|
|
464
470
|
|
|
@@ -501,28 +507,28 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
501
507
|
|
|
502
508
|
Parameters
|
|
503
509
|
----------
|
|
504
|
-
vars_int
|
|
510
|
+
vars_int: np.array
|
|
505
511
|
The integer variable values, shape: (n_vars_int,)
|
|
506
|
-
vars_float
|
|
512
|
+
vars_float: np.array
|
|
507
513
|
The float variable values, shape: (n_vars_float,)
|
|
508
|
-
func
|
|
514
|
+
func: iwopy.core.OptFunctionList, optional
|
|
509
515
|
The functions to be differentiated, or None
|
|
510
516
|
for a list of all objectives and all constraints
|
|
511
517
|
(in that order)
|
|
512
|
-
components
|
|
518
|
+
components: list of int, optional
|
|
513
519
|
The function's component selection, or None for all
|
|
514
|
-
vars
|
|
520
|
+
vars: list of int or str, optional
|
|
515
521
|
The float variables wrt which the
|
|
516
522
|
derivatives are to be calculated, or
|
|
517
523
|
None for all
|
|
518
|
-
verbosity
|
|
524
|
+
verbosity: int
|
|
519
525
|
The verbosity level, 0 = silent
|
|
520
|
-
pop
|
|
526
|
+
pop: bool
|
|
521
527
|
Flag for vectorizing calculations via population
|
|
522
528
|
|
|
523
529
|
Returns
|
|
524
530
|
-------
|
|
525
|
-
gradients
|
|
531
|
+
gradients: numpy.ndarray
|
|
526
532
|
The gradients of the functions, shape:
|
|
527
533
|
(n_components, n_vars)
|
|
528
534
|
|
|
@@ -605,7 +611,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
605
611
|
|
|
606
612
|
Parameters
|
|
607
613
|
----------
|
|
608
|
-
verbosity
|
|
614
|
+
verbosity: int
|
|
609
615
|
The verbosity level, 0 = silent
|
|
610
616
|
|
|
611
617
|
"""
|
|
@@ -624,22 +630,22 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
624
630
|
if self._mem_size is not None:
|
|
625
631
|
self.memory = Memory(self._mem_size, self._mem_keyf)
|
|
626
632
|
if verbosity:
|
|
627
|
-
print(f" Memory size
|
|
633
|
+
print(f" Memory size : {self.memory.size}")
|
|
628
634
|
print(self._hline)
|
|
629
635
|
|
|
630
636
|
n_int = self.n_vars_int
|
|
631
637
|
n_float = self.n_vars_float
|
|
632
638
|
if verbosity:
|
|
633
|
-
print(f" n_vars_int
|
|
634
|
-
print(f" n_vars_float
|
|
639
|
+
print(f" n_vars_int : {n_int}")
|
|
640
|
+
print(f" n_vars_float: {n_float}")
|
|
635
641
|
print(self._hline)
|
|
636
642
|
|
|
637
643
|
if verbosity:
|
|
638
|
-
print(f" n_objectives
|
|
639
|
-
print(f" n_obj_cmptns
|
|
644
|
+
print(f" n_objectives: {self.objs.n_functions}")
|
|
645
|
+
print(f" n_obj_cmptns: {self.n_objectives}")
|
|
640
646
|
print(self._hline)
|
|
641
647
|
print(f" n_constraints: {self.cons.n_functions}")
|
|
642
|
-
print(f" n_con_cmptns
|
|
648
|
+
print(f" n_con_cmptns: {self.n_constraints}")
|
|
643
649
|
print(self._hline)
|
|
644
650
|
|
|
645
651
|
if self.n_objectives == 0:
|
|
@@ -661,7 +667,7 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
661
667
|
|
|
662
668
|
Returns
|
|
663
669
|
-------
|
|
664
|
-
maximize
|
|
670
|
+
maximize: numpy.ndarray
|
|
665
671
|
Boolean flag for maximization of objective,
|
|
666
672
|
shape: (n_objectives,)
|
|
667
673
|
|
|
@@ -674,14 +680,14 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
674
680
|
|
|
675
681
|
Parameters
|
|
676
682
|
----------
|
|
677
|
-
vars_int
|
|
683
|
+
vars_int: np.array
|
|
678
684
|
The integer variable values, shape: (n_vars_int,)
|
|
679
|
-
vars_float
|
|
685
|
+
vars_float: np.array
|
|
680
686
|
The float variable values, shape: (n_vars_float,)
|
|
681
687
|
|
|
682
688
|
Returns
|
|
683
689
|
-------
|
|
684
|
-
problem_results
|
|
690
|
+
problem_results: Any
|
|
685
691
|
The results of the variable application
|
|
686
692
|
to the problem
|
|
687
693
|
|
|
@@ -695,14 +701,14 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
695
701
|
|
|
696
702
|
Parameters
|
|
697
703
|
----------
|
|
698
|
-
vars_int
|
|
704
|
+
vars_int: np.array
|
|
699
705
|
The integer variable values, shape: (n_pop, n_vars_int)
|
|
700
|
-
vars_float
|
|
706
|
+
vars_float: np.array
|
|
701
707
|
The float variable values, shape: (n_pop, n_vars_float)
|
|
702
708
|
|
|
703
709
|
Returns
|
|
704
710
|
-------
|
|
705
|
-
problem_results
|
|
711
|
+
problem_results: Any
|
|
706
712
|
The results of the variable application
|
|
707
713
|
to the problem
|
|
708
714
|
|
|
@@ -715,20 +721,20 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
715
721
|
|
|
716
722
|
Parameters
|
|
717
723
|
----------
|
|
718
|
-
vars_int
|
|
724
|
+
vars_int: np.array
|
|
719
725
|
The integer variable values, shape: (n_vars_int,)
|
|
720
|
-
vars_float
|
|
726
|
+
vars_float: np.array
|
|
721
727
|
The float variable values, shape: (n_vars_float,)
|
|
722
|
-
ret_prob_res
|
|
728
|
+
ret_prob_res: bool
|
|
723
729
|
Flag for additionally returning of problem results
|
|
724
730
|
|
|
725
731
|
Returns
|
|
726
732
|
-------
|
|
727
|
-
objs
|
|
733
|
+
objs: np.array
|
|
728
734
|
The objective function values, shape: (n_objectives,)
|
|
729
|
-
con
|
|
735
|
+
con: np.array
|
|
730
736
|
The constraints values, shape: (n_constraints,)
|
|
731
|
-
prob_res
|
|
737
|
+
prob_res: object, optional
|
|
732
738
|
The problem results
|
|
733
739
|
|
|
734
740
|
"""
|
|
@@ -763,20 +769,20 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
763
769
|
|
|
764
770
|
Parameters
|
|
765
771
|
----------
|
|
766
|
-
vars_int
|
|
772
|
+
vars_int: np.array
|
|
767
773
|
The integer variable values, shape: (n_pop, n_vars_int)
|
|
768
|
-
vars_float
|
|
774
|
+
vars_float: np.array
|
|
769
775
|
The float variable values, shape: (n_pop, n_vars_float)
|
|
770
|
-
ret_prob_res
|
|
776
|
+
ret_prob_res: bool
|
|
771
777
|
Flag for additionally returning of problem results
|
|
772
778
|
|
|
773
779
|
Returns
|
|
774
780
|
-------
|
|
775
|
-
objs
|
|
781
|
+
objs: np.array
|
|
776
782
|
The objective function values, shape: (n_pop, n_objectives)
|
|
777
|
-
cons
|
|
783
|
+
cons: np.array
|
|
778
784
|
The constraints values, shape: (n_pop, n_constraints)
|
|
779
|
-
prob_res
|
|
785
|
+
prob_res: object, optional
|
|
780
786
|
The problem results
|
|
781
787
|
|
|
782
788
|
"""
|
|
@@ -835,14 +841,14 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
835
841
|
|
|
836
842
|
Parameters
|
|
837
843
|
----------
|
|
838
|
-
constraint_values
|
|
844
|
+
constraint_values: np.array
|
|
839
845
|
The constraint values, shape: (n_components,)
|
|
840
|
-
verbosity
|
|
846
|
+
verbosity: int
|
|
841
847
|
The verbosity level, 0 = silent
|
|
842
848
|
|
|
843
849
|
Returns
|
|
844
850
|
-------
|
|
845
|
-
values
|
|
851
|
+
values: np.array
|
|
846
852
|
The boolean result, shape: (n_components,)
|
|
847
853
|
|
|
848
854
|
"""
|
|
@@ -864,14 +870,14 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
864
870
|
|
|
865
871
|
Parameters
|
|
866
872
|
----------
|
|
867
|
-
constraint_values
|
|
873
|
+
constraint_values: np.array
|
|
868
874
|
The constraint values, shape: (n_pop, n_components)
|
|
869
|
-
verbosity
|
|
875
|
+
verbosity: int
|
|
870
876
|
The verbosity level, 0 = silent
|
|
871
877
|
|
|
872
878
|
Returns
|
|
873
879
|
-------
|
|
874
|
-
values
|
|
880
|
+
values: np.array
|
|
875
881
|
The boolean result, shape: (n_pop, n_components)
|
|
876
882
|
|
|
877
883
|
"""
|
|
@@ -893,21 +899,21 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
893
899
|
|
|
894
900
|
Parameters
|
|
895
901
|
----------
|
|
896
|
-
vars_int
|
|
902
|
+
vars_int: np.array
|
|
897
903
|
The optimal integer variable values, shape: (n_vars_int,)
|
|
898
|
-
vars_float
|
|
904
|
+
vars_float: np.array
|
|
899
905
|
The optimal float variable values, shape: (n_vars_float,)
|
|
900
|
-
verbosity
|
|
906
|
+
verbosity: int
|
|
901
907
|
The verbosity level, 0 = silent
|
|
902
908
|
|
|
903
909
|
Returns
|
|
904
910
|
-------
|
|
905
|
-
problem_results
|
|
911
|
+
problem_results: Any
|
|
906
912
|
The results of the variable application
|
|
907
913
|
to the problem
|
|
908
|
-
objs
|
|
914
|
+
objs: np.array
|
|
909
915
|
The objective function values, shape: (n_objectives,)
|
|
910
|
-
cons
|
|
916
|
+
cons: np.array
|
|
911
917
|
The constraints values, shape: (n_constraints,)
|
|
912
918
|
|
|
913
919
|
"""
|
|
@@ -927,23 +933,23 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
927
933
|
|
|
928
934
|
Parameters
|
|
929
935
|
----------
|
|
930
|
-
vars_int
|
|
936
|
+
vars_int: np.array
|
|
931
937
|
The integer variable values of the final
|
|
932
938
|
generation, shape: (n_pop, n_vars_int)
|
|
933
|
-
vars_float
|
|
939
|
+
vars_float: np.array
|
|
934
940
|
The float variable values of the final
|
|
935
941
|
generation, shape: (n_pop, n_vars_float)
|
|
936
|
-
verbosity
|
|
942
|
+
verbosity: int
|
|
937
943
|
The verbosity level, 0 = silent
|
|
938
944
|
|
|
939
945
|
Returns
|
|
940
946
|
-------
|
|
941
|
-
problem_results
|
|
947
|
+
problem_results: Any
|
|
942
948
|
The results of the variable application
|
|
943
949
|
to the problem
|
|
944
|
-
objs
|
|
950
|
+
objs: np.array
|
|
945
951
|
The final objective function values, shape: (n_pop, n_components)
|
|
946
|
-
cons
|
|
952
|
+
cons: np.array
|
|
947
953
|
The final constraint values, shape: (n_pop, n_constraints)
|
|
948
954
|
|
|
949
955
|
"""
|
|
@@ -963,14 +969,14 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
963
969
|
|
|
964
970
|
Parameters
|
|
965
971
|
----------
|
|
966
|
-
prob_res_list
|
|
972
|
+
prob_res_list: list
|
|
967
973
|
The problem results
|
|
968
|
-
coeffs
|
|
974
|
+
coeffs: numpy.ndarray
|
|
969
975
|
The coefficients
|
|
970
976
|
|
|
971
977
|
Returns
|
|
972
978
|
-------
|
|
973
|
-
prob_res
|
|
979
|
+
prob_res: object
|
|
974
980
|
The weighted sum of problem results
|
|
975
981
|
|
|
976
982
|
"""
|
|
@@ -987,14 +993,14 @@ class Problem(Base, metaclass=ABCMeta):
|
|
|
987
993
|
|
|
988
994
|
Parameters
|
|
989
995
|
----------
|
|
990
|
-
prob_res_list
|
|
996
|
+
prob_res_list: list
|
|
991
997
|
The problem results
|
|
992
|
-
coeffs
|
|
998
|
+
coeffs: numpy.ndarray
|
|
993
999
|
The coefficients
|
|
994
1000
|
|
|
995
1001
|
Returns
|
|
996
1002
|
-------
|
|
997
|
-
prob_res
|
|
1003
|
+
prob_res: object
|
|
998
1004
|
The weighted sum of problem results
|
|
999
1005
|
|
|
1000
1006
|
"""
|
|
@@ -1011,14 +1017,20 @@ class ProblemDefaultFunc(OptFunctionList):
|
|
|
1011
1017
|
The default function of a problem
|
|
1012
1018
|
for gradient calculations.
|
|
1013
1019
|
|
|
1014
|
-
|
|
1015
|
-
----------
|
|
1016
|
-
problem : iwopy.core.Problem
|
|
1017
|
-
The problem
|
|
1020
|
+
:group: core
|
|
1018
1021
|
|
|
1019
1022
|
"""
|
|
1020
1023
|
|
|
1021
1024
|
def __init__(self, problem):
|
|
1025
|
+
"""
|
|
1026
|
+
Constructor
|
|
1027
|
+
|
|
1028
|
+
Parameters
|
|
1029
|
+
----------
|
|
1030
|
+
problem: iwopy.core.Problem
|
|
1031
|
+
The problem
|
|
1032
|
+
|
|
1033
|
+
"""
|
|
1022
1034
|
super().__init__(problem, "objs_cons")
|
|
1023
1035
|
for f in problem.objs.functions:
|
|
1024
1036
|
self.append(f)
|
iwopy/interfaces/pygmo/algos.py
CHANGED
|
@@ -4,6 +4,9 @@ from . import imports
|
|
|
4
4
|
class AlgoFactory:
|
|
5
5
|
"""
|
|
6
6
|
Creates a pygmo algorithm from parameters
|
|
7
|
+
|
|
8
|
+
:group: interfaces.pygmo
|
|
9
|
+
|
|
7
10
|
"""
|
|
8
11
|
|
|
9
12
|
@staticmethod
|
|
@@ -15,9 +18,9 @@ class AlgoFactory:
|
|
|
15
18
|
|
|
16
19
|
Parameters
|
|
17
20
|
----------
|
|
18
|
-
type
|
|
21
|
+
type: str
|
|
19
22
|
Name of the driver type
|
|
20
|
-
kwargs
|
|
23
|
+
kwargs: dict, optional
|
|
21
24
|
Additional parameters, type dependent
|
|
22
25
|
|
|
23
26
|
Returns
|
|
@@ -12,33 +12,39 @@ class Optimizer_pygmo(Optimizer):
|
|
|
12
12
|
Interface to the pygmo optimizers
|
|
13
13
|
for serial runs.
|
|
14
14
|
|
|
15
|
-
Parameters
|
|
16
|
-
----------
|
|
17
|
-
problem : iwopy.Problem
|
|
18
|
-
The problem to optimize
|
|
19
|
-
problem_pars : dict
|
|
20
|
-
Parameters for the problem
|
|
21
|
-
algo_pars : dict
|
|
22
|
-
Parameters for the alorithm
|
|
23
|
-
setup_pars : dict
|
|
24
|
-
Parameters for the calculation setup
|
|
25
|
-
|
|
26
15
|
Attributes
|
|
27
16
|
----------
|
|
28
|
-
problem_pars
|
|
17
|
+
problem_pars: dict
|
|
29
18
|
Parameters for the problem
|
|
30
|
-
algo_pars
|
|
19
|
+
algo_pars: dict
|
|
31
20
|
Parameters for the alorithm
|
|
32
|
-
setup_pars
|
|
21
|
+
setup_pars: dict
|
|
33
22
|
Parameters for the calculation setup
|
|
34
|
-
udp
|
|
23
|
+
udp: iwopy.interfaces.imports.pygmo.UDA
|
|
35
24
|
The pygmo problem
|
|
36
|
-
algo
|
|
25
|
+
algo: imports.pygmo.algo
|
|
37
26
|
The pygmo algorithm
|
|
38
27
|
|
|
28
|
+
:group: interfaces.pygmo
|
|
29
|
+
|
|
39
30
|
"""
|
|
40
31
|
|
|
41
32
|
def __init__(self, problem, problem_pars, algo_pars, setup_pars={}):
|
|
33
|
+
"""
|
|
34
|
+
Constructor
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
problem: iwopy.Problem
|
|
39
|
+
The problem to optimize
|
|
40
|
+
problem_pars: dict
|
|
41
|
+
Parameters for the problem
|
|
42
|
+
algo_pars: dict
|
|
43
|
+
Parameters for the alorithm
|
|
44
|
+
setup_pars: dict
|
|
45
|
+
Parameters for the calculation setup
|
|
46
|
+
|
|
47
|
+
"""
|
|
42
48
|
super().__init__(problem)
|
|
43
49
|
|
|
44
50
|
imports.load()
|
|
@@ -56,7 +62,7 @@ class Optimizer_pygmo(Optimizer):
|
|
|
56
62
|
|
|
57
63
|
Parameters
|
|
58
64
|
----------
|
|
59
|
-
verbosity
|
|
65
|
+
verbosity: int
|
|
60
66
|
The verbosity level, 0 = silent
|
|
61
67
|
|
|
62
68
|
"""
|
|
@@ -113,7 +119,7 @@ class Optimizer_pygmo(Optimizer):
|
|
|
113
119
|
|
|
114
120
|
Parameters
|
|
115
121
|
----------
|
|
116
|
-
verbosity
|
|
122
|
+
verbosity: int
|
|
117
123
|
The verbosity level, 0 = silent
|
|
118
124
|
|
|
119
125
|
Returns
|