From 9884eff83fb92b1bc7f3cc4381c00cf2bf81f2a8 Mon Sep 17 00:00:00 2001 From: guofei Date: Sun, 7 Jun 2020 06:52:33 +0800 Subject: [PATCH] docs: set up initial point #54 #58 --- docs/en/more_ga.md | 9 +++++++++ docs/zh/more_ga.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/en/more_ga.md b/docs/en/more_ga.md index 7ee9200..58d780f 100644 --- a/docs/en/more_ga.md +++ b/docs/en/more_ga.md @@ -70,3 +70,12 @@ plt.show() ``` ![image](https://user-images.githubusercontent.com/19920283/83831463-0ac6a400-a71a-11ea-8692-beac5f465111.png) + +For more information, click [here](https://github.com/guofei9987/scikit-opt/issues/58) + +## How to set up starting point or initial population + +- For `GA`, after `ga=GA(**params)`, use codes like `ga.Chrom = np.random.randint(0,2,size=(80,20))` to manually set the initial population. +- For `DE`, set `de.X` to your initial X. +- For `SA`, there is a parameter `x0`, which is the init point. +- For `PSO`, set `pso.X` to your initial X, and run `pso.cal_y(); pso.update_gbest(); pso.update_pbest()` diff --git a/docs/zh/more_ga.md b/docs/zh/more_ga.md index 70a8740..9d34389 100644 --- a/docs/zh/more_ga.md +++ b/docs/zh/more_ga.md @@ -71,3 +71,12 @@ plt.show() ``` ![image](https://user-images.githubusercontent.com/19920283/83831463-0ac6a400-a71a-11ea-8692-beac5f465111.png) + +更多说明,[这里](https://github.com/guofei9987/scikit-opt/issues/58) + +## 如何设定初始点或初始种群 + +- 对于遗传算法 `GA`, 运行 `ga=GA(**params)` 生成模型后,赋值设定初始种群,例如 `ga.Chrom = np.random.randint(0,2,size=(80,20))` +- 对于查分进化算法 `DE`,设定 `de.X` 为初始 X. +- 对于模拟退火算法 `SA`,入参 `x0` 就是初始点. +- 对于粒子群算法 `PSO`,手动赋值 `pso.X` 为初始 X, 然后执行 `pso.cal_y(); pso.update_gbest(); pso.update_pbest()` 来更新历史最优点