diff --git a/README.md b/README.md index 8556259..fef67d9 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,6 @@ print("Best solution:", result[1], "\nBest solution chromosome:", result[0]) # Best solution: 0.0 # Best solution chromosome: [0.0, 0.0, 0.0, 0.0, 0.0] -# Note that the result could be different because the algorithm includes randomness. ``` We have provided a basic example above. If you're interested in exploring more examples, you have two options: diff --git a/paper/paper.md b/paper/paper.md index f2de256..c3e6320 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -114,7 +114,6 @@ print("Best solution:", result[1], "\nBest solution chromosome:", result[0]) # Best solution: 0.0 # Best solution chromosome: [0.0, 0.0, 0.0, 0.0, 0.0] -# Note that the result could be different because the algorithm includes randomness. ``` diff --git a/pycellga/optimizer.py b/pycellga/optimizer.py index 1254aa0..48e29df 100644 --- a/pycellga/optimizer.py +++ b/pycellga/optimizer.py @@ -49,7 +49,8 @@ from typing import Callable, List, Tuple from collections.abc import Callable - +np.random.seed(100) +random.seed(100) def cga( n_cols: int,