广义模式搜索 (GPS)
- class pypop7.optimizers.ds.gps.GPS(problem, options)[源代码]
广义模式搜索 (GPS)。
- 参数:
problem (dict) –
- 问题参数,包含以下通用设置 (键)
'fitness_function' - 需要被最小化的目标函数 (func),
'ndim_problem' - 维度数量 (int),
'upper_boundary' - 搜索范围的上边界 (array_like),
'lower_boundary' - 搜索范围的下边界 (array_like).
options (dict) –
- 优化器选项,包含以下通用设置 (键)
'max_function_evaluations' - 函数评估的最大次数 (int, 默认: np.inf),
'max_runtime' - 允许的最大运行时间 (float, 默认: np.inf),
'seed_rng' - 随机数生成器的种子,需要明确设置 (int);
- 以及以下特定设置 (键)
'sigma' - 初始全局步长(浮点数,默认值:1.0),
“x”- 初始(起始)点 (array_like),
如果未给出,它将从一个均匀分布中随机抽样,该分布的搜索范围由 problem[‘lower_boundary’] 和 problem[‘upper_boundary’] 界定。
'gamma' - 步长缩减因子(浮点数,默认值:0.5)。
示例
使用优化器最小化著名的测试函数 Rosenbrock
1>>> import numpy 2>>> from pypop7.benchmarks.base_functions import rosenbrock # function to be minimized 3>>> from pypop7.optimizers.ds.gps import GPS 4>>> problem = {'fitness_function': rosenbrock, # define problem arguments 5... 'ndim_problem': 2, 6... 'lower_boundary': -5*numpy.ones((2,)), 7... 'upper_boundary': 5*numpy.ones((2,))} 8>>> options = {'max_function_evaluations': 5000, # set optimizer options 9... 'seed_rng': 2022, 10... 'x': 3*numpy.ones((2,)), 11... 'sigma': 0.1, 12... 'verbose_frequency': 500} 13>>> gps = GPS(problem, options) # initialize the optimizer class 14>>> results = gps.optimize() # run the optimization process 15>>> # return the number of function evaluations and best-so-far fitness 16>>> print(f"GPS: {results['n_function_evaluations']}, {results['best_so_far_y']}") 17GPS: 5000, 0.6182686369768672
- gamma
步长缩减因子。
- 类型:
float
- sigma
最终的全局步长(在优化过程中会改变)。
- 类型:
float
- x
初始(起始)点。
- 类型:
array_like
参考文献
Kochenderfer, M.J. and Wheeler, T.A., 2019. Algorithms for optimization. MIT Press. https://algorithmsbook.com/optimization/files/chapter-7.pdf (详情参见算法 7.6(第 106 页))
Regis, R.G., 2016. On the properties of positive spanning sets and positive bases. Optimization and Engineering, 17(1), pp.229-262. https://link.springer.com/article/10.1007/s11081-015-9286-x
Torczon, V., 1997. On the convergence of pattern search algorithms. SIAM Journal on Optimization, 7(1), pp.1-25. https://epubs.siam.org/doi/abs/10.1137/S1052623493250780