Skip to content

Commit

Permalink
Merge pull request #155 from JanisHe/bugfix/ordinal_parameters
Browse files Browse the repository at this point in the history
added if clause for more than two given ordinal parameters
  • Loading branch information
oskar-taubert authored Sep 12, 2024
2 parents 061975a + 5dbb8fc commit fe56ff7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion propulate/propagators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,10 @@ def __call__(self, *inds: Individual) -> Individual: # type: ignore[override]
if isinstance(
self.limits[limit][0], int
): # If ordinal trait of type integer.
position[limit] = self.rng.randint(*self.limits[limit])
if len(self.limits[limit]) == 2: # Selecting one value in range of ordinal parameter
position[limit] = self.rng.randint(*self.limits[limit])
else: # Selecting one distinct value from ordinal parameters
position[limit] = self.rng.choice(self.limits[limit])
elif isinstance(
self.limits[limit][0], float
): # If interval trait of type float.
Expand Down

0 comments on commit fe56ff7

Please sign in to comment.