Skip to content

Genetic Algorithm: Crossover skipped for small routes may reduce diversity #189

@Gnananjali

Description

@Gnananjali

While experimenting with constrained configurations (e.g., small routing steps), I observed that crossover is skipped when route length is small:

if p1.shape[0] <= 5 or p2.shape[0] <= 5:
    return p1, p2

This effectively disables crossover, reducing genetic diversity and potentially increasing the likelihood of no feasible solution being found.

This behavior may impact GA performance in constrained scenarios.

Possible considerations:

  • Alternative crossover strategy for small routes
  • Fallback mutation or diversification mechanisms
  • Validation or warnings for such configurations

I have added tests to validate this behavior in a separate PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions