moptipy.algorithms.so.fitnesses package¶
Fitness assignment processes.
Fitness assignment processes are modules of the fully-configurable Evolutionary Algorithm Direct fitness assignment uses the objective values directly as fitness. Together with fitness proportionate selection ( John Henry Holland. Adaptation in Natural and Artificial Systems: An Introductory Analysis with Applications to Biology, Control, and Artificial Intelligence. Ann Arbor, MI, USA: University of Michigan Press. 1975. ISBN: 0-472-08460-7 David Edward Goldberg. Genetic Algorithms in Search, Optimization, and Machine Learning. Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc. 1989. ISBN: 0-201-15767-5 Bases: Objective values are used as fitness directly. This is the most primitive and basic fitness assignment strategy. It does not give preference to new solutions over old solutions if both have the same objective value. In this, it is different from A fitness representing the rank of a solution based on its quality. First, all solutions are sorted based on their objective values. Then, they receive their rank, i.e., index+1 in the sorted list, as fitness. If two elements have the same objective value, they also receive the same rank. This rank will be the index+1 of the first element. Together with fitness proportionate selection ( L. Darrell Whitley. The GENITOR Algorithm and Selection Pressure: Why Rank-Based Allocation of Reproductive Trials is Best. In J. David Schaffer, ed., Proceedings of the 3rd International Conference on Genetic Algorithms (ICGA’89), June 4-7, 1989, Fairfax, VA, USA, pages 116-121. San Francisco, CA, USA: Morgan Kaufmann Publishers Inc. ISBN: 1-55860-066-3 https://www.researchgate.net/publication/2527551 Tobias Blickle and Lothar Thiele. A Comparison of Selection Schemes used in Genetic Algorithms. Second edition, December 1995. TIK-Report 11 from the Eidgenössische Technische Hochschule (ETH) Zürich, Department of Electrical Engineering, Computer Engineering and Networks Laboratory (TIK), Zürich, Switzerland. ftp://ftp.tik.ee.ethz.ch/pub/publications/TIK-Report11.ps Bases: A fitness computing the rank of an individual based on its quality. Assign the rank as fitness. A fitness combining the rank of a solution with the iteration of its creation. This fitness assignment process is compatible with the simple (mu+lambda) Evolutionary Algorithm implemented in Bases: A fitness joining objective rank and creation iteration. The fitness assignment strategy will use two pieces of information to determine the fitness of a solution: the rank the solutions by their objective values ( the iteration index ( It will multiply the rank of the solution with the range of the iteration index in the population and then add the maximum iteration index minus the iteration index of the solution, i.e., fitness(x) = rank(f(x)) * (max_it - min_it + 1) + (max_it - it(x)) This way, better solutions receive better fitness and ties are broken such that younger solutions (with higher iteration index) are preferred. In combination with best selection (GeneralEA
. The transform objective values to scalar fitness values that are then used by Selection
algorithms.Submodules¶
moptipy.algorithms.so.fitnesses.direct module¶
FitnessProportionateSUS
), it turns an EA (GeneralEA
) to a minimization variant of the traditional Genetic Algorithms.Fitness
RankAndIteration
, which is the default fitness assignment strategy. It is therefore also not compatible to our basic (mu+lambda) Evolutionary Algorithm implementation (EA
).moptipy.algorithms.so.fitnesses.rank module¶
>>> # The first value in FRecord(x, y) is the solution, which is not matter
>>> # here. The second value is the objective value used for ranking.
>>> l = [FRecord(1, 10), FRecord(2, 3), FRecord(3, 3), FRecord(4, 2)]
>>> from numpy.random import default_rng
>>> Rank().assign_fitness(l, default_rng())
>>> for z in l:
... print(f"x={z.x}, fitness={z.fitness}")
x=4, fitness=1
x=2, fitness=2
x=3, fitness=2
x=1, fitness=4
FitnessProportionateSUS
), it works very similar to linear ranking selection in an EA (GeneralEA
).Fitness
>>> l = [FRecord(0, 10), FRecord(1, 5), FRecord(2, 5), FRecord(3, -1)]
>>> from numpy.random import default_rng
>>> Rank().assign_fitness(l, default_rng())
>>> l[0].x
3
>>> l[0].fitness
1
>>> l[1].x
1
>>> l[1].fitness
2
>>> l[2].x
2
>>> l[2].fitness
2
>>> l[3].x
0
>>> l[3].fitness
4
moptipy.algorithms.so.fitnesses.rank_and_iteration module¶
EA
. It will assign a better fitness to a solution which has a better objective value. Ties will be broken based on the iteration counter it
of the solution records Record
.Fitness
f
). If two solutions have the same fitness, they get the same rank, but the next-worst solution will then get a rank with is larger by 2.it
) relative to the maximum and minimum iteration index.moptipy.algorithms.modules.selections.best.Best
), this replicates the behavior of our simple (mu+lambda) Evolutionary Algorithm (EA
).