Skip to content

Commit

Permalink
docs: set up initial point #54 #58
Browse files Browse the repository at this point in the history
  • Loading branch information
guofei9987 committed Jun 6, 2020
1 parent 6492a68 commit 9884eff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/en/more_ga.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()`
9 changes: 9 additions & 0 deletions docs/zh/more_ga.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()` 来更新历史最优点

1 comment on commit 9884eff

@grant36x
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ga.Chrom = np.random.randint(0,2,size=(80,20))
这里的80和20,分别表示什么意思?

Please sign in to comment.