File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 11"""Did you know that Genetic Algorithms can be used to quickly approximate
22combinatorial optimization problems such as knapsack?
33
4+ Genetic algorithms: https://en.wikipedia.org/wiki/Genetic_algorithm
5+ Evolutionary computation: https://en.wikipedia.org/wiki/Evolutionary_computation
6+ Knapsack problem: https://en.wikipedia.org/wiki/Knapsack_problem
7+
48Run doctests:
5- python -m doctest -v ga_knapsack .py
9+ python -m doctest -v knapsack .py
610"""
711
812import random
913from dataclasses import dataclass
1014
11- # Keep module-level RNG deterministic for examples that rely on random,
12- # but individual doctests re-seed locally as needed.
1315random .seed (42 )
1416
1517# =========================== Problem setup: Knapsack ===========================
You can’t perform that action at this time.
0 commit comments