We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 319a38f commit 5ced3feCopy full SHA for 5ced3fe
1 file changed
genetic_algorithm/knapsack.py
@@ -1,15 +1,17 @@
1
"""Did you know that Genetic Algorithms can be used to quickly approximate
2
combinatorial optimization problems such as knapsack?
3
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
+
8
Run doctests:
- python -m doctest -v ga_knapsack.py
9
+ python -m doctest -v knapsack.py
10
"""
11
12
import random
13
from dataclasses import dataclass
14
-# Keep module-level RNG deterministic for examples that rely on random,
-# but individual doctests re-seed locally as needed.
15
random.seed(42)
16
17
# =========================== Problem setup: Knapsack ===========================
0 commit comments