Skip to content

Evolution + Heuristics#1

Draft
Adam-Powley wants to merge 2 commits into
mainfrom
02-20-demo_0401751a_add_activity_feed_api
Draft

Evolution + Heuristics#1
Adam-Powley wants to merge 2 commits into
mainfrom
02-20-demo_0401751a_add_activity_feed_api

Conversation

@Adam-Powley

Copy link
Copy Markdown
Owner

Evolution + Heuristics

More development into evolutionary operators such as deterministic crowding, island distributions, and more fitness metrics such as 2d images from morphogen gradients, entropy maximization, and frequency fitting. Also added entropy metrics and fourier decomposition of chemical kinetics in editor window

Add activity feed API

More development into evolutionary operators such as deterministic crowding, island distributions, and more fitness metrics such as 2d images from morphogen gradients, entropy maximization, and frequency fitting. Also added entropy metrics and fourier decomposition of chemical kinetics in editor window

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment thread Entropy.py
Comment on lines +222 to +225
def series_entropy(series, decimals = 0):
p = np.unique(np.round(series, decimals=decimals), return_counts=True)[1] / series.size
entr = (-p*np.log(p)).sum()
return entr

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new series_entropy function shadows the renamed symbol_entropy function (line 101), but code in Display.py (line 247) and GRN_analysis.py (line 528) still calls series_entropy expecting the symbol-based entropy calculation. The new function computes a different type of entropy (continuous data entropy) which will produce incorrect results for symbol sequences.

Impact: Heuristics and analysis will return wrong entropy values, breaking the evolutionary fitness calculations.

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment thread Agent.py
Comment on lines +512 to +516
if index >= self.gene_volume:
return
if random() < rate:
self.gene_volume -= 1
del self.gene_strings[index]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete_gene method modifies the list while potentially iterating over it in the caller (line 524-526). When a gene is deleted at index i, all subsequent indices shift, but the loop continues with the next index, potentially skipping genes or causing index out of bounds errors.

Fix: Iterate in reverse order or collect indices to delete first:

def mutate_genome(self, mutation_rate, dup_rate, del_rate):
    for i in range(self.gene_volume):
        self.mutate_gene(i, mutation_rate)
    for i in range(self.gene_volume):
        self.duplicate_gene(i, dup_rate)
    # Iterate in reverse to avoid index shifting issues
    for i in range(self.gene_volume - 1, -1, -1):
        if self.gene_volume > self.signal_vol + self.target_vol:
            self.delete_gene(i, del_rate)
    return self

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant