UQPyL 2.0.9__tar.gz → 2.0.10__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.
- {UQPyL-2.0.9 → UQPyL-2.0.10}/PKG-INFO +2 -2
- {UQPyL-2.0.9 → UQPyL-2.0.10}/README.md +1 -1
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/samplerABC.py +9 -6
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/__init__.py +1 -1
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/__init__.py +3 -2
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/algorithmABC.py +18 -11
- UQPyL-2.0.10/UQPyL/optimization/mathematics/__init__.py +2 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/metric/gd.py +2 -2
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/metric/hv.py +8 -7
- UQPyL-2.0.10/UQPyL/optimization/metric/igd.py +14 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/multi_objective/__init__.py +1 -0
- UQPyL-2.0.10/UQPyL/optimization/multi_objective/moasmo.py +185 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/multi_objective/moea_d.py +39 -34
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/multi_objective/nsga_ii.py +12 -18
- UQPyL-2.0.10/UQPyL/optimization/multi_objective/nsga_iii.py +163 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/multi_objective/rvea.py +27 -28
- UQPyL-2.0.10/UQPyL/optimization/population.py +173 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/result.py +38 -26
- UQPyL-2.0.10/UQPyL/optimization/single_objective/abc.py +177 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/asmo.py +30 -21
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/csa.py +47 -45
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/de.py +28 -23
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/ego.py +17 -9
- UQPyL-2.0.10/UQPyL/optimization/single_objective/ga.py +179 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/ml_sce_ua.py +25 -26
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/pso.py +33 -35
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/sce_ua.py +40 -36
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/utility_functions/__init__.py +1 -1
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/utility_functions/crowding_distance.py +1 -1
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/utility_functions/ndsort.py +15 -2
- UQPyL-2.0.10/UQPyL/optimization/utility_functions/operation_GA.py +94 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/problems/multi_objective/DTLZ.py +114 -95
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/problems/multi_objective/ZDT.py +20 -11
- UQPyL-2.0.10/UQPyL/problems/multi_objective/__init__.py +2 -0
- UQPyL-2.0.10/UQPyL/problems/pratical_problem.py +34 -0
- UQPyL-2.0.10/UQPyL/problems/problemABC.py +131 -0
- UQPyL-2.0.10/UQPyL/problems/single_objective/__init__.py +3 -0
- UQPyL-2.0.9/UQPyL/problems/single_objective/single_base_problem.py → UQPyL-2.0.10/UQPyL/problems/single_objective/single_simple_problem.py +33 -30
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/problems/utility_functions/NDsort.py +9 -9
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/problems/utility_functions/uniformPoint.py +2 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/delta_test.py +1 -1
- UQPyL-2.0.10/UQPyL/sensibility/util/__init__.py +0 -0
- {UQPyL-2.0.9/UQPyL/optimization/single_objective → UQPyL-2.0.10/UQPyL/sensibility/util}/_binary_ga.py +7 -1
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/__init__.py +2 -1
- UQPyL-2.0.10/UQPyL/surrogates/auto_tuner.py +100 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/gaussian_process.py +106 -73
- UQPyL-2.0.10/UQPyL/surrogates/gp/kernel/base_kernel.py +59 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/kernel/c_kernel_.py +5 -4
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/kernel/matern_kernel.py +34 -15
- UQPyL-2.0.10/UQPyL/surrogates/gp/kernel/rbf_kernel.py +31 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/kernel/rq_kernel.py +3 -4
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/kriging/kernel/base_kernel.py +13 -12
- UQPyL-2.0.10/UQPyL/surrogates/kriging/kernel/exp_kernel.py +25 -0
- UQPyL-2.0.10/UQPyL/surrogates/kriging/kernel/guass_kernel.py +26 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/kriging/kriging.py +130 -91
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_basis.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_forward.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_knot_search.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_pruning.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_qr.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_record.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_types.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/_util.c +192 -192
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/mars.py +35 -119
- UQPyL-2.0.10/UQPyL/surrogates/rbf/kernel/base_kernel.py +57 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/kernel/cubic_kernel.py +1 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/radial_basis_function.py +63 -18
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/regression/lasso/lasso_fast.c +193 -193
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/regression/linear_regression.py +19 -2
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/regression/polynomial_regression.py +14 -0
- UQPyL-2.0.10/UQPyL/surrogates/setting.py +94 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/surrogateABC.py +22 -21
- UQPyL-2.0.10/UQPyL/surrogates/svr/support_vector_machine.py +86 -0
- UQPyL-2.0.10/UQPyL/surrogates/util/__init__.py +9 -0
- UQPyL-2.0.10/UQPyL/surrogates/util/boxmin.py +111 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/verbose.py +171 -125
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL.egg-info/PKG-INFO +2 -2
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL.egg-info/SOURCES.txt +8 -3
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL.egg-info/requires.txt +1 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/pyproject.toml +2 -1
- {UQPyL-2.0.9 → UQPyL-2.0.10}/setup.py +1 -1
- UQPyL-2.0.9/UQPyL/optimization/mathematics/__init__.py +0 -2
- UQPyL-2.0.9/UQPyL/optimization/metric/igd.py +0 -14
- UQPyL-2.0.9/UQPyL/optimization/multi_objective/moasmo.py +0 -168
- UQPyL-2.0.9/UQPyL/optimization/population.py +0 -156
- UQPyL-2.0.9/UQPyL/optimization/single_objective/abc.py +0 -175
- UQPyL-2.0.9/UQPyL/optimization/single_objective/ga.py +0 -168
- UQPyL-2.0.9/UQPyL/optimization/utility_functions/operationGA.py +0 -81
- UQPyL-2.0.9/UQPyL/problems/multi_objective/__init__.py +0 -2
- UQPyL-2.0.9/UQPyL/problems/pratical_problem.py +0 -16
- UQPyL-2.0.9/UQPyL/problems/problemABC.py +0 -90
- UQPyL-2.0.9/UQPyL/problems/single_objective/__init__.py +0 -3
- UQPyL-2.0.9/UQPyL/surrogates/gp/kernel/base_kernel.py +0 -28
- UQPyL-2.0.9/UQPyL/surrogates/gp/kernel/rbf_kernel.py +0 -61
- UQPyL-2.0.9/UQPyL/surrogates/kriging/kernel/exp_kernel.py +0 -59
- UQPyL-2.0.9/UQPyL/surrogates/kriging/kernel/guass_kernel.py +0 -67
- UQPyL-2.0.9/UQPyL/surrogates/rbf/kernel/base_kernel.py +0 -82
- UQPyL-2.0.9/UQPyL/surrogates/setting.py +0 -90
- UQPyL-2.0.9/UQPyL/surrogates/svr/support_vector_machine.py +0 -69
- {UQPyL-2.0.9 → UQPyL-2.0.10}/LICENSE.md +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/fast_sequence.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/full_fact.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/lhs.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/morris_sequence.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/random.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/saltelli_sequence.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/DoE/sobol_sequence.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/mathematics/adam.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/mathematics/boxmin.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/metric/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/single_objective/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/utility_functions/tournament_selection.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/optimization/utility_functions/uniform_point.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/problems/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/problems/utility_functions/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/fast.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/mars_sa.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/morris.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/rbd_fast.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/rsa.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/saABC.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/sensibility/sobol.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/fnn/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/fnn/_activation_funcs.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/fnn/base.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/fnn/fully_connect_neural_network.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/kernel/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/gp/kernel/dot_kernel_.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/kriging/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/kriging/kernel/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/kriging/kernel/cubic_kernel.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/mars/core/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/kernel/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/kernel/gaussian_kernel.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/kernel/linear_kernel.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/kernel/multiquadric_kernel.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/rbf/kernel/thin_plate_spline_kernel.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/regression/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/regression/lasso/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/svr/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/svr/core/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/svr/core/libsvm_interface.cpp +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/surrogates/svr/core/svm.cpp +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/__init__.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/grid_search.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/metrics.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/model_selections.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/polynomial_features.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL/utility/scalers.py +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL.egg-info/dependency_links.txt +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/UQPyL.egg-info/top_level.txt +0 -0
- {UQPyL-2.0.9 → UQPyL-2.0.10}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: UQPyL
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.10
|
|
4
4
|
Summary: A python package for parameter uncertainty quantification and optimization
|
|
5
5
|
Author: wmtSky
|
|
6
6
|
Author-email: wmtSky <wmtsky@hhu.edu.cn>
|
|
@@ -53,7 +53,7 @@ License-File: LICENSE.md
|
|
|
53
53
|
|
|
54
54
|
(* indicates solving computational expensive optimization problem)
|
|
55
55
|
- **Single Objective Optimization**: SCE-UA, ML-SCE-UA, GA, CSA, PSO, DE, ABC, ASMO*, EGO*
|
|
56
|
-
- **Multi-Objective Optimization**: MOEA/D, NSGA-II, RVEA, MOASMO*
|
|
56
|
+
- **Multi-Objective Optimization**: MOEA/D, NSGA-II, RVEA, NSGA-III, MOASMO*
|
|
57
57
|
|
|
58
58
|
*Note: The library is still being updated. If you need other algorithms, please contact us.*
|
|
59
59
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
(* indicates solving computational expensive optimization problem)
|
|
38
38
|
- **Single Objective Optimization**: SCE-UA, ML-SCE-UA, GA, CSA, PSO, DE, ABC, ASMO*, EGO*
|
|
39
|
-
- **Multi-Objective Optimization**: MOEA/D, NSGA-II, RVEA, MOASMO*
|
|
39
|
+
- **Multi-Objective Optimization**: MOEA/D, NSGA-II, RVEA, NSGA-III, MOASMO*
|
|
40
40
|
|
|
41
41
|
*Note: The library is still being updated. If you need other algorithms, please contact us.*
|
|
42
42
|
|
|
@@ -7,13 +7,16 @@ def decoratorRescale(func):
|
|
|
7
7
|
def wrapper(self, *args, **kwargs):
|
|
8
8
|
result=func(self, *args, **kwargs)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
if len(args)>=3:
|
|
11
|
+
|
|
12
|
+
problem=args[2]
|
|
13
|
+
return problem._unit_X_transform_to_bound(result)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if 'problem' in kwargs:
|
|
16
|
+
problem=kwargs['problem']
|
|
17
|
+
|
|
18
|
+
if problem:
|
|
19
|
+
return problem._unit_X_transform_to_bound(result)
|
|
17
20
|
|
|
18
21
|
return result
|
|
19
22
|
return wrapper
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from .single_objective import GA, PSO, CSA, DE, SCE_UA, ML_SCE_UA, ASMO, ABC, Binary_GA, EGO
|
|
2
2
|
from .multi_objective import NSGAII, MOEAD, MOASMO, RVEA
|
|
3
|
-
from .mathematics import Boxmin, Adam
|
|
4
|
-
from .algorithmABC import Algorithm
|
|
3
|
+
# from .mathematics import Boxmin, Adam
|
|
4
|
+
from .algorithmABC import Algorithm
|
|
5
|
+
from .population import Population
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import numpy as np
|
|
2
1
|
import abc
|
|
3
2
|
import functools
|
|
4
3
|
|
|
@@ -31,10 +30,13 @@ class Algorithm(metaclass=abc.ABCMeta):
|
|
|
31
30
|
def initialize(self, nInit):
|
|
32
31
|
|
|
33
32
|
lhs=LHS('classic')
|
|
34
|
-
xInit=lhs.sample(nInit, self.problem.nInput
|
|
33
|
+
xInit=lhs.sample(nInit, self.problem.nInput)
|
|
34
|
+
xInit=self.problem._unit_X_transform_to_bound(xInit, dst=False)
|
|
35
|
+
|
|
35
36
|
pop=Population(xInit)
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
self.evaluate(pop)
|
|
39
|
+
|
|
38
40
|
return pop
|
|
39
41
|
|
|
40
42
|
@staticmethod
|
|
@@ -54,26 +56,31 @@ class Algorithm(metaclass=abc.ABCMeta):
|
|
|
54
56
|
def evaluate(self, pop):
|
|
55
57
|
|
|
56
58
|
pop.evaluate(self.problem)
|
|
59
|
+
|
|
57
60
|
self.FEs+=pop.nPop
|
|
58
61
|
|
|
59
62
|
def checkTermination(self):
|
|
60
63
|
|
|
61
|
-
if Verbose.isStop: #TODO
|
|
62
|
-
|
|
63
|
-
return False
|
|
64
|
-
|
|
65
64
|
if self.FEs<self.maxFEs:
|
|
66
|
-
if self.maxIter is None or self.iters
|
|
65
|
+
if self.maxIter is None or self.iters<=self.maxIter:
|
|
67
66
|
if self.maxTolerateTimes is None or self.tolerateTimes<=self.maxTolerateTimes:
|
|
67
|
+
|
|
68
|
+
if hasattr(self.problem, 'GUI'):
|
|
69
|
+
self.problem.iterEmit.send()
|
|
70
|
+
if self.problem.isStop==True:
|
|
71
|
+
return False
|
|
72
|
+
|
|
68
73
|
self.iters+=1
|
|
69
74
|
return True
|
|
70
75
|
|
|
71
76
|
return False
|
|
72
77
|
|
|
73
78
|
def setProblem(self, problem):
|
|
79
|
+
|
|
74
80
|
self.problem=problem
|
|
75
81
|
|
|
76
82
|
def saveResult(self):
|
|
83
|
+
|
|
77
84
|
if self.problem.nOutput>1:
|
|
78
85
|
self.result.save(type=1)
|
|
79
86
|
else:
|
|
@@ -83,9 +90,9 @@ class Algorithm(metaclass=abc.ABCMeta):
|
|
|
83
90
|
def record(self, pop):
|
|
84
91
|
|
|
85
92
|
if self.problem.nOutput==1:
|
|
86
|
-
self.result.update(pop, self.FEs, self.iters)
|
|
93
|
+
self.result.update(pop, self.problem, self.FEs, self.iters, 'EA')
|
|
87
94
|
else:
|
|
88
|
-
self.result.update(pop, self.FEs, self.iters,
|
|
95
|
+
self.result.update(pop, self.problem, self.FEs, self.iters, 'MOEA')
|
|
89
96
|
|
|
90
97
|
def setParameters(self, key, value):
|
|
91
98
|
|
|
@@ -2,14 +2,14 @@ import numpy as np
|
|
|
2
2
|
|
|
3
3
|
def HV(pop, refPoint=None):
|
|
4
4
|
|
|
5
|
-
popObjs=pop.getBest().objs
|
|
6
|
-
_, m=popObjs.shape
|
|
5
|
+
popObjs = pop.getBest().objs
|
|
6
|
+
_, m = popObjs.shape
|
|
7
7
|
|
|
8
8
|
if refPoint is None:
|
|
9
9
|
|
|
10
10
|
refPoint = np.ones(m)
|
|
11
|
-
fmin=np.min(np.vstack((popObjs, np.zeros((1,m)))), axis=0)
|
|
12
|
-
fmax=np.max(np.vstack((popObjs, np.ones((1,m)))), axis=0)
|
|
11
|
+
fmin = np.min(np.vstack((popObjs, np.zeros((1,m)))), axis=0)
|
|
12
|
+
fmax = np.max(np.vstack((popObjs, np.ones((1,m)))), axis=0)
|
|
13
13
|
popObjs = (popObjs - fmin)/(fmax - fmin)/1.1
|
|
14
14
|
|
|
15
15
|
if m < 4:
|
|
@@ -27,6 +27,7 @@ def HV(pop, refPoint=None):
|
|
|
27
27
|
S=S_
|
|
28
28
|
|
|
29
29
|
hyperVolume=0
|
|
30
|
+
|
|
30
31
|
for i in range(len(S)):
|
|
31
32
|
p = S[i][1][0]
|
|
32
33
|
hyperVolume += S[i][0] * np.abs(p[m-1] - refPoint[m-1])
|
|
@@ -37,11 +38,11 @@ def HV(pop, refPoint=None):
|
|
|
37
38
|
|
|
38
39
|
totalHyperVolume = np.prod(upperBounds - lowerBounds)
|
|
39
40
|
|
|
40
|
-
nSamples=1e6
|
|
41
|
+
nSamples = 1e6
|
|
41
42
|
|
|
42
|
-
samples=np.random.uniform(lowerBounds, upperBounds, (int(nSamples), m))
|
|
43
|
+
samples = np.random.uniform(lowerBounds, upperBounds, (int(nSamples), m))
|
|
43
44
|
|
|
44
|
-
count=0
|
|
45
|
+
count = 0
|
|
45
46
|
|
|
46
47
|
for sample in samples:
|
|
47
48
|
if np.any(np.all(popObjs<=sample, axis=1)):
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from scipy.spatial.distance import cdist
|
|
3
|
+
|
|
4
|
+
def IGD(pop, optimum):
|
|
5
|
+
|
|
6
|
+
popObjs = pop.getBest().objs
|
|
7
|
+
|
|
8
|
+
distances = cdist(optimum, popObjs, metric='euclidean')
|
|
9
|
+
|
|
10
|
+
minDist = np.min(distances, axis=1)
|
|
11
|
+
|
|
12
|
+
igd = np.mean(minDist)
|
|
13
|
+
|
|
14
|
+
return igd
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
### Multi-Objective Adaptive Surrogate Modelling-based Optimization
|
|
2
|
+
import numpy as np
|
|
3
|
+
from scipy.spatial.distance import cdist
|
|
4
|
+
|
|
5
|
+
from ...DoE import LHS
|
|
6
|
+
from ..utility_functions import NDSort
|
|
7
|
+
from ...problems import PracticalProblem
|
|
8
|
+
from ...surrogates import Mo_Surrogates
|
|
9
|
+
from ..algorithmABC import Algorithm, Population, Verbose
|
|
10
|
+
from .nsga_ii import NSGAII
|
|
11
|
+
from ...surrogates.rbf.radial_basis_function import RBF
|
|
12
|
+
|
|
13
|
+
class MOASMO(Algorithm):
|
|
14
|
+
'''
|
|
15
|
+
Multi-Objective Adaptive Surrogate Modelling-based Optimization <Multi-objective> <Surrogate>
|
|
16
|
+
-----------------------------------------------------------------
|
|
17
|
+
Attributes:
|
|
18
|
+
problem: Problem
|
|
19
|
+
the problem you want to solve, including the following attributes:
|
|
20
|
+
n_input: int
|
|
21
|
+
the input number of the problem
|
|
22
|
+
ub: 1d-np.ndarray or float
|
|
23
|
+
the upper bound of the problem
|
|
24
|
+
lb: 1d-np.ndarray or float
|
|
25
|
+
the lower bound of the problem
|
|
26
|
+
evaluate: Callable
|
|
27
|
+
the function to evaluate the input
|
|
28
|
+
surrogates: Surrogates
|
|
29
|
+
the surrogates you want to use, you should implement Mo_Surrogate class
|
|
30
|
+
Pct: float, default=0.2
|
|
31
|
+
the percentage of the population to be selected for infilling
|
|
32
|
+
n_init: int, default=50
|
|
33
|
+
the number of initial samples
|
|
34
|
+
n_pop: int, default=100
|
|
35
|
+
the number of population for evolution optimizer
|
|
36
|
+
maxFEs: int, default=1000
|
|
37
|
+
the maximum number of function evaluations
|
|
38
|
+
maxIter: int, default=100
|
|
39
|
+
the maximum number of iterations
|
|
40
|
+
x_init: 2d-np.ndarray, default=None
|
|
41
|
+
the initial input samples
|
|
42
|
+
y_init: 2d-np.ndarray, default=None
|
|
43
|
+
the initial output samples
|
|
44
|
+
advance_infilling: bool, default=False
|
|
45
|
+
the switch to use advanced infilling or not
|
|
46
|
+
|
|
47
|
+
Methods:
|
|
48
|
+
run()
|
|
49
|
+
run the optimization
|
|
50
|
+
|
|
51
|
+
References:
|
|
52
|
+
[1] W. Gong et al., Multiobjective adaptive surrogate modeling-based optimization for parameter estimation of large, complex geophysical models,
|
|
53
|
+
Water Resour. Res., vol. 52, no. 3, pp. 1984–2008, Mar. 2016, doi: 10.1002/2015WR018230.
|
|
54
|
+
'''
|
|
55
|
+
|
|
56
|
+
name="MOASMO"
|
|
57
|
+
type="MOEA"
|
|
58
|
+
|
|
59
|
+
def __init__(self, surrogates: Mo_Surrogates=None,
|
|
60
|
+
optimizer: Algorithm=None,
|
|
61
|
+
pct: float=0.2, nInit: int=50, nPop: int=50,
|
|
62
|
+
advance_infilling=False,
|
|
63
|
+
maxFEs: int=1000,
|
|
64
|
+
maxIterTimes: int=100,
|
|
65
|
+
maxTolerateTimes=None, tolerate=1e-6,
|
|
66
|
+
verbose=True, verboseFreq=1, logFlag=True, saveFlag=False):
|
|
67
|
+
|
|
68
|
+
super().__init__(maxFEs, maxIterTimes, maxTolerateTimes, tolerate, verbose, verboseFreq, logFlag, saveFlag)
|
|
69
|
+
|
|
70
|
+
self.setParameters('pct', pct)
|
|
71
|
+
self.setParameters('nInit', nInit)
|
|
72
|
+
self.setParameters('advance_infilling', advance_infilling)
|
|
73
|
+
|
|
74
|
+
if surrogates is not None:
|
|
75
|
+
self.surrogates = surrogates
|
|
76
|
+
else:
|
|
77
|
+
self.surrogates = Mo_Surrogates(n_surrogates=3, models_list=[RBF(), RBF(), RBF()])
|
|
78
|
+
|
|
79
|
+
if optimizer is not None:
|
|
80
|
+
self.optimizer = optimizer
|
|
81
|
+
else:
|
|
82
|
+
self.optimizer = NSGAII(maxFEs=10000, verbose=False, saveFlag=False, logFlag=False)
|
|
83
|
+
|
|
84
|
+
@Verbose.decoratorRun
|
|
85
|
+
@Algorithm.initializeRun
|
|
86
|
+
def run(self, problem, xInit=None, yInit=None):
|
|
87
|
+
|
|
88
|
+
pct = self.getParaValue('pct')
|
|
89
|
+
nInit = self.getParaValue('nInit')
|
|
90
|
+
advance_infilling = self.getParaValue('advance_infilling')
|
|
91
|
+
|
|
92
|
+
nInfilling = int(pct*nInit)
|
|
93
|
+
|
|
94
|
+
self.FEs=0; self.iters=0; self.tolerateTimes=0
|
|
95
|
+
|
|
96
|
+
#Problem
|
|
97
|
+
self.problem = problem
|
|
98
|
+
|
|
99
|
+
#SubProblem
|
|
100
|
+
subProblem = PracticalProblem(self.surrogates.predict, problem.nInput, problem.nOutput, problem.ub, problem.lb, problem.var_type, problem.var_set)
|
|
101
|
+
|
|
102
|
+
#Termination Condition Setting
|
|
103
|
+
self.FEs = 0; self.iters = 0; self.tolerateTimes =0
|
|
104
|
+
|
|
105
|
+
#Population Generation
|
|
106
|
+
if xInit is not None:
|
|
107
|
+
if yInit is not None:
|
|
108
|
+
pop = Population(xInit, yInit)
|
|
109
|
+
else:
|
|
110
|
+
pop = Population(xInit)
|
|
111
|
+
self.evaluate(pop)
|
|
112
|
+
|
|
113
|
+
if nInit > len(pop):
|
|
114
|
+
pop.merge(self.initialize(nInit-len(pop)))
|
|
115
|
+
|
|
116
|
+
else:
|
|
117
|
+
pop = self.initialize(nInit)
|
|
118
|
+
|
|
119
|
+
while self.checkTermination():
|
|
120
|
+
|
|
121
|
+
#Build surrogate models
|
|
122
|
+
self.surrogates.fit(pop.decs, pop.objs)
|
|
123
|
+
|
|
124
|
+
#Run optimization
|
|
125
|
+
res = self.optimizer.run(subProblem)
|
|
126
|
+
|
|
127
|
+
offSpring = Population(decs=res.bestDec, objs=res.bestObj)
|
|
128
|
+
|
|
129
|
+
if advance_infilling==False:
|
|
130
|
+
|
|
131
|
+
if offSpring.nPop > nInfilling:
|
|
132
|
+
bestOff = offSpring.getBest(nInfilling)
|
|
133
|
+
else:
|
|
134
|
+
bestOff = offSpring
|
|
135
|
+
|
|
136
|
+
else:
|
|
137
|
+
|
|
138
|
+
if offSpring.nPop > nInfilling:
|
|
139
|
+
Known_FrontNo, _ = NDSort(pop)
|
|
140
|
+
Unknown_FrontNo, _ = NDSort(offSpring)
|
|
141
|
+
|
|
142
|
+
Known_best_Y = pop.objs[np.where(Known_FrontNo==1)]
|
|
143
|
+
Unknown_best_Y = offSpring.objs[np.where(Unknown_FrontNo==1)]
|
|
144
|
+
Unknown_best_X = offSpring.decs[np.where(Unknown_FrontNo==1)]
|
|
145
|
+
|
|
146
|
+
added_points_Y = []
|
|
147
|
+
added_points_X = []
|
|
148
|
+
|
|
149
|
+
for _ in range(nInfilling):
|
|
150
|
+
|
|
151
|
+
if len(added_points_Y)==0:
|
|
152
|
+
distances = cdist(Unknown_best_Y, Known_best_Y)
|
|
153
|
+
else:
|
|
154
|
+
distances = cdist(Unknown_best_Y, np.append(Known_best_Y, added_points_Y, axis=0))
|
|
155
|
+
|
|
156
|
+
max_distance_index = np.argmax(np.min(distances, axis=1))
|
|
157
|
+
|
|
158
|
+
added_point = Unknown_best_Y[max_distance_index]
|
|
159
|
+
added_points_Y.append(added_point)
|
|
160
|
+
added_points_X.append(Unknown_best_X[max_distance_index])
|
|
161
|
+
Known_best_Y = np.append(Known_best_Y, [added_point], axis=0)
|
|
162
|
+
|
|
163
|
+
Unknown_best_Y = np.delete(Unknown_best_Y, max_distance_index, axis=0)
|
|
164
|
+
Unknown_best_X = np.delete(Unknown_best_X, max_distance_index, axis=0)
|
|
165
|
+
|
|
166
|
+
BestX = np.copy(np.array(added_points_X))
|
|
167
|
+
BestY = np.copy(np.array(added_points_Y))
|
|
168
|
+
bestOff = Population(decs = BestX, objs = BestY)
|
|
169
|
+
|
|
170
|
+
self.evaluate(bestOff)
|
|
171
|
+
pop.add(bestOff)
|
|
172
|
+
self.record(pop)
|
|
173
|
+
|
|
174
|
+
return self.result
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#multiobjective evolutionary algorithm based on decomposition (MOEAD) <Multi>
|
|
2
2
|
import numpy as np
|
|
3
3
|
import math
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import Literal
|
|
5
5
|
from scipy.spatial import distance
|
|
6
6
|
|
|
7
7
|
from ..algorithmABC import Algorithm
|
|
8
8
|
from ..population import Population
|
|
9
|
-
from ..utility_functions import uniformPoint,
|
|
9
|
+
from ..utility_functions import uniformPoint, NDSort
|
|
10
|
+
from ..utility_functions.operation_GA import operationGAHalf
|
|
10
11
|
from ...utility import Verbose
|
|
11
12
|
class MOEAD(Algorithm):
|
|
12
13
|
'''
|
|
@@ -37,89 +38,93 @@ class MOEAD(Algorithm):
|
|
|
37
38
|
the maximum number of iterations
|
|
38
39
|
'''
|
|
39
40
|
|
|
40
|
-
name="
|
|
41
|
+
name="MOEA_D"
|
|
41
42
|
type="MOEA"
|
|
42
43
|
|
|
43
44
|
def __init__(self, aggregation: Literal['PBI', 'TCH', 'TCH_N', 'TCH_M']= 'PBI',
|
|
44
|
-
|
|
45
|
+
nPop: int=50,
|
|
45
46
|
maxFEs: int = 50000,
|
|
46
47
|
maxIterTimes: int = 1000,
|
|
47
48
|
maxTolerateTimes=None, tolerate=1e-6,
|
|
48
|
-
verbose=True, verboseFreq=10, logFlag=True, saveFlag=
|
|
49
|
+
verbose=True, verboseFreq=10, logFlag=True, saveFlag=True):
|
|
50
|
+
|
|
49
51
|
#problem setting
|
|
50
52
|
super().__init__(maxFEs, maxIterTimes, maxTolerateTimes, tolerate, verbose, verboseFreq, logFlag, saveFlag)
|
|
51
53
|
|
|
52
54
|
self.setParameters('aggregation', aggregation)
|
|
53
|
-
self.setParameters('nInit', nInit)
|
|
54
55
|
self.setParameters('nPop', nPop)
|
|
55
56
|
|
|
57
|
+
|
|
56
58
|
#-------------------Public Functions-----------------------#
|
|
57
59
|
@Verbose.decoratorRun
|
|
58
60
|
@Algorithm.initializeRun
|
|
59
|
-
def run(self, problem
|
|
61
|
+
def run(self, problem):
|
|
60
62
|
|
|
61
63
|
#Parameter Setting
|
|
62
64
|
aggregation=self.getParaValue('aggregation')
|
|
63
|
-
|
|
65
|
+
nPop=self.getParaValue('nPop')
|
|
66
|
+
|
|
64
67
|
#Problem
|
|
65
68
|
self.setProblem(problem)
|
|
69
|
+
|
|
66
70
|
#Termination Condition Setting
|
|
67
71
|
self.FEs=0; self.iters=0
|
|
68
|
-
#Population Generation
|
|
69
|
-
if xInit is not None:
|
|
70
|
-
pop = Population(xInit, yInit) if yInit is not None else Population(xInit)
|
|
71
|
-
if yInit is None:
|
|
72
|
-
self.evaluate(pop)
|
|
73
|
-
else:
|
|
74
|
-
pop = self.initialize(nInit)
|
|
75
|
-
|
|
76
|
-
pop=pop.getTop(nPop)
|
|
77
72
|
|
|
78
73
|
T = math.ceil(nPop / 10)
|
|
79
|
-
W, N=uniformPoint(nPop, problem.nOutput)
|
|
74
|
+
W, N = uniformPoint(nPop, problem.nOutput)
|
|
75
|
+
|
|
76
|
+
nPop = N
|
|
80
77
|
|
|
81
|
-
B=distance.cdist(W, W, metric='euclidean')
|
|
82
|
-
B=np.argsort(B, axis=1)
|
|
83
|
-
B=B[:,0:T]
|
|
78
|
+
B = distance.cdist(W, W, metric='euclidean')
|
|
79
|
+
B = np.argsort(B, axis=1)
|
|
80
|
+
B = B[:,0:T]
|
|
84
81
|
|
|
85
|
-
|
|
82
|
+
#Population Generation
|
|
83
|
+
pop = self.initialize(nPop)
|
|
86
84
|
|
|
85
|
+
Z = np.min(pop.objs, axis=0).reshape(1,-1)
|
|
86
|
+
|
|
87
87
|
while self.checkTermination():
|
|
88
|
-
|
|
88
|
+
|
|
89
|
+
for i in range(nPop):
|
|
89
90
|
|
|
90
91
|
P = B[i, np.random.permutation(B.shape[1])].ravel()
|
|
91
92
|
|
|
92
|
-
offspring=operationGAHalf(pop[P[0:2]], problem.ub, problem.lb, 1, 20, 1, 20)
|
|
93
|
+
offspring = operationGAHalf(pop[P[0:2]], problem.ub, problem.lb, 1, 20, 1, 20)
|
|
94
|
+
|
|
93
95
|
self.evaluate(offspring)
|
|
94
96
|
|
|
95
|
-
Z=np.min(np.vstack((Z, offspring.objs)), axis=0).reshape(1, -1)
|
|
97
|
+
Z = np.min(np.vstack((Z, offspring.objs)), axis=0).reshape(1, -1)
|
|
98
|
+
|
|
99
|
+
popObjs = pop.objs[P]
|
|
100
|
+
offspringObjs = offspring.objs
|
|
96
101
|
|
|
97
102
|
#PBI
|
|
98
103
|
if(aggregation=='PBI'):
|
|
99
104
|
|
|
100
105
|
normW = np.sqrt(np.sum(W[P, :]**2, axis=1))
|
|
101
|
-
normP = np.sqrt(np.sum((
|
|
102
|
-
normO = np.sqrt(np.sum((
|
|
106
|
+
normP = np.sqrt(np.sum((popObjs - np.tile(Z, (T, 1)))**2, axis=1))
|
|
107
|
+
normO = np.sqrt(np.sum((offspringObjs - Z)**2, axis=1))
|
|
103
108
|
CosineP = np.sum((pop.objs[P] - np.tile(Z, (T, 1))) * W[P, :], axis=1) / normW / normP
|
|
104
|
-
CosineO = np.sum(np.tile(
|
|
109
|
+
CosineO = np.sum(np.tile(offspringObjs - Z, (T, 1)) * W[P, :], axis=1) / normW / normO
|
|
105
110
|
g_old = normP * CosineP + 5 * normP * np.sqrt(1 - CosineP**2)
|
|
106
111
|
g_new = normO * CosineO + 5 * normO * np.sqrt(1 - CosineO**2)
|
|
107
112
|
|
|
108
113
|
elif(aggregation=='TCH'):
|
|
109
114
|
|
|
110
|
-
g_old = np.max(np.abs(
|
|
111
|
-
g_new = np.max(np.tile(np.abs(
|
|
115
|
+
g_old = np.max(np.abs(popObjs - np.tile(Z, (T, 1))) * W[P, :], axis=1)
|
|
116
|
+
g_new = np.max(np.tile(np.abs(offspringObjs- Z), (T, 1)) * W[P, :], axis=1)
|
|
112
117
|
|
|
113
118
|
elif(aggregation=='TCH_N'):
|
|
114
119
|
|
|
115
120
|
Zmax = np.max(pop.objs, axis=0)
|
|
116
|
-
g_old = np.max(np.abs(
|
|
117
|
-
g_new = np.max(np.tile(np.abs(
|
|
121
|
+
g_old = np.max(np.abs(popObjs - np.tile(Z, (T, 1))) / np.tile(Zmax - Z, (T, 1)) * W[P, :], axis=1)
|
|
122
|
+
g_new = np.max(np.tile(np.abs(offspringObjs - Z) / (Zmax - Z), (T, 1)) * W[P, :], axis=1)
|
|
118
123
|
|
|
119
124
|
elif(aggregation=='TCH_M'):
|
|
120
125
|
|
|
121
|
-
g_old = np.max(np.abs(
|
|
122
|
-
g_new = np.max(np.tile(np.abs(
|
|
126
|
+
g_old = np.max(np.abs(popObjs - np.tile(Z, (T, 1))) / W[P, :], axis=1)
|
|
127
|
+
g_new = np.max(np.tile(np.abs(offspringObjs - Z), (T, 1)) / W[P, :], axis=1)
|
|
123
128
|
|
|
124
129
|
pop.replace(P[g_old >= g_new], offspring)
|
|
125
130
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# Non-dominated Sorting Genetic Algorithm II (NSGA-II) <Multi>
|
|
2
2
|
import numpy as np
|
|
3
|
-
import math
|
|
4
|
-
from typing import Optional
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
from
|
|
4
|
+
|
|
5
|
+
from ..utility_functions import NDSort, crowdingDistance, tournamentSelection
|
|
6
|
+
from ..utility_functions.operation_GA import operationGA
|
|
7
|
+
|
|
8
8
|
from ..algorithmABC import Algorithm
|
|
9
9
|
from ..population import Population
|
|
10
|
-
from ...problems import ProblemABC as Problem
|
|
11
10
|
from ...utility import Verbose
|
|
12
11
|
class NSGAII(Algorithm):
|
|
13
12
|
'''
|
|
@@ -53,11 +52,11 @@ class NSGAII(Algorithm):
|
|
|
53
52
|
type = "MOEA"
|
|
54
53
|
|
|
55
54
|
def __init__(self, proC: float=1.0, disC: float=20.0, proM: float=1.0, disM: float=20.0,
|
|
56
|
-
|
|
55
|
+
nPop: int =50,
|
|
57
56
|
maxFEs: int = 50000,
|
|
58
57
|
maxIterTimes: int = 1000,
|
|
59
58
|
maxTolerateTimes=None, tolerate=1e-6,
|
|
60
|
-
verbose=True, verboseFreq=10, logFlag=True, saveFlag=
|
|
59
|
+
verbose=True, verboseFreq=10, logFlag=True, saveFlag=True):
|
|
61
60
|
|
|
62
61
|
super().__init__(maxFEs, maxIterTimes, maxTolerateTimes, tolerate, verbose, verboseFreq, logFlag, saveFlag)
|
|
63
62
|
|
|
@@ -65,30 +64,25 @@ class NSGAII(Algorithm):
|
|
|
65
64
|
self.setParameters('disC', disC)
|
|
66
65
|
self.setParameters('proM', proM)
|
|
67
66
|
self.setParameters('disM', disM)
|
|
68
|
-
self.setParameters('nInit', nInit)
|
|
69
67
|
self.setParameters('nPop', nPop)
|
|
70
68
|
|
|
71
69
|
#-------------------------Public Functions------------------------#
|
|
72
70
|
@Verbose.decoratorRun
|
|
73
71
|
@Algorithm.initializeRun
|
|
74
|
-
def run(self, problem
|
|
72
|
+
def run(self, problem):
|
|
75
73
|
|
|
76
74
|
#Parameter Setting
|
|
77
75
|
proC, disC, proM, disM=self.getParaValue('proC', 'disC', 'proM', 'disM')
|
|
78
|
-
|
|
76
|
+
nPop=self.getParaValue('nPop')
|
|
77
|
+
|
|
79
78
|
#Problem
|
|
80
79
|
self.setProblem(problem)
|
|
80
|
+
|
|
81
81
|
#Termination Condition Setting
|
|
82
82
|
self.FEs=0; self.iters=0
|
|
83
|
+
|
|
83
84
|
#Population Generation
|
|
84
|
-
|
|
85
|
-
pop = Population(xInit, yInit) if yInit is not None else Population(xInit)
|
|
86
|
-
if yInit is None:
|
|
87
|
-
self.evaluate(pop)
|
|
88
|
-
else:
|
|
89
|
-
pop = self.initialize(nInit)
|
|
90
|
-
|
|
91
|
-
pop=pop.getTop(nPop)
|
|
85
|
+
pop = self.initialize(nPop)
|
|
92
86
|
|
|
93
87
|
_, frontNo, CrowdDis=self.environmentalSelection(pop, nPop)
|
|
94
88
|
|