Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused function _is_active_input_gene #211

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions cgp/genome.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,20 +336,6 @@ def _is_function_gene(self, gene_idx: int) -> bool:
def _is_hidden_input_gene(self, gene_idx: int, region_idx: int) -> bool:
return self._is_hidden_region(region_idx) & ((gene_idx % self._length_per_region) != 0)

def _is_active_input_gene(self, gene_idx: int) -> bool:
input_index = gene_idx % self._length_per_region
assert input_index > 0
region_idx = gene_idx // self._length_per_region
if self._is_input_region(region_idx):
return False
elif self._is_hidden_region(region_idx):
node_arity = self._primitives[self.dna[region_idx * self._length_per_region]]._arity
return input_index <= node_arity
elif self._is_output_region(region_idx):
return input_index == 1
else:
assert False # should never be reached

def _select_gene_indices_for_mutation(
self, mutation_rate: float, rng: np.random.RandomState
) -> List[int]:
Expand Down