Skip to content

Commit

Permalink
Make sure permissible_values is a list of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobj committed Mar 29, 2024
1 parent 3351014 commit 6ec03be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cgp/genome.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def determine_permissible_values(self) -> List[np.ndarray]:
def _determine_permissible_values_input_region(self, gene_idx: int) -> np.ndarray:

if self._is_function_gene(gene_idx):
return np.array(self._id_input_node)
return np.array([self._id_input_node])
else:
return np.array(self._id_unused_gene)
return np.array([self._id_unused_gene])

def _determine_permissible_values_hidden_region(
self, gene_idx: int, region_idx: int
Expand All @@ -206,13 +206,13 @@ def _determine_permissible_values_hidden_region(
def _determine_permissible_values_output_region(self, gene_idx: int) -> np.ndarray:

if self._is_function_gene(gene_idx):
return np.array(self._id_output_node)
return np.array([self._id_output_node])
else:
address_idx = gene_idx % self._length_per_region - 1
if address_idx == 0:
return np.array(self._permissible_addresses_for_output_region())
else:
return np.array(self._id_unused_gene)
return np.array([self._id_unused_gene])

def _create_input_region(self) -> List[int]:

Expand Down

0 comments on commit 6ec03be

Please sign in to comment.