Skip to content

Releases: AlexanderGatesDev/biosimRust

1.0.7

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 09 Jan 01:16

BiosimRust v1.0.7

New Features

NEAT-Style Speciation

  • Added speciationenabled parameter to enable/disable speciation system
  • Implements NEAT (NeuroEvolution of Augmenting Topologies) compatibility distance algorithm
  • Groups organisms into species based on genetic similarity to protect innovative structures
  • Allows large genomes from duplication events to compete within their species rather than being outcompeted by lean ancestors
  • Includes species stagnation tracking and automatic extinction of non-improving species
  • Implements fitness sharing to prevent large species from dominating selection

Enhanced Epoch Logging

  • Extended epoch log format to include species statistics when speciation is enabled
  • New format: generation survivors diversity avg_genome_length murder_count num_species avg_species_size largest_species smallest_species new_species extinct_species avg_species_age avg_stagnation
  • Backward compatible: falls back to 5-column format when speciation is disabled
  • Enables detailed analysis of species dynamics over time

New Visualization Tools

  • Added graphlog-species.gp for visualizing species count alongside population metrics
  • Added graphlog-species-detailed.gp for comprehensive multi-panel species analysis
  • Both tools gracefully handle missing species statistics for backward compatibility

Configuration

New parameters in biosimrust.ini:

Speciation Control

  • speciationenabled - Enable/disable speciation system (true/false). Default: false
    • When enabled, organisms are grouped into species based on genetic compatibility
    • Protects innovative genome structures from premature elimination

Compatibility Distance Parameters

  • compatibilitythreshold - Maximum genetic distance for same species (0.1-100.0). Default: 3.0

    • Lower values create more species (more diversity protection)
    • Higher values create fewer species (less diversity protection)
    • Recommended: 1.5-2.5 for balanced speciation
    • Formula: δ = (c1E/N) + (c2D/N) + (c3*W) where E=excess, D=disjoint, W=weight diff, N=longer genome
    • Based on NEAT algorithm
  • excesscoefficient - Weight for excess genes in compatibility distance (0.0-10.0). Default: 1.0

  • disjointcoefficient - Weight for disjoint genes in compatibility distance (0.0-10.0). Default: 1.0

  • weightcoefficient - Weight for average weight difference in compatibility distance (0.0-10.0). Default: 0.4

Species Management Parameters

  • speciesstagnationthreshold - Generations without improvement before species extinction (1-1000). Default: 15

    • Higher values allow species to persist longer without improvement
    • Lower values more aggressively cull stagnant species
  • minspeciessize - Minimum members required to keep species alive (1-100). Default: 1

    • Allows small innovative species to survive
  • maxspeciessize - Maximum members per species, enforced by culling (1-10000). Default: 50

    • Prevents single species from dominating population
    • Recommended: 100-150 for larger populations
  • specieselitefraction - Fraction of species members preserved as elite (0.0-1.0). Default: 0.2

    • Top 20% of species members are preserved during culling

Technical Details

Speciation Algorithm

  • Based on NEAT algorithm (Stanley & Miikkulainen, 2002)
  • Genetic compatibility distance calculated using excess genes, disjoint genes, and weight differences
  • Species representatives updated periodically to track evolving populations
  • Fitness sharing divides individual fitness by species size to encourage diversity (NEAT fitness sharing)

Defensive Checks

  • Added species list overflow protection (prevents crashes from excessive species creation)
  • Corrupted statistics detection with automatic fallback to default values
  • Species ID overflow protection with automatic reset
  • All defensive checks log detailed error messages for debugging

Thread Safety

  • Species list protected by Mutex for thread-safe access across simulation threads
  • Species statistics calculated safely in multi-threaded environment

Compatibility

  • Fully backward compatible
  • Existing config files work without changes (speciation disabled by default)
  • Epoch log format automatically adapts based on speciation setting
  • Visualization tools handle both old (5-column) and new (13-column) log formats
  • No breaking changes to APIs or file formats

Bug Fixes

  • Fixed potential crash from excessive species creation (now capped at 10,000 with error logging)
  • Fixed corrupted species statistics from propagating to log files
  • Improved error messages for speciation-related issues

1.0.6

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 04 Jan 20:04
579f3d7

BiosimRust v1.0.6

New Features

Kin Protection for Kill Action

  • Added killkinprotection parameter (range 0.0-1.0) to reduce kill probability for genetically similar individuals
  • Uses exponential reduction formula: identical genomes have near-zero kill probability
  • Default value: 0.8 (strong protection)
  • Improves biological realism by reducing same-species killing

Challenge 3 (Neighbor Count) Improvements

  • Added buffer zone: individuals must be at least 2 cells from any edge to survive
  • Prevents edge huddling behavior and encourages clustering in arena interior
  • Improves challenge behavior and visual results

Configuration

New parameter in biosimrust.ini:

  • killkinprotection reduces the probability of killing genetically similar individuals.
    Range 0.0..1.0. Higher values = stronger protection against killing kin.
    • 0.0 = no protection (identical genomes can kill each other)
    • 1.0 = maximum protection (identical genomes never kill each other)
  • Formula: adjusted_kill_prob = base_kill_prob * (1.0 - genetic_similarity)^(1.0 / (killkinprotection + 0.1))
  • Recommended: 0.3 to 0.7 for biological realism. Default: 0.8
    killkinprotection = 0.8

Technical Details

  • Kin protection uses exponential reduction for stronger protection at high genetic similarity
  • Challenge 3 buffer zone enforces minimum distance from edges
  • Both changes improve biological realism and challenge behavior

Compatibility

  • Fully backward compatible
  • Existing config files work without changes (uses default killkinprotection = 0.8)
  • No breaking changes to APIs or file formats

1.0.5

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 03 Jan 05:15

BiosimRust v1.0.5

Performance Improvements

  • Major parallelization optimization: Replaced inefficient task-per-individual spawning with efficient parallel iterators using into_par_iter().for_each(). This provides a 2-3x speedup and better CPU utilization, bringing Rust performance much closer to the C++ version. The new implementation uses Rayon's work-stealing scheduler for optimal load distribution across CPU cores.

Features

  • Connection deduplication: Implemented automatic deduplication of neural network connections during genome-to-network conversion. Duplicate connections (same source-sink pairs) are now merged by summing their weights and clamping to i16 range. This prevents genomes from growing indefinitely by adding redundant connections, making evolution more biologically realistic. This addresses the issue where genomes could grow by simply duplicating existing connections without functional benefit.

Variable-Length Genome Stability

  • Enhanced fitness normalization: Increased default fitnesslengthnormalization from 0.01 to 0.03 to better prevent selection pressure favoring longer genomes. The normalization formula normalized_score = score / (1 + beta * genome_length) now applies a stronger penalty for longer genomes.

  • Strengthened length penalty weights: Updated genome similarity calculations to use a triple penalty system (30% similarity, 35% relative length ratio, 35% absolute length bonus) instead of the previous 40/30/30 split. This creates stronger selection pressure to maintain genome lengths near the initial value.

Technical Details

  • Changed parallelization from rayon::scope with individual task spawning to into_par_iter().for_each() for efficient work-stealing chunking
  • Updated default fitness_length_normalization parameter to 0.03 in code and config files
  • Added deduplicate_connections() function that merges duplicate source-sink pairs during neural network construction
  • Connection deduplication applies to both Rust and C++ versions for consistency

This release significantly improves simulation speed while enhancing variable-length genome stability and preventing artificial genome growth through redundant connections.

1.0.4

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 01 Jan 18:28

BiosimRust v1.0.4

Bug Fixes

  • Fixed KillForward action not executing: The KillForward action was incorrectly placed after NumActions in the enum, which meant it was never included in the active actions array. This has been fixed by moving KillForward before NumActions, allowing the kill action to function properly.

Configuration

  • Increased kill threshold: The kill action threshold has been increased from 0.5 to 0.95 to reduce excessive killing. This means only neural network outputs that normalize to above 95% can trigger kill attempts, making killing a more strategic and less frequent action.

Features

  • Kill genome action: Agents can now use the KillForward action to eliminate neighboring agents in the direction of forward movement. This feature is controlled by the killenable parameter in the config file (default: true).

1.0.3

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 01 Jan 01:00

BiosimRust v1.0.3

Bug Fixes

  • Genome comparison crash: Fixed assertion failure when comparing genomes of different lengths using Hamming distance methods. The simulator now automatically falls back to Jaro-Winkler distance when genomes have unequal lengths, preventing crashes when gene insertion/deletion mutations are enabled.

  • Migrate distance challenge: Fixed challenge 7 (MIGRATE_DISTANCE) to require a minimum distance traveled. Individuals must now travel at least half the maximum grid dimension from their birth location to survive, preventing all individuals from passing regardless of movement.

Code Quality

  • Removed outdated TODO comment about optimizing for long genomes (optimization already exists for Jaro-Winkler method).

Compatibility

This release maintains full compatibility with existing simulations. The genome comparison fix improves upon the C++ version by gracefully handling variable-length genomes without crashes.

1.0.2

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 31 Dec 20:10

BiosimRust v1.0.2

Bug Fixes

  • KillForward action: Implemented complete kill functionality to match C++ version. The action now properly queues target individuals for death when conditions are met.
  • SET_LONGPROBE_DIST action: Fixed to use hardcoded maximum distance of 32, matching C++ behavior.
  • EMIT_SIGNAL0 action: Added missing probability check using prob2bool(), ensuring signal emission matches C++ implementation.
  • Movement validation: Fixed to check if target location is empty before queuing movement, matching C++ behavior and improving efficiency.

Code Quality

  • Cleaned up comments throughout the codebase, removing implementation details while preserving high-level descriptions of what the code does.

1.0.1

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 31 Dec 19:46

BiosimRust v1.0.1

Bug Fixes

  • Fixed CHALLENGE_STRING survival criteria (swapped min/max values and self-counting bug)
  • Fixed challenge area not showing when barriers are present
  • Fixed CENTER_WEIGHTED challenge visualization

New Features

  • Configurable challenge area color via displaychallengeareacolor parameter

Improvements

  • Added gradient visualization for CENTER_WEIGHTED challenge to show weighted survival zones

Full Changelog: v1.0.0...v1.0.1

1.0.0

Choose a tag to compare

@AlexanderGatesDev AlexanderGatesDev released this 31 Dec 15:38

BiosimRust v1.0.0

First stable release! BiosimRust is a complete Rust refactoring of the original C++ biosim4 project, providing improved safety, performance, and maintainability through Rust's type system and memory safety guarantees.

Key Features

Core Simulation

  • 19 Challenge Types: Circle, Right Half, Right Quarter, String, Center Weighted/Unweighted, Corner, Corner Weighted, Migrate Distance, Center Sparse, Left Eighth, Radioactive Walls, Against Any Wall, Touch Any Wall, East-West Eighths, Near Barrier, Pairs, Location Sequence, Altruism, and Altruism Sacrifice
  • Neural Network Evolution: Creatures evolve neural networks that process sensory inputs and produce actions
  • Multi-threaded Execution: Parallelized using rayon for efficient multi-core performance
  • Configurable Parameters: Hot-reloadable configuration file with 50+ tunable parameters

Visualization & Output

  • Real-time Display: Live visualization window using minifb (cross-platform)
  • Video Generation: Automatic MP4 video generation using FFmpeg
  • Challenge Area Highlighting: Customizable colored outlines showing survival challenge boundaries
  • Neural Network Visualization: Tools to generate network diagrams from evolved genomes
  • Progress Logging: Generation-by-generation statistics and diversity metrics

Analysis Tools

  • Epoch Logging: Detailed generation statistics (survivors, diversity, genome length)
  • Genome Analysis: Sample genome output in hex and neural network formats
  • Sensor/Action Statistics: Population-wide connection summaries
  • Graphing Tools: Gnuplot scripts for visualizing simulation progress

What's in 1.0.0

This is the first stable release, featuring:

  • Complete feature parity with the original C++ biosim4
  • Memory-safe Rust implementation with zero-cost abstractions
  • Cross-platform support (macOS, Linux, Windows)
  • Configurable challenge area visualization with custom colors
  • Improved error handling and parameter validation
  • Comprehensive unit tests
  • Windows x64 cross-compilation support

Platform Support

  • macOS: Native support (tested on Apple Silicon)
  • Linux: Native support
  • Windows: Cross-compilation support for x64 (GNU toolchain)

Documentation

  • See README.md for full documentation
  • Configuration guide: See biosimrust.ini for all available parameters
  • Original C++ reference: biosim4

Usage

  1. Configure your simulation in biosimrust.ini
  2. Run: ./target/release/biosimrust
  3. Watch the evolution unfold in real-time or review generated videos

Example configuration highlights:

  • displayenabled = true - Enable real-time visualization
  • displaychallengearea = true - Show challenge boundaries
  • displaychallengeareacolor = 255,255,0 - Set challenge area color (RGB)
  • challenge = 3 - Select challenge type (0-18)

Acknowledgments

This project is a Rust refactoring of the original biosim4 by David R. Miller. Special thanks to the original author for the inspiring work.