leimbernon / rust_genetic_algorithms

This library provides a simple framework to implement genetic algorithms (GA) with Rust.
Apache License 2.0
5 stars 1 forks source link

[BUG] Error when number of couples is not set #75

Closed leimbernon closed 12 months ago

leimbernon commented 12 months ago

Describe the bug When the number of couples is not set we get an error from the ga library. [2023-11-22T14:36:27Z INFO genetic_algorithms::ga] Generation number: 1 thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/genetic_algorithms-1.3.1/src/operations/selection/tournament.rs:112:16: attempt to divide by zero note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

To Reproduce Steps to reproduce the behavior:

  1. Run a ga without setting the number of couples
  2. See error

Expected behavior We should have a default number of couples in base of the population.

Screenshots

Additional context