Evolutionary Tools
The tools module contains the operators for evolutionary algorithms. They are used to modify, select and move the individuals in their environment. The set of operators it contains are readily usable in the Toolbox. In addition to the basic operators this module also contains utility tools to enhance the basic algorithms with Statistics, HallOfFame, and History.
tools模块中toolbox里面包含遗传算法的操作算子,可以用来选择个体、使个体发生变异或者直接删除个体,另外还有一些基本操作在Statistics、HallOfFame和History里面。
Operators
The operator set does the minimum job for transforming or selecting individuals. This means, for example, that providing two individuals to the crossover will transform those individuals in-place. The responsibility of making offspring(s) independent of their parent(s) and invalidating the fitness is left to the user and is generally fulfilled in the algorithms by calling toolbox.clone() on an individual to duplicate it and del on the values attribute of the individual’s fitness to invalidate it.
Here is a list of the implemented operators in DEAP,
下面是DEAP里面内的操作算子,看起来很强大...怎么用还是慢慢摸索吧....
and genetic programming specific operators.
| Initialization | Crossover | Mutation | Bloat control |
|---|---|---|---|
genFull() | cxOnePoint() | mutShrink() | staticLimit() |
genGrow() | cxOnePointLeafBiased() | mutUniform() | selDoubleTournament() |
genHalfAndHalf() | mutNodeReplacement() | ||
mutEphemeral() | |||
mutInsert() |
Initialization
-
Call the function container with a generator function corresponding to the calling n times the function func.
Parameters: - container – The type to put in the data from func.
- func – The function that will be called n times to fill the container.
- n – The number of times to repeat func.
Returns: An instance of the container filled with data from func.
This helper function can can be used in conjunction with a Toolbox to register a generator of filled containers, as individuals or population.
deap.tools.
initRepeat
(
container,
func,
n
)
>>> initRepeat(list, random.random, 2)
...
[0.4761..., 0.6302...]
deap.tools.
initIterate
(
container,
generator
)
Call the function container with an iterable as its only argument. The iterable must be returned by the method or the object generator.
| Parameters: |
|
|---|---|
| Returns: | An instance of the container filled with data from the generator. |
This helper function can can be used in conjunction with a Toolbox to register a generator of filled containers, as individuals or population.
看一天累了....未完待续....
本文介绍了DEAP库中的遗传算法工具箱,该工具箱提供了一系列用于选择、变异和迁移个体的操作算子,并包含了增强算法的实用工具。此外,文章还列举了多种初始化、交叉、变异等遗传操作的具体实现。
1330

被折叠的 条评论
为什么被折叠?



