From 3dbc68a6671cf7ed88f2d9bcf616e6698f614950 Mon Sep 17 00:00:00 2001 From: SimpleArt <71458112+SimpleArt@users.noreply.github.com> Date: Sun, 13 Dec 2020 11:36:13 -0500 Subject: [PATCH] Extended to allow selection probabilities of 0 or 1 --- src/parent_selection/parent_selection_methods.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parent_selection/parent_selection_methods.py b/src/parent_selection/parent_selection_methods.py index 9f591d9..fc2396a 100644 --- a/src/parent_selection/parent_selection_methods.py +++ b/src/parent_selection/parent_selection_methods.py @@ -2,12 +2,12 @@ import random def _check_selection_probability(selection_method): """Raises an exception if the selection_probability - is not between 0 and 1. Otherwise runs the selection - method. + is not between 0 and 1 inclusively. Otherwise runs + the selection method. """ def new_method(ga): - if 0 < ga.selection_probability < 1: + if 0 <= ga.selection_probability <= 1: selection_method(ga) else: raise Exception("Selection probability must be between 0 and 1 to select parents.")