Skip to content

ListRuinMoveSelector can yield fewer moves than its original setup #45

@NewBornRustacean

Description

@NewBornRustacean

What's up😃 this is about list_ruin.rs from selector. It seems like the sampling logic could have side effects.

Problem

ListRuinMoveSelector can yield fewer moves than its configured moves_per_step when the working solution contains empty routes. The selector currently samples source entities from all routes. If an empty route is selected, no ruin move can be created and the attempt is dropped. As a result, moves_per_step behaves like a sampling-attempt budget rather than the number of ruin moves to generate.

For example, with one empty route, one non-empty route, and moves_per_step = 10, the selector may yield fewer than 10 moves depending on the RNG.

Test Coverage

The regression test uses the existing ListRuinMoveSelector test fixture with:

  • one empty route
  • one non-empty route
  • moves_per_step = 10
  • a fixed seed

This test verifies:

  • the selector yields exactly moves_per_step moves when at least one non-empty route exists
  • all yielded ruin moves target the non-empty route
  • empty routes do not consume move-generation attempts

This captures the current mismatch between the configured move count and the actual yielded move count.

How to improve? - implementation direction

  • fileter non-empty entities in advance.
  • sample from non-empty entites

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