pg.evolution.recombinators.WeightedAverage¶
Accessible via pg.evolution.recombinators.WeightedAverage
.
- class WeightedAverage(weights, where=All())[source]¶
Bases:
pg.evolution.recombinators.Numeric
Weighted-average crossover.
Similar as the Average crossover, a weighted-average crossover operates on all float decision points and carries over other parts of the chromosome from each parent to a child. Thus it produces the same number of children as the parents.
It uses formula cv[i] = sum(pw[j] * pv[j][i]) / sum(pw[j]) to compute the values for all or selected float points. cv[i] is the value of the i-th float point of the child DNA. pw[j] is the weight computed from the j-th parent, and pv[j][i] is the j-th parent’s value on the i-th float point.
References: https://link.springer.com/content/pdf/10.1007/s00500-006-0049-7.pdf
Methods:
merge
(decision_point, parent_decisions)Implementation of point-wise decision making.
- merge(decision_point, parent_decisions)[source]¶
Implementation of point-wise decision making.
- Return type:
- Parameters:
decision_point – Decision point for recombination.
parent_decisions – A list of parent’s decisions. Each item should be an int as an active single-choice decision, a list of int as active multi- choice decisions, a float as an active float decision, or None for inactive decision point (whose parent space is not chosen).
global_state – An optional keyword argument as the global state. Subclass can omit.
step – An optional keyword argument as the current step. Subclass can omit.
- Returns:
An int, list of int or float as the decision made for the decision point.