Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93337d2

Browse files
Edit documentation string
1 parent aa49af7 commit 93337d2

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

‎pygad/helper/unique.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,19 @@ def unique_int_gene_from_range(self,
174174
step=1):
175175

176176
"""
177-
Finds a unique integer value for the gene.
178-
179-
solution: A solution with duplicate values.
180-
gene_index: Index of the gene to find a unique value.
181-
min_val: Minimum value of the range to sample a number randomly.
182-
max_val: Maximum value of the range to sample a number randomly.
183-
mutation_by_replacement: Identical to the self.mutation_by_replacement attribute.
184-
gene_type: Exactly the same as the self.gene_type attribute.
185-
step: Defaults to 1.
177+
Finds a unique integer value for a specific gene in a solution.
178+
179+
Args:
180+
solution (list): A solution containing genes, potentially with duplicate values.
181+
gene_index (int): The index of the gene for which to find a unique value.
182+
min_val (int): The minimum value of the range to sample a number randomly.
183+
max_val (int): The maximum value of the range to sample a number randomly.
184+
mutation_by_replacement (bool): Indicates if mutation is performed by replacement.
185+
gene_type (type): The data type of the gene (e.g., int, float).
186+
step (int, optional): The step size for generating candidate values. Defaults to 1.
186187
187188
Returns:
188-
selected_value: The new value of the gene. It may be identical to the original gene value in case there are no possible unique values for the gene.
189+
int: The new value of the gene. If no unique value can be found, the original gene value is returned.
189190
"""
190191

191192
# The gene_type is of the form [type, precision]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /