Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 0 additions & 17 deletions .github/workflows/python-lint.yml

This file was deleted.

8 changes: 0 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ source env/bin/activate # On Windows: env\Scripts\activate
pip install -e ".[dev]"
```

## Code Style

We follow the [Black](https://black.readthedocs.io/) code style. Please format your code before submitting a pull request:

```bash
black openevolve tests examples
```

## Pull Request Process

1. Create a new branch for your feature or bugfix: `git checkout -b feat-your-feature-name`
Expand Down
37 changes: 31 additions & 6 deletions openevolve/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,13 +662,38 @@ def _update_archive(self, program: Program) -> None:
self.archive.add(program.id)
return

# Otherwise, find worst program in archive
archive_programs = [self.programs[pid] for pid in self.archive]
worst_program = min(archive_programs, key=lambda p: safe_numeric_average(p.metrics))
# Clean up stale references and get valid archive programs
valid_archive_programs = []
stale_ids = []

# Replace if new program is better
if self._is_better(program, worst_program):
self.archive.remove(worst_program.id)
for pid in self.archive:
if pid in self.programs:
valid_archive_programs.append(self.programs[pid])
else:
stale_ids.append(pid)

# Remove stale references from archive
for stale_id in stale_ids:
self.archive.discard(stale_id)
logger.debug(f"Removing stale program {stale_id} from archive")

# If archive is now not full after cleanup, just add the new program
if len(self.archive) < self.config.archive_size:
self.archive.add(program.id)
return

# Find worst program among valid programs
if valid_archive_programs:
worst_program = min(
valid_archive_programs, key=lambda p: safe_numeric_average(p.metrics)
)

# Replace if new program is better
if self._is_better(program, worst_program):
self.archive.remove(worst_program.id)
self.archive.add(program.id)
else:
# No valid programs in archive, just add the new one
self.archive.add(program.id)

def _update_best_program(self, program: Program) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "openevolve"
version = "0.0.3"
version = "0.0.4"
description = "Open-source implementation of AlphaEvolve"
readme = "README.md"
requires-python = ">=3.9"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="openevolve",
version="0.0.3",
version="0.0.4",
packages=find_packages(),
include_package_data=True,
)